diff --git a/html/admin.html b/html/admin.html index 3e04dac..c7c7836 100644 --- a/html/admin.html +++ b/html/admin.html @@ -292,6 +292,6 @@ - + diff --git a/ts/admin.ts b/ts/admin.ts index 41fdc14..d4fe9bf 100644 --- a/ts/admin.ts +++ b/ts/admin.ts @@ -84,23 +84,24 @@ window.tabs.addTab("accounts", null, accounts.reload); window.tabs.addTab("settings", null, settings.reload); for (let tab of ["invites", "accounts", "settings"]) { - if (window.location.pathname == "/" + tab) { + if (window.location.pathname == window.URLBase + "/" + tab) { window.tabs.switch(tab, true); } } -if (window.location.pathname == "/") { +if (window.location.pathname == window.URLBase + "/") { window.tabs.switch("invites", true); } document.addEventListener("tab-change", (event: CustomEvent) => { const urlParams = new URLSearchParams(window.location.search); const lang = urlParams.get('lang'); - let tab = "/" + event.detail; - if (tab == "/invites") { - if (window.location.pathname == "/") { - tab = "/"; - } else { tab = "../"; } + let tab = window.URLBase + "/" + event.detail; + if (tab == window.URLBase + "/invites") { + if (window.location.pathname == window.URLBase + "/") { + tab = window.URLBase + "/"; + } else if (window.URLBase) { tab = window.URLBase; } + else { tab = "../"; } } if (lang) { tab += "?lang=" + lang diff --git a/ts/modules/invites.ts b/ts/modules/invites.ts index 173d1de..b13570e 100644 --- a/ts/modules/invites.ts +++ b/ts/modules/invites.ts @@ -45,7 +45,7 @@ export class DOMInvite implements Invite { for (let split of ["#", "?"]) { codeLink = codeLink.split(split)[0]; } - this._codeLink = codeLink + "invite/" + code; + this._codeLink = codeLink + window.URLBase + "invite/" + code; const linkEl = this._codeArea.querySelector("a") as HTMLAnchorElement; if (this.label == "") { linkEl.textContent = code.replace(/-/g, '-'); diff --git a/views.go b/views.go index 177d4b1..d1ab204 100644 --- a/views.go +++ b/views.go @@ -36,7 +36,7 @@ func (app *appContext) pushResources(gc *gin.Context, admin bool) { if admin { toPush := []string{"/js/admin.js", "/js/theme.js", "/js/lang.js", "/js/modal.js", "/js/tabs.js", "/js/invites.js", "/js/accounts.js", "/js/settings.js", "/js/profiles.js", "/js/common.js"} for _, f := range toPush { - if err := pusher.Push(f, nil); err != nil { + if err := pusher.Push(app.URLBase+f, nil); err != nil { app.debug.Printf("Failed HTTP2 ServerPush of \"%s\": %+v", f, err) } }