// The connect page: while the code waits, post "Check again" every five // seconds (Equipo's shortest interval) and move on when the state changes. // Without this script the person presses Check again themselves. const form = document.querySelector("form[data-connect-check]"); if (form) { setInterval(async () => { if (document.hidden) return; try { const res = await fetch(form.action, { method: "POST", headers: { Accept: "application/json" }, body: new URLSearchParams(new FormData(form)), }); const out = await res.json(); if (res.ok && out.state !== "pending") location.assign(out.location); } catch { // Equipo or Base is unreachable: try again on the next tick. } }, 5000); }