diff --git a/internal/core/templates/add_repeater.html b/internal/core/templates/add_repeater.html index c2b713f..d56a80c 100644 --- a/internal/core/templates/add_repeater.html +++ b/internal/core/templates/add_repeater.html @@ -143,7 +143,10 @@ {{else if eq .Step "serial"}} {{/* ---- Step 3 (serial): configure a brand-new repeater and run over USB ---- */}}
@@ -279,6 +282,7 @@ + {{else}} diff --git a/internal/core/templates/console.html b/internal/core/templates/console.html index bf1777a..edb0ab2 100644 --- a/internal/core/templates/console.html +++ b/internal/core/templates/console.html @@ -60,7 +60,10 @@ swap needs no new markup. The flex row is nested so the [hidden] attribute wins

Console

@@ -154,5 +157,6 @@ swap needs no new markup. The flex row is nested so the [hidden] attribute wins + {{end}} diff --git a/internal/web/static/console.js b/internal/web/static/console.js index 536be21..c35555d 100644 --- a/internal/web/static/console.js +++ b/internal/web/static/console.js @@ -6,7 +6,7 @@ // separate "apply org configuration" script (console-config.js) can send commands // and react to session state without owning the socket: // window.MeshConsole.ready — is the modem connected & the session live? -// window.MeshConsole.supported — does this browser have WebSerial at all? +// window.MeshConsole.supported — can this browser reach a serial device at all? // window.MeshConsole.connect() — open the modem + session (needs a user gesture) // window.MeshConsole.send(text) — send a CLI command; returns false if not ready // window.MeshConsole.getLocation() — ask the server to fetch the repeater's coords @@ -26,8 +26,8 @@ // whether a command can be sent right now. const api = { ready: false, - supported: "serial" in navigator, - connect() {}, // replaced with the real routine below when WebSerial is present + supported: !!(window.MeshSerial && window.MeshSerial.supported), + connect() {}, // replaced with the real routine below when a serial transport is present send(text) { const t = String(text || "").trim(); if (!t || !api.ready || !ws || ws.readyState !== WebSocket.OPEN) return false; @@ -57,7 +57,7 @@ return url; } - if (!("serial" in navigator)) { + if (!api.supported) { const unsupportedEl = document.getElementById("unsupported"); if (unsupportedEl) unsupportedEl.hidden = false; if (connectBtn) connectBtn.disabled = true; @@ -125,7 +125,7 @@ log.innerHTML = ""; try { addLog("info", "Requesting serial port…"); - port = await navigator.serial.requestPort(); + port = await MeshSerial.requestPort(); await port.open({ baudRate: 115200 }); writer = port.writable.getWriter(); reader = port.readable.getReader(); diff --git a/internal/web/static/serial-setup.js b/internal/web/static/serial-setup.js index 8e89fa7..a777983 100644 --- a/internal/web/static/serial-setup.js +++ b/internal/web/static/serial-setup.js @@ -39,7 +39,7 @@ }; // --- feature detection ------------------------------------------------- - var hasSerial = "serial" in navigator; + var hasSerial = !!(window.MeshSerial && window.MeshSerial.supported); var hasEd25519 = !!(window.crypto && window.crypto.subtle); if (!hasSerial || !hasEd25519) { var u = $("unsupported"); @@ -276,7 +276,7 @@ var decoder = new TextDecoder(); try { addLog("info", "Requesting serial port…"); - port = await navigator.serial.requestPort(); + port = await MeshSerial.requestPort(); await port.open({ baudRate: 115200 }); writer = port.writable.getWriter(); reader = port.readable.getReader();