Fix small bug with ProxyRegistrar on first load.

This commit is contained in:
wearrrrr 2024-04-03 22:04:52 -05:00
parent 390f3e73d9
commit 74cd71e255
2 changed files with 89 additions and 85 deletions

View file

@ -54,6 +54,8 @@
async function loadContent() {
await initTransport();
// The setTimeout is because service workers are a little silly and can take a while longer to register despite .then being called, which causes a bug on the first load.
setTimeout(async () => {
let openWith = localStorage.getItem("alu__selectedOpenWith");
let currentProxy = localStorage.getItem("alu__selectedProxy");
let url = input!.value.trim();
@ -140,6 +142,7 @@
}, 500);
};
}
}, 100);
}
async function formEventListener(event: Event) {

View file

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