fix(ros): remove listener que abortava a API apos o login; liberacao de 2min via login automatico
build-image / build-push (push) Successful in 1m47s
build-image / build-push (push) Successful in 1m47s
This commit is contained in:
1 parent
8e65d092e2
commit
fb3135d18f
4 files changed
+87
-36
No files matched your search
@@ -602,8 +602,6 @@
|
||||
let toastTimer = null;
|
||||
let selectedPlanId = null;
|
||||
let mpDevice = null;
|
||||
let freeTimer = null;
|
||||
let freeGrants = 0;
|
||||
|
||||
const $ = (id) => document.getElementById(id);
|
||||
|
||||
@@ -655,8 +653,7 @@
|
||||
$('view-pay').classList.toggle('hidden', view !== 'pay');
|
||||
$('view-voucher').classList.toggle('hidden', view !== 'voucher');
|
||||
if (view !== 'pay' && pollTimer) { clearInterval(pollTimer); pollTimer = null; }
|
||||
if (view !== 'pay' && freeTimer) { clearInterval(freeTimer); freeTimer = null; }
|
||||
if (view === 'pay' && !freeTimer) { freeTimer = setInterval(startFreeAccess, 120000); }
|
||||
|
||||
window.scrollTo({ top: 0, behavior: 'instant' in window ? 'auto' : 'auto' });
|
||||
}
|
||||
|
||||
@@ -787,11 +784,11 @@
|
||||
window.location.href = hsUrl($('vUser').textContent, $('vPass').textContent);
|
||||
});
|
||||
|
||||
// ===== Internet temporaria para pagar (abre o app do banco) =====
|
||||
// ===== Internet temporaria para pagar (login automatico no hotspot) =====
|
||||
async function startFreeAccess() {
|
||||
if (!mac) return;
|
||||
if (freeGrants >= 12) return;
|
||||
freeGrants++;
|
||||
if (sessionStorage.getItem('freeOk') || sessionStorage.getItem('freeTried')) return;
|
||||
sessionStorage.setItem('freeTried', '1');
|
||||
try {
|
||||
const res = await fetch('/api/access/start', {
|
||||
method: 'POST',
|
||||
@@ -799,10 +796,7 @@
|
||||
body: JSON.stringify({ mac }),
|
||||
});
|
||||
const d = await res.json();
|
||||
if (d.ok) {
|
||||
const mins = Math.round((d.seconds / 60) * 10) / 10;
|
||||
toast('Internet liberada por ' + mins + ' min para pagar');
|
||||
}
|
||||
if (d.loginUrl) window.location.href = d.loginUrl;
|
||||
} catch { /* segue */ }
|
||||
}
|
||||
|
||||
@@ -814,6 +808,8 @@
|
||||
} catch { /* usa padrao */ }
|
||||
}
|
||||
|
||||
if (new URLSearchParams(location.search).get('free') === '1') sessionStorage.setItem('freeOk', '1');
|
||||
|
||||
loadSiteConfig();
|
||||
loadPlans();
|
||||
startFreeAccess();
|
||||
|
||||
Reference in new issue
Block a user