mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-08-30 14:52:51 +08:00
system: configurable hostname (device identity)
Add a device hostname settable from the CLI (`hostname <text>`) and the System Settings page. The value is sanitized on ingest to JSON-safe printable ASCII (<=23 chars), stored in a shared __xdata buffer, seeded to "RTLPlayground" at boot, persisted through the startup-config, and reported in /information.json. It lives in the common header so other modules can advertise it (LLDP uses it as the System Name TLV).
This commit is contained in:
@@ -48,6 +48,14 @@ async function cmdSub() {
|
||||
}
|
||||
|
||||
|
||||
async function hostSub() {
|
||||
const h = document.getElementById("hostname").value;
|
||||
try { await fetch('/cmd', { method: 'POST', body: "hostname " + h }); }
|
||||
catch(err) { console.error(`Error: ${err}`); }
|
||||
fetchIP();
|
||||
}
|
||||
|
||||
|
||||
async function sendConfig(c) {
|
||||
if (isSaving) return;
|
||||
isSaving = true;
|
||||
@@ -123,6 +131,7 @@ function fetchIP() {
|
||||
document.getElementById("ip").value=s.ip_address;
|
||||
document.getElementById("netmask").value=s.ip_netmask;
|
||||
document.getElementById("gw").value=s.ip_gateway;
|
||||
if (document.getElementById("hostname")) document.getElementById("hostname").value = s.hostname || "";
|
||||
clearInterval(systemInterval);
|
||||
// Fetch and populate the config textbox
|
||||
fetchConfig().then((configText) => {
|
||||
|
||||
Reference in New Issue
Block a user