captsa add alert

This commit is contained in:
2026-04-21 19:17:28 +03:00
parent 7e5bfcefa4
commit b0d933c1a0
9 changed files with 162 additions and 6 deletions

View File

@@ -172,3 +172,31 @@ window.cancelCommand = async function(id) {
await fetch(`/dashboard/commands/${id}`, { method: 'DELETE' });
window.fetchLog();
};
window.fetchCaptchaStatus = async function() {
try {
const res = await fetch('/dashboard/captcha-status');
const data = await res.json();
const banner = document.getElementById('captcha-banner');
if (!banner) return;
if (data.captcha_active) {
// Only show it if the user hasn't explicitly clicked 'close' for this specific alert
if (banner.dataset.dismissed !== '1') {
banner.style.display = 'flex';
}
} else {
// Captcha cleared from the game - hide banner and reset dismiss state for next time
banner.style.display = 'none';
banner.dataset.dismissed = '0';
}
} catch (e) {}
};
window.dismissCaptchaBanner = function() {
const banner = document.getElementById('captcha-banner');
if (banner) {
banner.style.display = 'none';
banner.dataset.dismissed = '1';
}
};