This commit is contained in:
MathMan05 committed 2025-06-16 22:12:47 -05:00
1 parent 3b57cb703e
commit c2e41ec085
3 files changed
+7 -14

No files matched your search

+1 -1
View File
@@ -11,7 +11,7 @@ import {I18n} from "./i18n.js";
await I18n.done;
if (!(sessionStorage.getItem("currentuser") || Localuser.users.currentuser)) {
window.location.href = "/login.html";
window.location.href = "/login";
return;
}
{
+1 -1
View File
@@ -136,7 +136,7 @@ class Localuser {
switchAccountDiv.classList.add("switchtable");
switchAccountDiv.textContent = I18n.getTranslation("switchAccounts");
switchAccountDiv.addEventListener("click", () => {
window.location.href = "/login.html";
window.location.href = "/login";
});
table.append(switchAccountDiv);
+5 -12
View File
@@ -56,26 +56,19 @@ function samedomain(url: string | URL) {
let enabled = "false";
let offline = false;
const htmlFiles = new Set(["/app", "/login", "/home", "/register", "/oauth2/auth", "/reset"]);
function isHtml(url: string): string | void {
const path = new URL(url).pathname;
if (htmlFiles.has(path) || htmlFiles.has(path + ".html")) {
return path + path.endsWith(".html") ? "" : ".html";
}
}
function toPath(url: string): string {
const Url = new URL(url);
let html = isHtml(url);
let html: string | undefined = undefined;
if (!html) {
const path = Url.pathname;
if (path.startsWith("/channels")) {
html = "./app.html";
html = "./app";
} else if (path.startsWith("/invite/") || path === "/invite") {
html = "./invite.html";
html = "./invite";
} else if (path.startsWith("/template/") || path === "/template") {
html = "./template.html";
html = "./template";
} else if (path === "/") {
html = "./home.html";
html = "./home";
}
}
return html || Url.pathname;