diff options
| author | altaf-creator <dev@altafcreator.com> | 2025-12-02 15:39:04 +0700 |
|---|---|---|
| committer | altaf-creator <dev@altafcreator.com> | 2025-12-02 15:39:04 +0700 |
| commit | 988db9361ca86765dc1645bcdcb77466cfd0e8e0 (patch) | |
| tree | ffbcae9086ae23c2a8911803d1507d7ee4d1e4d7 /frontend | |
| parent | a69d6aa6f0f2e98bcacb4016bf5530d5a420270f (diff) | |
block is now a cookie
Diffstat (limited to 'frontend')
| -rw-r--r-- | frontend/assets/.DS_Store | bin | 6148 -> 6148 bytes | |||
| -rw-r--r-- | frontend/main.js | 31 | ||||
| -rw-r--r-- | frontend/style.css | 1 |
3 files changed, 27 insertions, 5 deletions
diff --git a/frontend/assets/.DS_Store b/frontend/assets/.DS_Store Binary files differindex 4e6198d..320d9b9 100644 --- a/frontend/assets/.DS_Store +++ b/frontend/assets/.DS_Store diff --git a/frontend/main.js b/frontend/main.js index e677c68..6c46b20 100644 --- a/frontend/main.js +++ b/frontend/main.js @@ -25,10 +25,7 @@ async function checkUserStatus() { async function checkMachineStatus() { const response = await fetch(`${API_URL}/status`, { method: "POST", - headers: { - "Content-Type": "application/json" - }, - body: JSON.stringify({block: 1}), + credentials: "include", }); return await response.json(); } @@ -69,17 +66,41 @@ function start() { }); } +// --- information loading + cookie setting (from server) +async function information(urlParam = null) { + const response = fetch(`${API_URL}/info`, { + credentials: "include", + method: "POST", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify({ "machine_id": urlParam ? urlParam : await browser.cookies.get({name: "auth_block", url: API_URL}) }) + }); + + const block = await response.json()["block"]; + + document.getElementById("logo-id").innerText = block; + + return Promise.resolve(block); +} + // ------ page specific ----- // ---- machine status page +const STATUS_INTERVAL = 30 + // --- machines visual async function startUpdateMachines() { + const urlParams = new URLSearchParams(window.location.search); + + await information(urlParams.get("block")); + updateMachines(); while (true) { - await delay(30 * 1000); + await delay(STATUS_INTERVAL * 1000); await updateMachines(); } diff --git a/frontend/style.css b/frontend/style.css index 3b727c0..297b0ff 100644 --- a/frontend/style.css +++ b/frontend/style.css @@ -241,4 +241,5 @@ body { button { font-family: "Interesting", sans-serif; + font-size: 1rem; } |
