From 6b18a2ecf143fb39412056ed16aaaac598e5de45 Mon Sep 17 00:00:00 2001 From: Hamza-Ayed Date: Tue, 30 Jun 2026 04:49:52 +0300 Subject: [PATCH] Update: 2026-06-30 04:49:51 --- backend/bot/standalone_worker.php | 49 ++++++++++++++++++++++++++----- 1 file changed, 41 insertions(+), 8 deletions(-) diff --git a/backend/bot/standalone_worker.php b/backend/bot/standalone_worker.php index 1c9fbc34..4a599d2b 100644 --- a/backend/bot/standalone_worker.php +++ b/backend/bot/standalone_worker.php @@ -724,8 +724,8 @@ $scrapedResults = json_decode(file_get_contents(RESULTS_FILE), true);
- - + +
@@ -740,7 +740,7 @@ $scrapedResults = json_decode(file_get_contents(RESULTS_FILE), true);
-
+
No pending tasks. Queue some tasks using the form on the left!
@@ -802,7 +802,7 @@ $scrapedResults = json_decode(file_get_contents(RESULTS_FILE), true);
-
+
No scraping results recorded yet. Results will appear here when the Android bot submits them.
@@ -865,16 +865,49 @@ $scrapedResults = json_decode(file_get_contents(RESULTS_FILE), true); document.querySelectorAll('.tab-btn').forEach(btn => btn.classList.remove('active')); document.querySelectorAll('.tab-content').forEach(content => content.classList.remove('active')); - // Add active class to selected tab button - const buttons = document.querySelectorAll('.tab-btn'); if (tabId === 'tasks') { - buttons[0].classList.add('active'); + document.getElementById('tab-btn-tasks').classList.add('active'); document.getElementById('tasks-tab').classList.add('active'); } else { - buttons[1].classList.add('active'); + document.getElementById('tab-btn-results').classList.add('active'); document.getElementById('results-tab').classList.add('active'); } } + + // Auto refresh dashboard data every 3 seconds + setInterval(() => { + fetch(window.location.href) + .then(response => response.text()) + .then(html => { + const parser = new DOMParser(); + const doc = parser.parseFromString(html, 'text/html'); + + const newTasksBtn = doc.getElementById('tab-btn-tasks'); + const newTasksList = doc.getElementById('tasks-list-container'); + const currentTasksBtn = document.getElementById('tab-btn-tasks'); + const currentTasksList = document.getElementById('tasks-list-container'); + + if (newTasksBtn && currentTasksBtn) { + currentTasksBtn.innerHTML = newTasksBtn.innerHTML; + } + if (newTasksList && currentTasksList) { + currentTasksList.innerHTML = newTasksList.innerHTML; + } + + const newResultsBtn = doc.getElementById('tab-btn-results'); + const newResultsList = doc.getElementById('results-list-container'); + const currentResultsBtn = document.getElementById('tab-btn-results'); + const currentResultsList = document.getElementById('results-list-container'); + + if (newResultsBtn && currentResultsBtn) { + currentResultsBtn.innerHTML = newResultsBtn.innerHTML; + } + if (newResultsList && currentResultsList) { + currentResultsList.innerHTML = newResultsList.innerHTML; + } + }) + .catch(err => console.error('Failed to fetch updates', err)); + }, 3000);