full server dashboard working

This commit is contained in:
2026-03-22 18:44:07 -07:00
parent 324eaff135
commit 97fdb3d5d8
19 changed files with 1441 additions and 169 deletions

View File

@ -0,0 +1,36 @@
/* --------------------------------------------------
1. Expose the API URL (identical to PHPs $apiUrl)
-------------------------------------------------- */
const API_URL = 'http://<?= h($api_bind_ip) ?>:<?= h($customApiPort) ?>/php_summary';
/* --------------------------------------------------
2. Build the endpoint list
-------------------------------------------------- */
document.addEventListener('DOMContentLoaded', () => {
const listEl = document.getElementById('endpointList');
const urlParam = new URLSearchParams(window.location.search);
const current = urlParam.get('host'); // e.g. "MC-CM3588"
fetch(API_URL)
.then(r => r.json())
.then(hosts => {
hosts.forEach(hostObj => {
const li = document.createElement('li');
const a = document.createElement('a');
a.href = '?host=' + encodeURIComponent(hostObj.hostname);
a.textContent = hostObj.hostname;
if (hostObj.hostname === current) a.classList.add('active');
li.appendChild(a);
listEl.appendChild(li);
});
})
.catch(err => {
console.error('Failed to load endpoint list:', err);
const li = document.createElement('li');
li.textContent = 'Unable to load endpoints';
listEl.appendChild(li);
});
});