diff options
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; } |
