Fix misc bugs with cloaking, empty localStorage values, and remove redundant transportManager code.

This commit is contained in:
wearrrrr 2024-04-07 22:57:51 -05:00
parent 171a163531
commit 2bd41a9552
3 changed files with 6 additions and 6 deletions

View file

@ -11,6 +11,9 @@
link = document.createElement("link"); link = document.createElement("link");
link.rel = "icon"; link.rel = "icon";
} }
if (!parsedCloak.icon.startsWith("http")) {
parsedCloak.icon = window.location.origin + parsedCloak.icon;
}
link.href = `/custom-favicon?url=${parsedCloak.icon}`; link.href = `/custom-favicon?url=${parsedCloak.icon}`;
document.getElementsByTagName("head")[0].appendChild(link); document.getElementsByTagName("head")[0].appendChild(link);
} }

View file

@ -311,10 +311,10 @@ const t = i18n.useTranslations(lang);
const useWss = location.protocol == "https:"; const useWss = location.protocol == "https:";
const webSocketProtocol = useWss ? "wss://" : "ws://"; const webSocketProtocol = useWss ? "wss://" : "ws://";
let savedWispUrl = localStorage.getItem("alu__wispUrl"); let savedWispUrl = localStorage.getItem("alu__wispUrl");
if (savedWispUrl == null) if (savedWispUrl == null || savedWispUrl == "")
localStorage.setItem("alu__wispUrl", webSocketProtocol + location.host + "/wisp/"); localStorage.setItem("alu__wispUrl", webSocketProtocol + location.host + "/wisp/");
let savedBareUrl = localStorage.getItem("alu__bareUrl"); let savedBareUrl = localStorage.getItem("alu__bareUrl");
if (savedBareUrl == null) localStorage.setItem("alu__bareUrl", location.origin + "/bare/"); if (savedBareUrl == null || savedBareUrl == "") localStorage.setItem("alu__bareUrl", location.origin + "/bare/");
wispURLInput.value = localStorage.getItem("alu__wispUrl"); wispURLInput.value = localStorage.getItem("alu__wispUrl");
bareURLInput.value = localStorage.getItem("alu__bareUrl"); bareURLInput.value = localStorage.getItem("alu__bareUrl");
// Proxy settings // Proxy settings

View file

@ -28,9 +28,6 @@ export default class TransportManager {
if (transport) { if (transport) {
this.transport = transport; this.transport = transport;
} }
if (navigator.userAgent.includes("Firefox")) {
this.transport = "BareMod.BareClient";
}
if (localStorage.getItem("alu__selectedTransport") != null && !transport) { if (localStorage.getItem("alu__selectedTransport") != null && !transport) {
this.transport = JSON.parse(localStorage.getItem("alu__selectedTransport")!).value; this.transport = JSON.parse(localStorage.getItem("alu__selectedTransport")!).value;
} }
@ -58,7 +55,7 @@ export default class TransportManager {
let transportConfig: transportConfig = { wisp: wispURL }; let transportConfig: transportConfig = { wisp: wispURL };
if (this.transport == "BareMod.BareClient") { if (this.transport == "BareMod.BareClient") {
transportConfig = localStorage.getItem("alu__bareURL") || window.location.origin + "/bare/"; transportConfig = localStorage.getItem("alu__bareUrl") || window.location.origin + "/bare/";
} }
SetTransport(this.transport, transportConfig); SetTransport(this.transport, transportConfig);