From 730ba6e14def3f7fbe2f5545c956823c14ad6163 Mon Sep 17 00:00:00 2001 From: firestar5683 <168790843+firestar5683@users.noreply.github.com> Date: Sun, 16 Aug 2026 11:29:41 -0500 Subject: [PATCH] sentry things --- .../assets/components/tools/sentry.js | 64 +++++++++++++++++++ starpilot/system/the_galaxy/the_galaxy.py | 50 +++++++++++++++ system/camerad/snapshot.py | 4 +- 3 files changed, 116 insertions(+), 2 deletions(-) diff --git a/starpilot/system/the_galaxy/assets/components/tools/sentry.js b/starpilot/system/the_galaxy/assets/components/tools/sentry.js index 6ac87c0df..91f73a770 100644 --- a/starpilot/system/the_galaxy/assets/components/tools/sentry.js +++ b/starpilot/system/the_galaxy/assets/components/tools/sentry.js @@ -11,7 +11,9 @@ const state = reactive({ params: {}, status: {}, event: {}, + liveCapture: {}, testBusy: false, + liveBusy: false, pushBusy: false, }) @@ -87,6 +89,36 @@ async function sendTestEvent() { } } +async function readJsonResponse(response) { + const body = await response.text() + if (!body) return {} + + try { + return JSON.parse(body) + } catch { + throw new Error(`Galaxy returned an unexpected ${response.status} response. Check the device connection or Galaxy tunnel.`) + } +} + +async function viewLive() { + if (state.liveBusy) return + state.liveBusy = true + try { + const response = await fetch(galaxyPath("/api/sentry/live"), { cache: "no-store" }) + const payload = await readJsonResponse(response) + if (!response.ok) { + showSnackbar(payload.error || "Live camera capture failed.") + return + } + state.liveCapture = payload + showSnackbar("Live camera snapshot captured.") + } catch (error) { + showSnackbar(error.message || "Network error — is the device reachable?") + } finally { + state.liveBusy = false + } +} + async function enablePush() { if (state.pushBusy) return state.pushBusy = true @@ -135,6 +167,24 @@ function renderEvent() { ` } +function renderLiveCapture() { + const capture = state.liveCapture || {} + const imageUrls = Array.isArray(capture.imageUrls) ? capture.imageUrls : [] + if (imageUrls.length === 0) return html`
No live snapshot captured yet.
` + + const cacheKey = encodeURIComponent(capture.capturedAt || "") + return html` +Captured ${capture.capturedAt || "just now"}.
+Enable notifications once, then use the test push to verify Galaxy can reach this browser even when the page is not active.
+iPhone users: add Galaxy to your Home Screen as a web app before enabling notifications. iOS web push requires the Home Screen web app.
`} +Capture one still from both cameras while parked.
+