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;
|
message.hidden = false;
|
||||||
});
|
});
|
||||||
}, 30000);
|
}, 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);
|
||||||
|
})();
|
||||||
|
|||||||
@@ -9,6 +9,11 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
<h3 class="text-dark mb-3 fw-bold">Dashboard</h3>
|
<h3 class="text-dark mb-3 fw-bold">Dashboard</h3>
|
||||||
|
|
||||||
|
<div id="phone-hotspot-banner" class="alert alert-info d-flex align-items-center gap-2 py-2 mb-3" hidden>
|
||||||
|
<i class="fas fa-mobile-alt"></i>
|
||||||
|
<span>Connected via phone hotspot — access this page at <strong id="phone-hotspot-ip"></strong></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
{# ── OBD stat cards ──────────────────────────────────────────────────── #}
|
{# ── OBD stat cards ──────────────────────────────────────────────────── #}
|
||||||
<div class="row g-2 mb-3">
|
<div class="row g-2 mb-3">
|
||||||
<div class="col-6 col-sm-4 col-xl-2">
|
<div class="col-6 col-sm-4 col-xl-2">
|
||||||
|
|||||||
Reference in New Issue
Block a user