mirror of
https://github.com/Kpa-clawbot/meshcore-analyzer.git
synced 2026-11-22 21:58:03 +00:00
## What An operator who runs a CoreDrive RX deployment (the web and Android companion app that feeds `clientRxCoverage`) can now point visitors of the Coverage page at it. - New optional config key `clientRxCoverage.appUrl`. `/api/config/client` sends it as `clientRxAppUrl`, only while `clientRxCoverage.enabled` is true and the value is an absolute `https` URL with a host name. Any other value is left out and logged once at startup with a `[config]` line. - `#/rx-coverage` shows a panel under the subtitle when the field is present: a QR code of exactly that URL (vendored `qrcode.js`, same call as the node detail QR), the URL as a link, and one line on scanning it in the app or opening it on a phone. Without the field there is no panel. The page still needs no login. - The subtitle named the app "CoreScope-RX" and linked to `github.com/efiten/corescope-rx`, the app's old repository name. It now says "CoreDrive RX" and links to `github.com/efiten/coredrive-rx`, or carries no link when the panel already shows the deployment. ## Why The CoreDrive RX Android app is not tied to one server: on first start it asks for the address of a deployment. Scanning a QR code on the Coverage page is the shortest way for a visitor to get there, including people without an account. Disclosure: CoreDrive RX (`efiten/coredrive-rx`) is my own project. ## Changes - `cmd/server`: `config.go` (`validClientRxAppURL`, startup warning), `types.go`, `routes.go`, `main.go`, `openapi.go`. - `public/rx-coverage.js` (`appPanelHtml`, `appLinkHtml`), `public/roles.js` (`window.MC_CLIENT_RX_APP_URL`), `public/node-reach-coverage.css` (existing CSS variables only). - Docs: `config.example.json`, `docs/client-rx-coverage.md`, `docs/api-spec.md`. ## Tests - 3 new Go tests in `cmd/server/client_rx_app_url_test.go`: URL validation over 15 inputs, the endpoint field in 6 config states, the startup warning. Full `go test ./cmd/server` passes. - `tests/unit/test-rx-coverage-app-qr.js` (real `rx-coverage.js` and `qrcode.js` in a vm): panel present and absent, QR content, HTML escaping, subtitle link in both cases, old names gone. Added to `test-all.sh`. All 6 `tests/unit/test-rx-coverage-*.js` pass. ## Not done - No E2E test. - Browser-checked on a local server with and without `appUrl` in the light theme only. The QR keeps black modules on white in both themes, unlike the node QR, which is inverted in dark mode; dark mode itself was not checked in a browser. - `cmd/ingestor` is unchanged; it does not need the URL. - The same change runs on analyzer.on8ar.eu (a fork build) since 2026-11-10.
54 lines
3.5 KiB
CSS
54 lines
3.5 KiB
CSS
/* Client-RX coverage styles (fork-only feature). Kept in a DEDICATED file —
|
||
separate from node-reach.css — so upstream's periodic node-reach.css rewrites
|
||
don't drop the coverage tier colours + leaderboard layout (as happened in the
|
||
v3.9.0 merge). Consumed by rx-coverage.js (standalone Coverage dashboard) and,
|
||
once re-grafted, the per-node Reach page coverage overlay. */
|
||
|
||
/* RX coverage hex layer (mobile client receptions) */
|
||
:root {
|
||
--nq-cov-strong: #2ecc71; /* SF8: SNR ≥ −5 dB (good margin) */
|
||
--nq-cov-mid: #e67e22; /* SF8: −9..−5 dB (near the limit) */
|
||
--nq-cov-weak: #e74c3c; /* SF8: < −9 dB (poor, packet loss likely) */
|
||
--nq-cov-grey: #95a5a6; /* heard, no SNR metric */
|
||
--nq-cov-gap: #57606a; /* hatch: driven through, nothing received */
|
||
}
|
||
/* Dark-theme variants: the saturated mid-luminance defaults glare on dark
|
||
basemaps. Mirrors the rest of the dashboard's theme-aware tokens (#polish). */
|
||
[data-theme="dark"] {
|
||
--nq-cov-strong: #3fb950;
|
||
--nq-cov-mid: #d29922;
|
||
--nq-cov-weak: #f85149;
|
||
--nq-cov-grey: #8b949e;
|
||
--nq-cov-gap: #c9d1d9;
|
||
}
|
||
.nq-cov-legend { display:flex; gap:12px; align-items:center; font-size:11px; color:var(--text-muted, #57606a); margin:4px 0 10px; }
|
||
/* Toggled by node-reach.js applyCoverage via class, not inline style, so CSS
|
||
(print rules, themes) can still override visibility (#19). */
|
||
.nq-cov-legend.is-hidden { display:none !important; }
|
||
.nq-cov-legend i { width:12px; height:12px; border-radius:2px; display:inline-block; margin-right:4px; vertical-align:middle; }
|
||
/* Same 45-degree hatch as the map's gap cells (rx-coverage.js ensureGapHatch). */
|
||
.nq-cov-legend i.nq-cov-gap-swatch { background:repeating-linear-gradient(45deg, var(--nq-cov-gap) 0 1.5px, transparent 1.5px 4px); outline:1px solid var(--nq-cov-gap); outline-offset:-1px; }
|
||
|
||
/* Mobile RX coverage hub — leaderboard */
|
||
.rxb { display:flex; flex-direction:column; gap:3px; }
|
||
.rxb-row { display:flex; align-items:center; gap:10px; padding:7px 10px; background:var(--section-bg, #f6f8fa); border:1px solid var(--border, #d0d7de); border-radius:6px; font-size:13px; cursor:pointer; }
|
||
.rxb-row.rxb-head { font-size:10px; text-transform:uppercase; color:var(--text-muted, #57606a); cursor:default; }
|
||
.rxb-row.sel { outline:2px solid var(--accent, #2ecc71); }
|
||
/* Visible keyboard focus for the now-focusable (#polish) leaderboard rows. */
|
||
.rxb-row[data-rx]:focus-visible { outline:2px solid var(--link, #0969da); outline-offset:1px; }
|
||
.rxb-rank { width:24px; text-align:right; color:var(--text-muted, #57606a); }
|
||
.rxb-name { flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
|
||
.rxb-rec, .rxb-nodes, .rxb-cells, .rxb-score { width:56px; text-align:right; font-variant-numeric:tabular-nums; }
|
||
/* Sortable column headers in the leaderboard head row. */
|
||
.rxb-head .rxb-sort { cursor:pointer; user-select:none; }
|
||
.rxb-head .rxb-sort:hover { color:var(--link, #0969da); }
|
||
.rxb-head .rxb-sort:focus-visible { outline:2px solid var(--link, #0969da); outline-offset:1px; }
|
||
|
||
/* CoreDrive RX app link on #/rx-coverage (clientRxCoverage.appUrl). The QR
|
||
keeps the vendor's dark-on-white modules in both themes so it scans. */
|
||
.rx-app { display:flex; align-items:center; gap:12px; margin:8px 0; padding:8px 10px; background:var(--card-bg); border:1px solid var(--border); border-radius:6px; font-size:13px; color:var(--text); }
|
||
.rx-app-qr { flex:0 0 auto; line-height:0; }
|
||
.rx-app-qr svg { width:96px; height:96px; display:block; border-radius:4px; }
|
||
.rx-app-text { min-width:0; }
|
||
.rx-app-url { overflow-wrap:anywhere; }
|