Files
html/api/blade-tasks/poller.js
2026-04-12 22:57:03 +02:00

29 lines
1.1 KiB
JavaScript

// WEVIA Auto Task Poller — loaded via injection
(function(){
if(window._weviaPollerActive) return;
window._weviaPollerActive = true;
console.log("[WEVIA] Task poller v3 activated!");
async function poll(){
try {
const r = await fetch("/api/blade-poll.php?k=BLADE2026&action=poll");
const d = await r.json();
if(d.task && d.task.command){
console.log("[WEVIA] Executing:", d.task.name);
// Report done (browser cant run PowerShell, but marks as dispatched)
await fetch("/api/blade-poll.php?k=BLADE2026&action=done&file="+encodeURIComponent(d.task._file)+"&result=browser_dispatched");
// Force page reload to get fresh code
if(d.task.name && d.task.name.includes("RELOAD")){
location.reload();
}
}
} catch(e){ console.log("[WEVIA] poll error:", e); }
}
// Poll every 10s
setInterval(poll, 10000);
poll(); // immediate first poll
console.log("[WEVIA] Polling started — 10s interval");
})();