30 lines
No EOL
1.1 KiB
JavaScript
30 lines
No EOL
1.1 KiB
JavaScript
const SERVICE_BLACKLIST = [
|
|
'ixvd.net',
|
|
'proxy',
|
|
'2d.neo.ixvd.net',
|
|
'pad.sandbox.neo.ixvd.net',
|
|
];
|
|
|
|
const serviceHolderDiv = document.querySelector('#service-holder');
|
|
serviceHolderDiv.innerHTML = 'Loading...';
|
|
|
|
async function updateServices() {
|
|
let fetchResult = await (await fetch('/relay/gatus')).json()
|
|
serviceHolderDiv.innerHTML = '';
|
|
|
|
fetchResult.forEach(s => {
|
|
if (!s.results || s.results.length === 0) return;
|
|
let service = s.results[0];
|
|
if (service.hostname && !SERVICE_BLACKLIST.includes(service.hostname) && service.status === 200) {
|
|
let serviceDiv = document.createElement('div');
|
|
serviceDiv.classList.add('service');
|
|
serviceDiv.innerHTML = `
|
|
<span class="service-name"><a href="https://${service.hostname}" target="_blank" style="color: #de4aff">${s.name}</a></span>
|
|
<span class="service-status"><b style="color: ${service.success ? '#4f4' : 'red'}">${service.success ? 'Online' : 'Offline'}</b></span>
|
|
`;
|
|
serviceHolderDiv.appendChild(serviceDiv);
|
|
}
|
|
})
|
|
}
|
|
|
|
window.updateLoop.push(updateServices); |