Files
corescope-rx/index.html
efiten fb34bd3725 android: the deployment card says step by step what to do
Three testers asked what to enter under Settings > Deployment. Until a deployment is chosen
the card now stands out (blue, title "First step: choose where your data goes") and lists
the steps: open your CoreScope on another screen, open Coverage, scan its QR code or type
the address under it. Once chosen it shrinks to one line naming where the app uploads.
2026-11-12 16:54:49 +01:00

254 lines
17 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
<title>CoreDrive RX — coverage capture</title>
<link rel="manifest" href="/manifest.webmanifest" />
<meta name="theme-color" content="#0f1115" />
<link rel="apple-touch-icon" href="/icon-192.png" />
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
<style>
/* System bars. The Android app draws under the status and navigation bars, and
Capacitor reports their size as --safe-area-inset-* (env() on older WebViews and
on iOS). In a desktop browser all four are 0. */
:root {
--inset-top: var(--safe-area-inset-top, env(safe-area-inset-top, 0px));
--inset-bottom: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
--inset-left: var(--safe-area-inset-left, env(safe-area-inset-left, 0px));
--inset-right: var(--safe-area-inset-right, env(safe-area-inset-right, 0px));
--tip-bg: #1a1d24;
--tip-border: #2a2f3a;
--tip-text: #e6e6e6;
--tip-backdrop: rgba(0, 0, 0, .6);
--bgchip-bg: #3a2e10;
--bgchip-border: #6b5212;
--bgchip-text: #e6a23c;
--updchip-bg: #10283a;
--updchip-border: #1d4a6b;
--updchip-text: #8cc8ff;
--setup-bg: #10283a;
--setup-border: #2d6fa3;
--setup-text: #cfe6ff;
}
.card.setup { background: var(--setup-bg); border: 2px solid var(--setup-border); }
.card.setup label { color: var(--setup-text); font-size: 16px; font-weight: 600; }
.deploysteps { color: var(--setup-text); font-size: 14px; line-height: 1.45; margin: 6px 0 4px; }
.deploysteps ol { margin: 6px 0 0 20px; padding: 0; }
.deploysteps li { margin: 4px 0; }
.updchip { display: none; cursor: pointer; background: var(--updchip-bg); color: var(--updchip-text); border: 1px solid var(--updchip-border); border-radius: 8px; padding: 10px 12px; margin: 10px 0; font-size: 13px; overflow-wrap: anywhere; }
.bgchip { display: none; cursor: pointer; background: var(--bgchip-bg); color: var(--bgchip-text); border: 1px solid var(--bgchip-border); border-radius: 8px; padding: 10px 12px; margin: 10px 0; font-size: 13px; }
dialog.tip { max-width: 420px; width: calc(100% - 48px); box-sizing: border-box; background: var(--tip-bg); color: var(--tip-text); border: 1px solid var(--tip-border); border-radius: 10px; padding: 16px; font-size: 14px; line-height: 1.45; }
dialog.tip::backdrop { background: var(--tip-backdrop); }
dialog.tip h2 { font-size: 16px; margin: 0 0 8px; }
dialog.tip p { margin: 0 0 10px; }
dialog.tip a { color: inherit; text-decoration: underline; }
body { font-family: system-ui, sans-serif; margin: 0; padding: calc(16px + var(--inset-top)) calc(16px + var(--inset-right)) 16px calc(16px + var(--inset-left)); background: #0f1115; color: #e6e6e6; }
h1 { font-size: 18px; }
.card { background: #1a1d24; border: 1px solid #2a2f3a; border-radius: 8px; padding: 12px; margin: 10px 0; }
label { display: block; font-size: 12px; color: #9aa4b2; margin: 6px 0 2px; }
button { width: 100%; padding: 12px; margin-top: 4px; font-size: 15px; border: 0; border-radius: 8px; background: #2ecc71; color: #07120a; font-weight: 600; }
button.danger { background: #e74c3c; color: #fff; }
button:disabled { opacity: .6; }
.btn2 { background: #3b82f6; color: #fff; }
.btn2.on { background: #2ecc71; color: #07120a; }
.stats { display: flex; gap: 16px; font-size: 24px; font-weight: 700; }
.stats div { flex: 1; text-align: center; }
.stats small { display: block; font-size: 11px; color: #9aa4b2; font-weight: 400; }
.muted { font-size: 12px; color: #9aa4b2; margin-top: 6px; }
.muted a { color: inherit; text-decoration: underline; }
.progress { margin-top: 10px; font: 12px/1.7 ui-monospace, monospace; }
.progress div { color: #9fe6b8; }
.progress div.pending { color: #9aa4b2; }
.progress div.err { color: #ff8b7a; }
.row { display: flex; gap: 8px; }
.row button { flex: 1; }
label.inline { display: flex; align-items: center; gap: 8px; margin: 8px 0 0; font-size: 13px; color: #e6e6e6; }
label.inline input { width: auto; }
input.txt { width: 100%; box-sizing: border-box; padding: 10px; font-size: 15px; background: #0a0c10; color: #e6e6e6; border: 1px solid #2a2f3a; border-radius: 6px; }
#log { background: #0a0c10; border: 1px solid #2a2f3a; border-radius: 6px; padding: 8px; font: 11px/1.4 ui-monospace, monospace; white-space: pre-wrap; word-break: break-all; max-height: 300px; overflow: auto; margin-top: 8px; }
#log .lg-ok { color: #9fe6b8; } /* captured / published (the data product) */
#log .lg-no { color: #ff8b7a; } /* held back / failed */
#log .lg-st { color: #9aa4b2; } /* status */
#log .lg-tx { color: #e6a23c; } /* our own outbound radio sends (discover / flood) */
.statusstrip { font-size: 12px; color: #9aa4b2; margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.statusstrip .udot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #9aa4b2; margin-right: 3px; }
.discstatus { font-size: 12px; margin-top: 4px; min-height: 13px; color: #9aa4b2; }
.lh { font-size: 13px; }
.meter { position: relative; height: 18px; background: #0a0c10; border: 1px solid #2a2f3a; border-radius: 5px; overflow: hidden; margin-top: 6px; }
.meterfill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: #2ecc71; transition: width .2s linear; }
.meterpeak { position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; left: 0; transition: left .2s linear; }
.meterval { font: 12px ui-monospace, monospace; color: #9aa4b2; margin-top: 4px; }
.recent { display: flex; flex-direction: column; gap: 4px; }
.rr { display: flex; align-items: center; gap: 8px; padding: 7px 9px; background: #11141a; border: 1px solid #2a2f3a; border-radius: 6px; font-size: 13px; }
.rr .dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.rr .rk { font-family: ui-monospace, monospace; }
.rr .rname { flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rr .rsnr { margin-left: auto; font-weight: 600; flex: 0 0 auto; }
.rr .rc { color: #9aa4b2; font-size: 11px; min-width: 34px; text-align: right; }
.rg { display: flex; flex-direction: column; gap: 4px; }
.rgrow { padding: 7px 9px; background: #11141a; border: 1px solid #2a2f3a; border-radius: 6px; font-size: 13px; }
.rgrow .rgname { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rgrow .rgregions { font-size: 12px; color: #e6e6e6; margin-top: 2px; }
.rgrow .rgregions.none { color: #e6a23c; }
.rgrow .rgunscoped { margin-left: 6px; font-size: 10px; color: #9aa4b2; border: 1px solid #2a2f3a; border-radius: 4px; padding: 0 4px; white-space: nowrap; }
.rgrow .rgwarn { font-size: 11px; color: #ff8b7a; margin-top: 2px; }
body { padding-bottom: calc(70px + var(--inset-bottom)); }
.bottombar { position: fixed; bottom: 0; left: 0; right: 0; height: 56px; padding: 0 var(--inset-right) var(--inset-bottom) var(--inset-left); display: flex; background: #1a1d24; border-top: 1px solid #2a2f3a; z-index: 1000; }
.bottombar .tab { flex: 1; background: transparent; color: #9aa4b2; border: 0; border-radius: 0; margin: 0; font-size: 14px; font-weight: 600; }
.bottombar .tab.active { color: #2ecc71; }
#view-map #liveMap { height: calc(100vh - 140px - var(--inset-top) - var(--inset-bottom)); min-height: 300px; border: 1px solid #2a2f3a; border-radius: 6px; }
</style>
</head>
<body>
<h1>📡 CoreDrive RX <span id="appver" style="font-size:11px;font-weight:400;color:#9aa4b2"></span></h1>
<div class="muted" style="margin-top:-6px;margin-bottom:8px">Mobile RX coverage for CoreScope</div>
<dialog id="batteryTip" class="tip">
<h2>Keep capturing with the screen off</h2>
<p>Some phones, OnePlus for one, close apps in the background to save battery, even while the
capture notification shows. Capture then stops without a warning.</p>
<p>Before you drive, open the phone's <b>Settings &gt; Apps &gt; CoreDrive RX &gt; Battery</b> and
choose <b>Unrestricted</b>, or turn off battery optimisation and allow background activity.
The names differ per brand; <a href="https://dontkillmyapp.com" target="_blank" rel="noopener">dontkillmyapp.com</a>
shows them for yours.</p>
<button id="btnBatteryTipOk">OK, connect</button>
</dialog>
<div id="btnotice" style="display:none;background:#3a1414;color:#ff8b7a;border:1px solid #6b2020;border-radius:8px;padding:10px 12px;margin:10px 0;font-size:13px">⚠️ Web Bluetooth isn't available in this browser. On <b>iOS</b>, open this page in the <b>Bluefy</b> browser; on <b>Android</b>, use <b>Chrome</b>.</div>
<div id="view-home">
<div class="card">
<div class="stats">
<div><span id="cNodes">0</span><small>nodes</small></div>
<div><span id="cHex">0</span><small>hex cells</small></div>
<div><span id="cRx">0</span><small>receptions</small></div>
<div id="cRfLogRow" style="display:none"><span id="cRfLog">0</span><small>RF log</small></div>
</div>
<div class="statusstrip">
<span id="sGps">… no fix</span><span>·</span>
<span id="sPending">0 pending</span><span>·</span>
<span id="sUpload"><span class="udot" id="uDot"></span>upload</span><span>·</span>
<span id="sRate">0 pkt/min</span>
</div>
<div class="discstatus" id="discStatus"></div>
</div>
<div class="card" id="lastHeardCard" style="display:none">
<label>Last reception</label>
<div class="lh" id="lhLine">—</div>
<div class="meter"><div class="meterfill" id="snrFill"></div><div class="meterpeak" id="snrPeak"></div></div>
<div class="meterval" id="snrVal"></div>
</div>
<div id="pausechip" style="display:none;background:#3a2e10;color:#e6a23c;border:1px solid #6b5212;border-radius:8px;padding:10px 12px;margin:10px 0;font-size:13px;font-weight:600"></div>
<!-- Uplink warning: shown continuously while receptions are being queued but not
uploaded. Red, not amber — the pause chip above is a normal condition, this
one is not. A degraded uplink used to be visible nowhere on this screen. -->
<div id="uplinkchip" style="display:none;background:#3a1414;color:#ff8a80;border:1px solid #6b1212;border-radius:8px;padding:10px 12px;margin:10px 0;font-size:13px;font-weight:600"></div>
<!-- After a minute or more in the background while connected: how long, and how many
receptions were not saved because the browser paused GPS (src/background.js). -->
<div id="bgchip" class="bgchip"></div>
<!-- Android app: a newer version exists (src/appupdate.js). -->
<div id="updchip" class="updchip"></div>
<div id="msgchip" style="display:none;cursor:pointer;background:#10283a;color:#8cc8ff;border:1px solid #1d4a6b;border-radius:8px;padding:10px 12px;margin:10px 0;font-size:13px"></div>
<div class="card">
<label>Recently heard nodes (latest SNR)</label>
<div id="recent" class="recent"><div class="muted">— nothing yet —</div></div>
</div>
<div class="card" id="regionsCard" style="display:none">
<label>Last 5 declared scopes (region discovery)</label>
<div id="regionsList" class="rg"></div>
</div>
</div><!-- /view-home -->
<div id="view-map" style="display:none">
<label>Live coverage (this session) — hexes persist until you reload</label>
<div id="liveMap"></div>
</div>
<div id="view-settings" style="display:none">
<!-- Native app only (src/deployment.js): which CoreDrive RX deployment's
config.json this app uses. The web app always uses its own. -->
<!-- Until a deployment is chosen the card carries .setup and shows the steps; testers
did not know what to enter here, and nobody opens the user guide for it. -->
<div class="card" id="deployCard" style="display:none">
<label for="deployUrl" id="deployTitle">Deployment: where your data goes</label>
<div class="deploysteps" id="deploySteps" style="display:none">
The app needs to know which CoreScope receives your data. You do this once:
<ol>
<li>On a computer or another phone, open the CoreScope of your MeshCore group in a browser.</li>
<li>In its menu, open <b>Coverage</b>. That page shows a QR code with an address under it.</li>
<li>Tap <b>Scan QR code</b> below and point the camera at it.<br>Only this phone? Type the address under the QR code into the field and tap <b>Use this deployment</b>.</li>
</ol>
</div>
<button id="btnDeployScan" class="btn2" style="margin-top:8px">📷 Scan QR code</button>
<input id="deployUrl" class="txt" type="url" inputmode="url" autocapitalize="off" spellcheck="false" placeholder="https://rx.example.org" style="margin-top:8px">
<button id="btnDeploy" class="btn2" style="margin-top:8px">Use this deployment</button>
<div class="muted" id="deployInfo"></div>
<div class="muted" id="deployMsg" style="color:#ff8b7a"></div>
</div>
<div class="card">
<button id="btnConnect">Connect companion (BLE)</button>
<div class="progress" id="progress"></div>
<div class="muted" id="status"></div>
</div>
<div class="card">
<label>CoreScope</label>
<div class="muted" id="brokerStatus">— not connected —</div>
<button id="btnPush" class="btn2" style="margin-top:8px">Push pending now</button>
</div>
<!-- CoreScope account (src/account.js). Hidden unless the CoreScope this app
uploads to has user management on, or this companion's uploads are held. -->
<div class="card" id="accountCard" style="display:none">
<label>CoreScope account</label>
<div id="acctOut">
<label for="acctEmail">Email</label>
<input id="acctEmail" class="txt" type="email" autocomplete="username" autocapitalize="off" spellcheck="false">
<label for="acctPassword">Password</label>
<input id="acctPassword" class="txt" type="password" autocomplete="current-password">
<button id="btnLogin" class="btn2" style="margin-top:8px">Log in</button>
</div>
<div id="acctIn" style="display:none">
<div class="muted" id="acctWho"></div>
<div id="acctCompanions" class="recent" style="margin-top:6px"></div>
<button id="btnLogout" class="btn2" style="margin-top:8px">Log out</button>
</div>
<div class="muted" id="acctLink"></div>
<button id="btnLinkRetry" class="btn2" style="display:none;margin-top:8px">Retry</button>
<div class="muted" id="acctHold" style="display:none;color:#e6a23c"></div>
<div class="muted" id="acctMsg" style="color:#ff8b7a"></div>
</div>
<div class="card">
<label>Companion</label>
<div class="muted" id="companionInfo">— not connected —</div>
<div class="muted" id="hashinfo"></div>
</div>
<div class="card">
<label>Capture</label>
<label class="inline"><input type="checkbox" id="chkSound"> Sound ping when a node is mapped</label>
<label class="inline"><input type="checkbox" id="chkMsg"> Notify when a direct message waits on the companion</label>
<label class="inline"><input type="checkbox" id="chkMsgSound"> &hellip; with a sound</label>
</div>
<div class="card">
<label>Diagnostics</label>
<div class="muted" id="fullRfLogInfo" style="display:none">Full RF logging: on</div>
<div class="muted" id="rfSamplerInfo" style="display:none"></div>
<div class="muted" id="regionsInfo" style="display:none"></div>
<label class="inline"><input type="checkbox" id="chkVerbose"> Verbose (raw packet bytes + unattributable frames)</label>
<div class="row" style="margin-top:10px">
<button id="btnDbg" class="btn2">Show debug log</button>
<button id="btnClear" class="btn2">Clear log</button>
</div>
<button id="btnShareLog" class="btn2" style="margin-top:8px">📤 Share / mail debug log</button>
<button id="btnPingNow" class="btn2" style="margin-top:8px;display:none">📡 Uplink ping now</button>
<pre id="log" style="display:none"></pre>
</div>
<div class="card">
<label>About</label>
<div class="muted"><a href="https://github.com/efiten/coredrive-rx/blob/master/docs/play/privacy-policy.md" target="_blank" rel="noopener">Privacy policy</a> &middot; <a href="https://github.com/efiten/coredrive-rx/blob/master/docs/user-guide.md" target="_blank" rel="noopener">User guide</a> &middot; <a href="https://github.com/efiten/coredrive-rx" target="_blank" rel="noopener">Source code</a></div>
</div>
</div>
<nav class="bottombar">
<button id="tabHome" class="tab active">🏠 Home</button>
<button id="tabMap" class="tab">🗺️ Map</button>
<button id="tabSettings" class="tab">⚙️ Settings</button>
</nav>
<script type="module" src="/src/app.js"></script>
</body>
</html>