feat(dashboard): show Pi IP banner when connected to phone hotspot
- Banner appears on dashboard only when uplink mode is 'phone' - Shows the Pi's current IP so you can reach it from your phone's browser - Polls every 15s, hides automatically when not on phone hotspot Co-authored-by: Copilot <[email protected]>
This commit is contained in:
@@ -326,3 +326,24 @@ window.setInterval(function () {
|
||||
message.hidden = false;
|
||||
});
|
||||
}, 30000);
|
||||
|
||||
// ── Phone hotspot banner ───────────────────────────────────────────────────
|
||||
(function () {
|
||||
const banner = document.getElementById('phone-hotspot-banner');
|
||||
const ipEl = document.getElementById('phone-hotspot-ip');
|
||||
function checkUplink() {
|
||||
fetch('/api/uplink/status')
|
||||
.then(r => r.ok ? r.json() : null)
|
||||
.then(s => {
|
||||
if (s && s.mode === 'phone' && s.ip_address) {
|
||||
ipEl.textContent = `http://${s.ip_address}/`;
|
||||
banner.hidden = false;
|
||||
} else {
|
||||
banner.hidden = true;
|
||||
}
|
||||
})
|
||||
.catch(() => { banner.hidden = true; });
|
||||
}
|
||||
checkUplink();
|
||||
window.setInterval(checkUplink, 15000);
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user