diff options
| author | yo momma <shutup@oops.wtf> | 2026-01-30 01:20:07 +0000 |
|---|---|---|
| committer | yo momma <shutup@oops.wtf> | 2026-01-30 01:20:07 +0000 |
| commit | e38f326875752a27a2819b6b7914ffe65e848aba (patch) | |
| tree | a92e248dadb7d663822bc4058cb1e713a14118ea /static/js/src/_main.js | |
| parent | b2d1b69fd6d9b1f0473ea70bc473df6f370891da (diff) | |
Refactor: JS init + HTTPS-safe URLs
Diffstat (limited to 'static/js/src/_main.js')
| -rwxr-xr-x | static/js/src/_main.js | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/static/js/src/_main.js b/static/js/src/_main.js index d97b0ac..18592d5 100755 --- a/static/js/src/_main.js +++ b/static/js/src/_main.js @@ -3,6 +3,9 @@ window.RootDomain = location.href.match(/http:\/\/(\w)+\./) ? '/' : '/'; +if (typeof window.Nick === 'undefined') { window.Nick = null; } +if (typeof window.Domain === 'undefined') { window.Domain = ''; } + window.cache = {}; window.PendingMessages = {}; window.MessageContentCache = {}; @@ -29,9 +32,17 @@ window.Anim = { "logThumbBig": {"width": "64px", "height": "64px", "marginRight": "-2px", "marginTop": "-2px"} } +function getCookieDomain() { + if (!location || !location.hostname) { return null; } + var hostname = location.hostname; + if (hostname == 'localhost' || hostname.match(/^\\d+\\.\\d+\\.\\d+\\.\\d+$/)) { return null; } + var parts = hostname.split("."); + if (parts.length < 2) { return null; } + return "." + parts.slice(-2).join("."); +} window.Preferences = { - "Domain": '.dump.fm', + "Domain": getCookieDomain(), "getProperty": function(prop, defaultValue) { var value = $.cookie(prop); @@ -46,4 +57,3 @@ window.Preferences = { $.cookie(prop, null, { domain: Preferences.Domain, path: '/' }); } }; - |
