diff options
| author | Pinapelz <yukais@pinapelz.com> | 2026-03-20 23:53:39 -0700 |
|---|---|---|
| committer | Pinapelz <yukais@pinapelz.com> | 2026-03-20 23:53:39 -0700 |
| commit | a36e9e471da0df8433536f7e8c003e1480da4fb3 (patch) | |
| tree | bce4dc1f8d68be42b445296d90a8bf8f098e3c2e /res | |
| parent | 3508776583c21785dffc2f0bc9e7dd81c3f08480 (diff) | |
set default sync to 1 sec, save PW to mem
Diffstat (limited to 'res')
| -rw-r--r-- | res/client.js | 2 | ||||
| -rw-r--r-- | res/setup.html | 27 |
2 files changed, 18 insertions, 11 deletions
diff --git a/res/client.js b/res/client.js index eeea7b3..faf13b4 100644 --- a/res/client.js +++ b/res/client.js @@ -1392,7 +1392,7 @@ var client_Main = function() { if(this.host == "") { this.host = "localhost"; } - client_Settings.init({ version : 6, uuid : null, name : "", hash : "", chatSize : 300, synchThreshold : 2, isSwapped : false, isUserListHidden : true, latestLinks : [], latestSubs : [], hotkeysEnabled : true, showHintList : true, checkboxes : [], checkedCache : []},$bind(this,this.settingsPatcher)); + client_Settings.init({ version : 6, uuid : null, name : "", hash : "", chatSize : 300, synchThreshold : 1, isSwapped : false, isUserListHidden : true, latestLinks : [], latestSubs : [], hotkeysEnabled : true, showHintList : true, checkboxes : [], checkedCache : []},$bind(this,this.settingsPatcher)); this.settings = client_Settings.read(); this.initListeners(); this.onTimeGet = new haxe_Timer(this.settings.synchThreshold * 1000); diff --git a/res/setup.html b/res/setup.html index 546ee1b..d7a044e 100644 --- a/res/setup.html +++ b/res/setup.html @@ -36,26 +36,33 @@ const formElement = document.getElementById("setup-form"); const errorsElement = document.getElementById("form-errors"); + function submitPassword(pw) { + const payload = { password: pw }; + return fetch("/gate", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload) }) + .then(res => res.json()) + .then(response => handleResponse(response, pw)) + .catch(() => handleResponse(null, pw)); + } + formElement.addEventListener("submit", function (e) { e.preventDefault(); - const { password } = formElement.elements; - const payload = { - password: password.value, - }; - - fetch("/gate", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload) }) - .then(res => res.json()) - .then(response => handleResponse(response)) - .catch(() => handleResponse(null)); + submitPassword(password.value); }, true); - function handleResponse(response) { + const savedPassword = localStorage.getItem("gate_password"); + if (savedPassword) { + submitPassword(savedPassword); + } + + function handleResponse(response, pw) { if (response && response.success === true) { + localStorage.setItem("gate_password", pw); window.location.href = "/"; return; } + localStorage.removeItem("gate_password"); showErrors(errorsElement, ["Incorrect password. Not cool man"]); } |
