Add host network info display and custom subnet scan to Receivers tab
Shows the server's network interfaces (IP, subnet) in the admin Receivers tab so users know which networks are being scanned. Adds an optional subnet input field to scan arbitrary networks (e.g. VLANs the server can route to but isn't directly attached to), with validation and a /20 size cap. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -325,6 +325,35 @@ textarea {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
#network-info-box {
|
||||
margin-top: 0;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.network-info-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.network-info-table th,
|
||||
.network-info-table td {
|
||||
text-align: left;
|
||||
padding: 6px 10px;
|
||||
border-bottom: 1px solid rgba(92, 148, 252, 0.3);
|
||||
}
|
||||
|
||||
.network-info-table th {
|
||||
font-family: 'Press Start 2P', monospace;
|
||||
font-size: 8px;
|
||||
color: #b4d4ec;
|
||||
}
|
||||
|
||||
.network-info-table td {
|
||||
color: #54fc54;
|
||||
font-family: 'Courier New', monospace;
|
||||
}
|
||||
|
||||
/* Toast Notification */
|
||||
.toast {
|
||||
position: fixed;
|
||||
|
||||
@@ -76,6 +76,10 @@
|
||||
<!-- Receivers Tab -->
|
||||
<section id="tab-receivers" class="tab-pane hidden">
|
||||
<h2>Receiver Configuration</h2>
|
||||
<div id="network-info-box" class="info-box">
|
||||
<h3>Host Network</h3>
|
||||
<div id="network-info">Loading...</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Discovery Mode</label>
|
||||
<select id="receiver-mode">
|
||||
@@ -91,6 +95,10 @@
|
||||
<label>Receiver Port</label>
|
||||
<input type="number" id="receiver-port" value="30003" min="1" max="65535">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Custom Subnet (optional)</label>
|
||||
<input type="text" id="scan-subnet" placeholder="e.g. 10.0.0.0/24 (leave empty to scan all local subnets)">
|
||||
</div>
|
||||
<div class="button-row">
|
||||
<button id="scan-receivers-btn" class="btn">SCAN NOW</button>
|
||||
<button id="restart-receivers-btn" class="btn">RESTART CONNECTIONS</button>
|
||||
|
||||
+36
-2
@@ -27,6 +27,7 @@
|
||||
adminPanel.classList.remove('hidden');
|
||||
loadConfig();
|
||||
loadThemes();
|
||||
loadNetworkInfo();
|
||||
refreshStatus();
|
||||
statusInterval = setInterval(refreshStatus, 5000);
|
||||
}
|
||||
@@ -170,6 +171,31 @@
|
||||
} catch (e) { /* ignore */ }
|
||||
}
|
||||
|
||||
// ------- Network Info -------
|
||||
async function loadNetworkInfo() {
|
||||
const el = document.getElementById('network-info');
|
||||
if (!el) return;
|
||||
try {
|
||||
const res = await fetch('/api/admin/network-info');
|
||||
if (!res.ok) { el.textContent = 'Failed to load'; return; }
|
||||
const data = await res.json();
|
||||
const ifaces = data.interfaces || [];
|
||||
if (!ifaces.length) {
|
||||
el.textContent = 'No network interfaces found';
|
||||
return;
|
||||
}
|
||||
let html = '<table class="network-info-table">';
|
||||
html += '<tr><th>Interface</th><th>IP Address</th><th>Network</th></tr>';
|
||||
ifaces.forEach(i => {
|
||||
html += `<tr><td>${i.name}</td><td>${i.ip}</td><td>${i.network}</td></tr>`;
|
||||
});
|
||||
html += '</table>';
|
||||
el.innerHTML = html;
|
||||
} catch (e) {
|
||||
el.textContent = 'Error loading network info';
|
||||
}
|
||||
}
|
||||
|
||||
// ------- Receivers -------
|
||||
function toggleManualIps(mode) {
|
||||
document.getElementById('manual-ips-group').classList.toggle('hidden', mode === 'AUTO');
|
||||
@@ -184,12 +210,20 @@
|
||||
btn.textContent = 'SCANNING...';
|
||||
btn.disabled = true;
|
||||
try {
|
||||
const res = await fetch('/api/admin/scan-receivers', { method: 'POST' });
|
||||
const subnet = (document.getElementById('scan-subnet').value || '').trim();
|
||||
const fetchOpts = { method: 'POST' };
|
||||
if (subnet) {
|
||||
fetchOpts.headers = { 'Content-Type': 'application/json' };
|
||||
fetchOpts.body = JSON.stringify({ subnet });
|
||||
}
|
||||
const res = await fetch('/api/admin/scan-receivers', fetchOpts);
|
||||
const data = await res.json();
|
||||
const box = document.getElementById('scan-results');
|
||||
const list = document.getElementById('scan-results-list');
|
||||
box.classList.remove('hidden');
|
||||
if (data.receivers && data.receivers.length) {
|
||||
if (data.error) {
|
||||
list.textContent = data.error;
|
||||
} else if (data.receivers && data.receivers.length) {
|
||||
list.textContent = data.receivers.join(', ');
|
||||
} else {
|
||||
list.textContent = 'No receivers found on network';
|
||||
|
||||
Reference in New Issue
Block a user