Make savedWispUrl and savedBareUrl behave MUCH nicer.

This commit is contained in:
wearrrrr 2024-04-02 20:54:17 -05:00
parent f5fdaf32e6
commit e0de8bde94
4 changed files with 10 additions and 13 deletions

View file

@ -133,7 +133,7 @@ app.use(function (req, res, next) {
}); });
app.use("/custom-favicon", async (req, res) => { app.use("/custom-favicon", async (req, res) => {
try { try {
const { url, type } = req.query; const { url } = req.query;
const response = await fetch(url).then((apiRes) => apiRes.buffer()); const response = await fetch(url).then((apiRes) => apiRes.buffer());
res.send(response); res.send(response);
} catch (err) { } catch (err) {

@ -1 +1 @@
Subproject commit 8793db1e2fe64cae8936c00bcd4f333f158f6ebd Subproject commit 06285f2a5abb58ef55e5127424be59cd46a66ae9

View file

@ -62,11 +62,11 @@ const transportsList = [
</div> </div>
<div class="setting__wisp_url"> <div class="setting__wisp_url">
<label for="wisp-url-input" class="setting-label">{t("settings.proxy.wispURL")}</label> <label for="wisp-url-input" class="setting-label">{t("settings.proxy.wispURL")}</label>
<Input height="50px" inputName="wisp-url" defaultTextContent="wss://aluu.xyz/" /> <Input height="50px" inputName="wisp-url" />
</div> </div>
<div class="setting__bare_url"> <div class="setting__bare_url">
<label for="bare-url-input" class="setting-label">{t("settings.proxy.bareURL")}</label> <label for="bare-url-input" class="setting-label">{t("settings.proxy.bareURL")}</label>
<Input height="50px" inputName="bare-url" defaultTextContent="https://aluu.xyz/bare/" /> <Input height="50px" inputName="bare-url" />
</div> </div>
<div class="setting__transport"> <div class="setting__transport">
<label class="setting-label">{t("settings.proxy.transport")}</label> <label class="setting-label">{t("settings.proxy.transport")}</label>

View file

@ -303,21 +303,18 @@ const t = i18n.useTranslations(lang);
let wispURLInput = document.getElementById("wisp-url-input"); let wispURLInput = document.getElementById("wisp-url-input");
let bareURLInput = document.getElementById("bare-url-input"); let bareURLInput = document.getElementById("bare-url-input");
let savedSearxngUrl = localStorage.getItem("alu__searxngUrl"); let savedSearxngUrl = localStorage.getItem("alu__searxngUrl");
if (savedSearxngUrl != undefined) { if (savedSearxngUrl != null) {
if (savedSearxngUrl == "") if (savedSearxngUrl == "")
localStorage.setItem("alu__searxngUrl", "https://searxng.site/"); localStorage.setItem("alu__searxngUrl", "https://searxng.site/");
searxngUrlInput.value = localStorage.getItem("alu__searxngUrl"); searxngUrlInput.value = localStorage.getItem("alu__searxngUrl");
} }
const useWss = location.protocol == "https:";
let savedWispUrl = localStorage.getItem("alu__wispUrl"); let savedWispUrl = localStorage.getItem("alu__wispUrl");
if (savedWispUrl != undefined) { if (savedWispUrl == null) localStorage.setItem("alu__wispUrl", useWss ? "wss://" : "ws://" + location.host + "/wisp/");
if (savedWispUrl == "") localStorage.setItem("alu__wispUrl", "wss://aluu.xyz/");
wispURLInput.value = localStorage.getItem("alu__wispUrl");
}
let savedBareUrl = localStorage.getItem("alu__bareUrl"); let savedBareUrl = localStorage.getItem("alu__bareUrl");
if (savedBareUrl != undefined) { if (savedBareUrl == null) localStorage.setItem("alu__bareUrl", location.origin + "/bare/")
if (savedBareUrl == "") localStorage.setItem("alu__bareUrl", "https://aluu.xyz/bare/"); wispURLInput.value = localStorage.getItem("alu__wispUrl");
bareURLInput.value = localStorage.getItem("alu__bareUrl"); bareURLInput.value = localStorage.getItem("alu__bareUrl");
}
// Proxy settings // Proxy settings
applyInputListeners(searxngUrlInput, "alu__searxngUrl"); applyInputListeners(searxngUrlInput, "alu__searxngUrl");
applyInputListeners(wispURLInput, "alu__wispUrl"); applyInputListeners(wispURLInput, "alu__wispUrl");