forked from c-fu/arah2
fix(03-04): on-screen diagnostic probe — WA version/platform, initData char-count, session + location categories
This commit is contained in:
@@ -28,6 +28,7 @@ import { createPositionMarker } from "./map/marker.ts";
|
||||
import { createFollowController } from "./map/follow.ts";
|
||||
import { createStatusStrip } from "./ui/strip.ts";
|
||||
import { buildBootCard, buildDeniedCard, buildSignalLostCard, startGantry, stopGantry } from "./ui/cards.ts";
|
||||
import { createProbe } from "./ui/probe.ts";
|
||||
import { createRecenterControl } from "./ui/recenter.ts";
|
||||
import { getWebApp } from "./telegram/webapp.ts";
|
||||
import { watchTheme } from "./telegram/theme.ts";
|
||||
@@ -97,6 +98,11 @@ async function boot(): Promise<void> {
|
||||
if (lastFix !== null && map !== null) follow?.follow(lastFix);
|
||||
});
|
||||
|
||||
// DEBUG-ROUND probe: category-only on-screen telemetry for the device
|
||||
// matrix (webview has no dev-tools); removed at the exit.
|
||||
const probe = createProbe(mainEl);
|
||||
probe.set({ wa: wa ? `${wa.version ?? "?"}/${wa.platform ?? "?"}` : "none", initDataChars: wa ? wa.initData.length : null });
|
||||
|
||||
// Cards are built once at boot (boot-time locale) and reused across re-runs.
|
||||
const bootCard1 = buildBootCard(locale, 1);
|
||||
const bootCard2 = buildBootCard(locale, 2);
|
||||
@@ -182,6 +188,7 @@ async function boot(): Promise<void> {
|
||||
}
|
||||
|
||||
function renderState(state: LocationState): void {
|
||||
probe.set({ location: state.kind });
|
||||
const ageSec = lastFix !== null ? fixAgeSeconds(lastFix, Date.now()) : null;
|
||||
const accuracyM = lastFix !== null ? lastFix.accuracyM : null;
|
||||
strip.render(state, ageSec, accuracyM);
|
||||
@@ -233,6 +240,7 @@ async function boot(): Promise<void> {
|
||||
async function runFromSession(): Promise<void> {
|
||||
renderState({ kind: "validating" });
|
||||
const session = await createSession(wa?.initData ?? "");
|
||||
probe.set({ session: session.ok ? "ok" : session.reason, initDataChars: wa ? wa.initData.length : null });
|
||||
if (!session.ok) {
|
||||
staleHandled = false; // session-first failure is boot-level, not a stale-fix recovery
|
||||
renderDenied();
|
||||
|
||||
Reference in New Issue
Block a user