Fix fetching services status bug in index.html

This commit is contained in:
Iam54r1n4
2025-02-07 23:07:15 +00:00
parent 87d54d2ef5
commit 804b492b23

View File

@ -136,10 +136,11 @@
fetch('{{ url_for("server_services_status_api") }}') fetch('{{ url_for("server_services_status_api") }}')
.then(response => response.json()) .then(response => response.json())
.then(data => { .then(data => {
updateServiceBox('hysteria2', data.hysteria_server); updateServiceBox('hysteria2', data.hysteria_server);
updateServiceBox('telegrambot', data.hysteria_telegram); updateServiceBox('telegrambot', data.hysteria_telegram_bot);
updateServiceBox('singbox', data.hysteria_singbox); updateServiceBox('singbox', data.hysteria_singbox);
updateServiceBox('normalsub', data.hysetria_normal_sub); updateServiceBox('normalsub', data.hysteria_normal_sub);
}) })
.catch(error => console.error('Error fetching service statuses:', error)); .catch(error => console.error('Error fetching service statuses:', error));
} }
@ -148,7 +149,7 @@
const statusElement = document.getElementById(serviceName + '-status'); const statusElement = document.getElementById(serviceName + '-status');
const statusBox = document.getElementById(serviceName + '-status-box'); const statusBox = document.getElementById(serviceName + '-status-box');
if (status === 'active') { if (status === true) {
statusElement.textContent = 'Active'; statusElement.textContent = 'Active';
statusBox.classList.remove('bg-danger'); statusBox.classList.remove('bg-danger');
statusBox.classList.add('bg-success'); // Add green statusBox.classList.add('bg-success'); // Add green