diff --git a/.env.example b/.env.example index 730ff0f..7fedc05 100644 --- a/.env.example +++ b/.env.example @@ -10,7 +10,8 @@ DB_PASSWORD=change_me_strong_password # JWT signing secret — generate with: openssl rand -hex 32 JWT_SECRET=change_me_jwt_secret -# Global admin account seeded on every API boot. +# Global admin account seeded/updated on every API boot, so changing +# ADMIN_PASSWORD here and restarting the API updates the existing login. # ADMIN_EMAIL defaults to admin@trackstack.local when omitted. ADMIN_EMAIL=admin@trackstack.local ADMIN_PASSWORD=change_me_admin_password diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 542b6b5..c793794 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,6 +30,13 @@ jobs: - run: go vet ./... - run: go test ./... + docs: + name: Docs version check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + - run: python3 scripts/check_docs.py + frontend: name: Frontend runs-on: ubuntu-latest diff --git a/.gitignore b/.gitignore index 353669d..acc2a21 100644 --- a/.gitignore +++ b/.gitignore @@ -23,9 +23,15 @@ pgdata/ # OS .DS_Store Thumbs.db +*.log +*.hprof -# IDE +# IDE / local tooling .idea/ +.gradle/ +frontend/.vite/ +frontend/coverage/ +android/.kotlin/ # Android / Gradle build artifacts android/build/ diff --git a/AUDIT_LOG.md b/AUDIT_LOG.md new file mode 100644 index 0000000..823a00c --- /dev/null +++ b/AUDIT_LOG.md @@ -0,0 +1,309 @@ +# TrackStack — Full Repository Audit + +**Date:** 2026-11-13 +**Branch:** `chore/full-audit` (base commit `79a1e70` on `main`) +**Auditor:** automated coding-agent audit +**Scope:** documentation vs. code, builds/tests, Docker deployment, API ↔ dashboard ↔ Android consistency, security and repository hygiene. + +**Outcome:** every runnable check passes. Documentation was corrected to match the +code, the Android branding was fixed, a development-only dashboard URL bug was +fixed, and repository hygiene files were added. **No API behaviour, database +schema, or existing migration was changed.** Unresolved items are listed with +severity at the end. + +--- + +## 1. Ground rules and assumptions + +- Work was done only on `chore/full-audit`; `main` was not modified or force-pushed. +- The real `.env` was **never read, printed, edited, or committed**. The Docker + test used a throwaway env file at `/tmp/opencode/audit.env` with dummy values, + an isolated Compose project (`trackstack-audit`), and alternate host ports + (`18080`, `15433`, `15023`). The user's running stack was left untouched. +- No files were deleted. The two stale root docs were moved to `docs/`. +- Code is treated as the source of truth wherever it disagrees with prose. +- Temporary test scripts live outside the repo (`/tmp/opencode/`). The isolated + audit containers, images, and volumes were removed afterwards; the user's + volumes were not touched. +- `docs/Android-Java-Migration.docx` is a binary document and was not + re-authored; only its existence and references were checked. + +--- + +## 2. Claim verification (docs vs. code) + +| # | Claim in docs | Document location | Actual value in code/config | Fixed? | +|---|---|---|---|---| +| 1 | Android client is Kotlin + Jetpack Compose | `README.md` intro, Kotlin badge, stack table, repo layout | **Java 17 + XML layouts**; sources in `android/app/src/main/java`, layouts in `res/layout`; no Kotlin source or Compose dependency | **Yes** — README rewritten | +| 2 | App is named “TrackProj” | `AndroidManifest.xml` literal label, `strings.xml`, tracking notification | Product/repo is **TrackStack** | **Yes** — label now `@string/app_name`; strings and notification title say TrackStack | +| 3 | Live map renders OpenStreetMap tiles | `README.md` feature list, `frontend/README.md` | Leaflet map with **keyless Esri** basemaps (`frontend/src/mapTiles.js`) | **Yes** — docs now say Esri | +| 4 | Activity log records “tracking and device activity” | `README.md` feature list | Only `geofence.created`, `geofence.deleted`, and `notifications.updated` call `logActivity`; no position/tracking rows | **Yes** — wording narrowed | +| 5 | Go 1.22 | Badge + stack table | `go 1.22.2` in both `backend/*/go.mod` | Correct (kept) | +| 6 | React 19 | Badge + stack table | `react`/`react-dom` `^19.2.7` | Correct | +| 7 | Vite 8 | Stack table | `vite` `^8.1.1`; after lockfile audit fix the installed build is 8.3.8 | Correct | +| 8 | PostgreSQL 16 + PostGIS 3.4 | Stack table + architecture diagram | `postgis/postgis:16-3.4-alpine` | Correct | +| 9 | Node.js 22 | Requirements + badge | CI `node-version: 22`; `Dockerfile.caddy` `FROM node:22` | Correct | +| 10 | Java 17, `minSdk` 26, compile/target SDK 34 | Local Android section (now explicit) | `android/app/build.gradle.kts`: Java 17, minSdk 26, compileSdk/targetSdk 34 | Correct (detail added) | +| 11 | Caddy runs on `:8080` | Architecture diagram | Caddy listens on container `:80`; Compose publishes host `8080:80` | **Yes** — diagram corrected | +| 12 | `npm install` | README, `frontend/README.md` | Lockfile is tracked and CI uses `npm ci` | **Yes** — docs use `npm ci` | +| 13 | Repository layout | README layout block | Missing `docs/`, `scripts/`, `Dockerfile.caddy`; listed root-level doc paths that moved | **Yes** | +| 14 | Design notes live at repo root | README design-notes section | Moved to `docs/read_me.md` and `docs/session_log_android_bootstrap.md` | **Yes** — links updated | +| 15 | Migration step applies only `0004` | Applying-migrations section | Four migrations exist; `0001`/`0002` are **not** idempotent, so order and “already applied” matter | **Yes** — clarified | +| 16 | CI runs “on every push” | Status section | `push` only on `main`, plus `pull_request` and `workflow_dispatch` | **Yes** — wording corrected | +| 17 | `VITE_API_URL` targets all API traffic | `frontend/README.md` | WebSocket and refresh call hardcoded the page host / `/v1`; Vite dev server has no proxy, so dev live map and token refresh broke when `VITE_API_URL` pointed at another host | **Yes** — code fixed | +| 18 | Admin credentials are seeded once | `.env.example` comment | API upserts the admin on every boot, so rotating `ADMIN_PASSWORD` and restarting updates the login | **Yes** — comment clarified | +| 19 | Documented environment variables | README table vs. Compose + Go | All match: required `DB_PASSWORD`, `JWT_SECRET`, `ADMIN_PASSWORD`; optional `ADMIN_EMAIL`, `DB_PORT`, `GATEWAY_SECRET`, `GT06_PORT`, `TRIP_WORKER_INTERVAL`, `SMTP_*`, `VAPID_*` | Correct | +| 20 | API route overview | README “API overview” vs. `handlers/router.go` | Public, device-token, gateway, JWT, and admin groups all match, including `/v1/live` and `/v1/devices/{id}/revoke-token` | Correct | +| 21 | Host ports | README vs. Compose | Host `8080` → Caddy `80`; host `5433` → Postgres `5432`; host `5023` → GT06 `5023`; API `8080` and gateway `8081` remain internal | Correct after diagram fix | +| 22 | CI action versions | `.github/workflows/ci.yml` | Tags checked against GitHub releases: checkout `v7.0.1`, setup-go `v7.0.0`, setup-node `v7.1.0`, setup-java `v6.2.0`, setup-android `v4.0.4`, upload-artifact `v7.0.2` | Verified | +| 23 | No secrets are committed | Repository | Only `.env.example` is tracked. No private keys, tokens, or real passwords found. `README.md` contains only the literal local example `ADMIN_PASSWORD='dev-password'` | Verified | +| 24 | Dependency audit is clean | `frontend/package-lock.json` | Remaining: **2 moderate** `react-router` advisories. Fixing requires `react-router-dom` v7 (breaking), so it was not applied | Partially fixed | + +--- + +## 3. Build, test, and runtime verification + +All commands below were run from a clean dependency state where applicable. + +| Check | Command | Result | +|---|---|---| +| API service build | `cd backend/api-service && go build ./...` | **Pass** | +| API service vet | `go vet ./...` | **Pass** | +| API service tests | `go test ./...` | **Pass** — `internal/notify`, `internal/trips`; other packages have no tests | +| Gateway build | `cd backend/protocol-gateway && go build ./...` | **Pass** | +| Gateway vet | `go vet ./...` | **Pass** | +| Gateway tests | `go test ./...` | **Pass** — `internal/protocols/gt06`; other packages have no tests | +| Go modules tidy | `go mod tidy` in both modules | **No changes** — dependencies are tidy | +| Frontend install | `cd frontend && npm ci` | **Pass** | +| Frontend lint | `npm run lint` | **Pass** — 5 warnings, 0 errors | +| Frontend production build | `npm run build` | **Pass** — JS bundle 503.68 kB (chunk-size warning only) | +| Android debug build | `cd android && JAVA_HOME= ./gradlew assembleDebug` | **BUILD SUCCESSFUL** | +| Compose validation | `docker compose --env-file /tmp/opencode/audit.env config` | **Valid** | +| Docs/version check | `python3 scripts/check_docs.py` | **Pass** | +| Dependency audit | `npm audit` | **2 moderate** (`react-router`), no high/critical after lockfile fix | + +### Isolated Docker smoke test + +Run with the real Compose file copied to `/tmp/opencode/audit-compose.yml`, +alternate host ports, and dummy credentials. **50/50 checks passed**, covering: + +- `/healthz` returns `ok`; Caddy serves the SPA `index.html`. +- Admin login (200) and wrong password (401); org creation (201) and org login. +- Role isolation: org user gets 403 on `/v1/orgs` (GET and POST). +- Device enrollment (201), `dtk_` token format, admin device→org assignment (204). +- Position ingest: no token 401, bogus token 401, valid device token 201; tracking-state 204/401. +- Org-scoped reads: positions, device list, trips, activity, geofences. +- Geofence create/list/events/delete; invalid notification channel returns 400. +- Hardware ingest: wrong gateway secret 401, unknown `external_id` 404, valid secret 201. +- HTTP/JSON adapter `/proto/http/positions`: gateway-secret mode 201, device-token mode 201, no auth 401. +- GT06 TCP: synthetic login frame acknowledged, synthetic location frame acknowledged, position stored. +- CORS preflight returns 204. +- Stored positions were visible from phone, gateway and GT06 paths. + +### Dashboard runtime check + +Playwright against the isolated stack (`http://127.0.0.1:18080`): + +- Admin login succeeded and `/admin/map` rendered. +- Leaflet map present (1366×710), **24/24 Esri tiles loaded**, **1 marker**. +- No console or page errors. +- 16 request failures were recorded during navigation with no visible or + functional impact (map tiles all completed). These were not individually + triaged — see *Unverified*. +- The user's own running stack (`trackstack-*`, API on `127.0.0.1:8080`) was not + restarted, read, or modified. + +--- + +## 4. Cross-client / API consistency + +- **Dashboard → API:** all `api.get/post/put/patch/delete` paths exist in the + router; auth header and refresh flow match `/v1/auth/*`; live socket uses + `/v1/live?token=…`. Request bodies for orgs, devices, geofences, and + notifications match the Go request structs. +- **Android → API:** `ApiClient` uses `/v1/enroll`, `/v1/positions`, and + `/v1/tracking-state` with the device token; the payload fields match the Go + `ingestRequest`. Enrollment handles the one-time `dtk_` token and stores it + locally. +- **Gateways → API:** GT06 and HTTP/JSON both forward to + `/v1/gateway/positions` (secret mode) or `/v1/positions` (device-token mode); + `external_id` resolution matches the `devices.external_id` column. +- **Ports/auth:** documented ports and auth scopes match Compose, Caddy, and the + router. `GATEWAY_SECRET` empty disables secret-mode ingest in both services + (API returns 503; the gateway rejects the secret branch). + +--- + +## 5. Security review and recommendations + +### High + +1. **Unauthenticated, unlimited device enrollment.** `POST /v1/enroll` is public + and has no rate limit or invite control. Anyone can create unbounded pending + device rows. Recommend per-IP rate limiting plus an enrollment code or + admin-approved flow. +2. **No rate limiting on login or ingest.** `/v1/auth/login`, + `/v1/enroll`, `/v1/gateway/positions`, and device `/v1/positions` have no + throttling. Add a per-IP limiter (application middleware or Caddy) to reduce + brute-force and resource-exhaustion risk. +3. **Permissive CORS.** The API returns `Access-Control-Allow-Origin: *`. + Bearer tokens are not cookies, so this is not classic CSRF, but any origin + can call the API and read responses when it has a token. Restrict to the + dashboard origin(s). +4. **JWT in the WebSocket query string.** Browsers cannot set headers on + `WebSocket`, so `/v1/live?token=…` is accepted. Query strings are commonly + logged by proxies and Caddy. Access tokens live 15 minutes; recommend a + short-lived one-time WS ticket or a cookie/subprotocol approach. +5. **No coordinate/range validation on ingest.** `/v1/positions` and + `/v1/gateway/positions` accept any `lat`/`lon`/`speed`/`heading` values and + zero `recorded_at`. Validate latitude ±90, longitude ±180, and plausible + speed/heading before writing to PostGIS; return 400 otherwise. +6. **Refresh tokens cannot be revoked.** Refresh JWTs are stateless with a + 30-day TTL and no `jti`/denylist or per-user token version. A stolen refresh + token remains valid until expiry. Consider a token-version column or a + revocation store. + +### Medium + +1. **Admin can reach org-scoped handlers with an empty org.** The global admin + has no `org_id`, but geofence/trip/notification/activity routes are not + wrapped in an org guard. Creating a geofence as admin fails with a foreign-key + error (`500`); other reads return empty data. Add a `RequireOrg` middleware or + return an explicit `403` for admin on those routes. +2. **Invalid GeoJSON surfaces as `500`.** PostGIS errors from + `ST_GeomFromGeoJSON` are returned as internal errors. Validate the payload and + map malformed geometry to `400`. The same applies to malformed UUID path + parameters in some handlers. +3. **Changing `ADMIN_EMAIL` adds an admin instead of renaming one.** `seedAdmin` + upserts by email, so a new address creates a second admin and leaves the old + account active. Document this or implement an explicit rename/removal step. +4. **Weak fallback JWT secret in direct runs.** The API defaults `JWT_SECRET` to + `change-me-in-production` when run outside Compose. Compose requires it, but a + direct `go run` does not. Fail fast when it is unset outside development. +5. **Plain HTTP by default.** `Caddyfile` listens on `:80` with no TLS/HSTS. + Credentials and bearer tokens travel in clear text unless the operator puts a + TLS terminator in front. Document HTTPS setup and add HSTS when TLS is enabled. +6. **Android transport and token storage.** The manifest sets + `android:usesCleartextTraffic="true"` and `allowBackup="true"`; the device + token is stored in plain `SharedPreferences`. Fine for emulator/dev, but for + production use HTTPS, disable cleartext, and consider encrypted preferences. + +### Low / informational + +- No Content-Security-Policy header; Caddy sets `X-Content-Type-Options`, + `X-Frame-Options`, and `Referrer-Policy` only. +- No request-ID / structured access logs beyond Chi's default logger. +- Enrollment returns the device token in the response body by design; ensure + proxies do not log bodies. + +### Dead code / unused packages + +Confirmed unused (no references outside their own package): + +- `backend/protocol-gateway/internal/protocols/phone/adapter.go` +- `backend/protocol-gateway/internal/event/event.go` +- `backend/api-service/internal/models/models.go` + +These build cleanly but are not wired into either service. Removing them would +reduce confusion; they were left untouched because they are not harmful and the +audit avoided behavioural cleanup. + +### Dependency advisories + +- `npm audit` after the non-breaking lockfile update: **2 moderate** + `react-router` advisories. The fix requires `react-router-dom` v7, a breaking + major upgrade; not applied. Dashboard routing was verified on v6. +- Previously reported high-severity `vite`, `source-map-js`, and + `follow-redirects` advisories were resolved by `npm audit fix` (lockfile + only; `package.json` ranges unchanged). + +### TODO / FIXME / hardcoded secrets + +- No `TODO`, `FIXME`, `XXX`, or `HACK` markers in Go, JS/JSX, Java, XML, YAML, + or Markdown. +- No hardcoded real credentials or API keys. The only URLs are the documented + emulator host `10.0.2.2`, localhost development defaults, and public tile/CI + URLs. +- `.env.example` contains placeholder values only. + +--- + +## 6. Changes made + +1. **Documentation corrected to match the code** + - `README.md`: Java + XML Android client, Android/Node badges, Esri basemaps, + accurate activity-log scope, Caddy `:80`/host `:8080` diagram, stack table, + repository layout, local requirements, `npm ci`, migration order and + idempotency, `docs/` links, CI scope wording. + - `frontend/README.md`: Esri basemaps, `npm ci`, `VITE_API_URL` now covers the + live WebSocket and refresh call, `mapTiles.js` wording. + - `docs/read_me.md` and `docs/session_log_android_bootstrap.md`: moved from + the repository root and given historical-context notes; content preserved. + - `.env.example`: clarified that the admin is upserted on every boot. + +2. **Dashboard development fix** + - `frontend/src/useSocket.js`: derives the WebSocket URL from + `VITE_API_URL` (not the page host), and stops reconnecting after unmount. + - `frontend/src/api.js`: token refresh uses the same base URL as the API + client. + +3. **Android branding fix** + - Manifest uses `@string/app_name`; `app_name` and permission strings are + “TrackStack”; the foreground notification title is “TrackStack” (was + “TrackProj”). + +4. **Repository hygiene** + - Added `LICENSE` (MIT, “TrackStack contributors” — chosen because no license + existed; confirm the desired license before publishing). + - Added `CONTRIBUTING.md` with build/test commands and a documentation + checklist. + - Added `scripts/check_docs.py` and a CI `docs` job that verifies the README’s + Go/React/Vite/Postgres/PostGIS/Node versions against `go.mod`, + `frontend/package.json`, `docker-compose.yml`, CI, and `Dockerfile.caddy`. + - Expanded `.gitignore` (`.gradle/`, `frontend/.vite/`, + `frontend/coverage/`, `android/.kotlin/`, `*.log`, `*.hprof`). + - Applied non-breaking `npm audit fix` (lockfile only). + +No API handler, request/response shape, database schema, or existing migration +was modified. + +--- + +## 7. Unverified / not run + +- **GitHub Actions was not executed on GitHub.** Workflow YAML was reviewed and + every action tag was confirmed to exist, but the jobs themselves were not run + in this environment. +- **Android on a physical device.** Only `assembleDebug` and the existing + emulator were exercised; background location, notification permission flows, + and battery-optimisation prompts were not re-tested on hardware. +- **Email and Web Push delivery.** No SMTP server or VAPID keys were configured; + dashboard settings and API validation were tested, actual delivery was not. +- **Real GT06 hardware.** The TCP adapter was tested with synthetic login and + location frames, not a physical tracker. +- **Playwright request failures.** 16 failed network requests were recorded + during dashboard navigation while all map tiles completed and no console + errors occurred. They were not individually triaged. +- **`docs/Android-Java-Migration.docx`.** The binary document was not reviewed + in detail; only its presence and references were checked. +- **Router v7 upgrade.** Not attempted because it is a breaking major upgrade. +- **Test coverage.** Only `internal/notify`, `internal/trips`, and the GT06 + adapter have Go tests; handlers, auth, WebSocket, and the gateway forwarder do + not. No frontend unit/e2e suite existed before this audit; the added check is + runtime Playwright/manual only. +- **Branch protection / merge settings.** Not inspected or changed. + +--- + +## 8. Suggested GitHub metadata (manual) + +Repository description: + +> Self-hosted fleet & GPS tracking: Go API, React dashboard, Java/XML Android +> app, PostGIS, Caddy, Docker Compose. + +Topics: `go`, `react`, `vite`, `leaflet`, `postgis`, `postgresql`, +`docker-compose`, `self-hosted`, `gps-tracking`, `fleet-management`, `android`, +`java`, `xml-layouts`, `osmdroid`, `gt06`, `rest-api`, `websocket`. + +Remove topics `kotlin` and `jetpack-compose`, which no longer describe the app. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..43362db --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,85 @@ +# Contributing to TrackStack + +Thanks for helping improve TrackStack. This file describes the checks to run +and the documentation to update before opening a pull request. + +## Before you start + +- Do not commit `.env` or any real secret. Copy `.env.example` to `.env` for + local runs and keep it untracked. +- Use a feature branch and open a pull request against `main`. +- Keep API behaviour, database schema, and existing migrations stable unless + the change is intentional and documented. + +## Build and test + +Run the checks that match what you changed. CI runs the same commands. + +### Backend (Go 1.22) + +```bash +cd backend/api-service +go build ./... && go vet ./... && go test ./... + +cd ../protocol-gateway +go build ./... && go vet ./... && go test ./... +``` + +### Dashboard (Node.js 22) + +```bash +cd frontend +npm ci +npm run lint +npm run build +``` + +### Android (JDK 17, Android SDK 34) + +```bash +cd android +./gradlew assembleDebug +``` + +### Docker + +```bash +cp .env.example .env # fill in throwaway values for a local test +docker compose config +docker compose up --build +curl -fsS http://localhost:8080/healthz +docker compose down # never use -v on a volume with data you need +``` + +## Documentation checklist + +Update the docs in the same pull request as the code: + +- [ ] **README.md** — if a version, service, port, endpoint, environment + variable, repo layout entry, or roadmap item changed. Keep the version + badges and the stack table in sync with `go.mod`, `frontend/package.json`, + and `docker-compose.yml` (CI runs `scripts/check_docs.py`). +- [ ] **README.md API overview** — when adding, removing, or renaming a route + in `backend/api-service/internal/handlers/router.go`. +- [ ] **`.env.example`** — when the API, gateway, or Compose file reads a new + environment variable. Document safe defaults and never put real secrets in it. +- [ ] **`frontend/README.md`** — when dashboard scripts, dependencies, or the + map implementation change. +- [ ] **Migrations** — do not edit an applied migration; add the next numbered + file instead (`0005_...sql`) and note it in the README's migration section. +- [ ] **Roadmap** — tick an item only when the feature is implemented and + covered by CI or a documented manual check. + +## Commit style + +Use short, imperative commit messages with an optional scope, for example: + +``` +fix(api): authorize trips through device_orgs +docs(readme): describe the Java + XML Android client +``` + +## Reporting issues + +Include the command you ran, the expected and actual result, and the relevant +logs. Redact tokens, passwords, `.env` contents, and device identifiers. diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..bb4884b --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 TrackStack contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index 16468b6..92c6ada 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,12 @@ # TrackStack -**Self-hosted fleet & GPS tracking platform.** A Go API, a React + Leaflet dashboard, a Kotlin Android client, and PostGIS storage — packaged so you can run the whole stack on your own server. +**Self-hosted fleet & GPS tracking platform.** A Go API, a React + Leaflet dashboard, a Java Android client (XML layouts), and PostGIS storage — packaged so you can run the whole stack on your own server.

Go React - Kotlin + Android + Node PostgreSQL Docker CI @@ -17,7 +18,7 @@ ## What it does -- **Live map** — positions stream over WebSocket and render on an OpenStreetMap/Leaflet map. +- **Live map** — positions stream over WebSocket and render on a Leaflet map with keyless Esri basemaps. - **Multi-tenant organizations** — a global admin creates organizations and assigns devices; org users only see their own fleet. - **Device enrollment** — a freshly installed Android client self-enrolls and waits in a pending state until an admin assigns it. - **Two auth models** — short-lived JWTs with refresh for dashboard users, long-lived revocable tokens for devices. @@ -25,7 +26,7 @@ - **Speed events & trips** — speed violations are recorded, and trips are segmented automatically from position history. - **Notifications** — alerts reach the dashboard over WebSocket and can also be delivered by email or browser push. - **Hardware trackers** — GT06/Concox TCP and HTTP/JSON trackers feed the same ingest pipeline through the protocol gateway. -- **Activity log** — an audit trail of tracking and device activity. +- **Activity log** — an audit trail of dashboard actions (currently geofence and notification changes). - **Android tracking** — a foreground location service keeps reporting while the app is backgrounded, with an osmdroid map and tracking on/off control. --- @@ -34,10 +35,10 @@ ```mermaid flowchart LR - Phone["Android client
Kotlin + Compose"] -->|"device token
POST /v1/positions"| API + Phone["Android client
Java + XML"] -->|"device token
POST /v1/positions"| Caddy Browser["React dashboard
Vite + Leaflet"] -->|"JWT + WebSocket"| Caddy Tracker["GT06 / HTTP tracker"] -->|"TCP :5023 or /proto/*"| GW - Caddy["Caddy :8080"] --> API["Go API
Chi + JWT"] + Caddy["Caddy :80
(host :8080)"] --> API["Go API
Chi + JWT"] Caddy -->|"/proto/*"| GW["Protocol gateway"] GW -->|"X-Gateway-Secret"| API API --> DB[("PostgreSQL 16
+ PostGIS 3.4")] @@ -50,15 +51,15 @@ flowchart LR | **API** | Go 1.22, Chi router, `golang-jwt`, Gorilla WebSocket, `lib/pq` | | **Gateway** | Separate Go service: GT06/Concox TCP adapter, HTTP/JSON adapter, shared secret to the API | | **Database** | PostgreSQL 16 + PostGIS 3.4, SQL migrations mounted at container init | -| **Web** | React 19, Vite 8, React Router, TanStack Query, Axios, Leaflet + react-leaflet | -| **Android** | Kotlin, Jetpack Compose, foreground location service, osmdroid, OkHttp | +| **Web** | React 19, Vite 8, React Router, TanStack Query, Axios, Leaflet + react-leaflet (keyless Esri basemaps) | +| **Android** | Java 17 + XML layouts (Material 3), foreground location service, osmdroid, OkHttp; `minSdk` 26, compile/target SDK 34 | | **Deployment** | Docker Compose, Caddy serving the built frontend and reverse-proxying the API | --- ## Quick start (Docker) -**Requirements:** Docker with Compose v2. +**Requirements:** Docker with Compose v2. For local (non-Docker) development you also need Go 1.22+, Node.js 22+, and JDK 17 with Android SDK 34. ```bash git clone https://github.com/AYMANOULHOUF/trackstack.git @@ -124,7 +125,7 @@ Apply `backend/migrations/*.sql` to a PostGIS-enabled database before starting t ```bash cd frontend -npm install +npm ci VITE_API_URL=http://localhost:8080/v1 npm run dev ``` @@ -132,6 +133,8 @@ The Vite dev server runs on `http://localhost:5173`; set `VITE_API_URL` so API c ### Android +The client is plain **Java + XML layouts** (no Kotlin source). Build it with JDK 17 and Android SDK platform 34 / build-tools 34.0.0 via the Gradle 8.7 wrapper. + Open `android/` in Android Studio and build. The app defaults to `http://10.0.2.2:8080`, which reaches the host machine from the Android emulator. For a physical device, point it at your machine's LAN address: ```bash @@ -163,9 +166,15 @@ backend/ protocol-gateway/ Go service for hardware protocol adapters migrations/ PostgreSQL/PostGIS schema frontend/ React 19 + Vite dashboard -android/ Kotlin + Jetpack Compose tracking client +android/ Java + XML tracking client (Gradle 8.7, AGP 8.5) +docs/ Historical design/session notes and the Java migration note +scripts/ Repository checks (docs/version consistency) docker-compose.yml db, api-service, protocol-gateway, caddy +Dockerfile.caddy multi-stage build for the static dashboard image Caddyfile static frontend + API/gateway reverse proxy +CONTRIBUTING.md Build/test commands and documentation checklist +AUDIT_LOG.md Latest full repository audit and unresolved findings +LICENSE MIT license ``` --- @@ -219,12 +228,18 @@ delays tracking. ## Applying migrations to an existing database Docker's init directory only runs on a fresh volume. If you already have a -`pgdata` volume from an earlier version, apply new migrations manually: +`pgdata` volume from an earlier version, apply the migrations your volume has +not seen yet, in filename order. For example, the latest one: ```bash docker compose exec -T db psql -U trackproj -d trackproj < backend/migrations/0004_trips_notifications_gateway.sql ``` +The files are `0001_init.sql`, `0002_admin_multiorg.sql`, +`0003_tracking_state.sql`, and `0004_trips_notifications_gateway.sql`. Do not +replay migrations that are already applied: `0001` and `0002` are not +idempotent. + --- ## Roadmap @@ -239,8 +254,8 @@ docker compose exec -T db psql -U trackproj -d trackproj < backend/migrations/00 ## Design notes -The decisions behind the architecture — auth model, background-tracking constraints, datastore choice, transport, and deployment — are documented in [`read_me.md`](read_me.md). The Android bootstrap is covered in [`session_log_android_bootstrap.md`](session_log_android_bootstrap.md). +The decisions behind the architecture — auth model, background-tracking constraints, datastore choice, transport, and deployment — are documented in the historical [`docs/read_me.md`](docs/read_me.md). The Android bootstrap session is in [`docs/session_log_android_bootstrap.md`](docs/session_log_android_bootstrap.md), and the Kotlin → Java/XML rewrite is described in [`docs/Android-Java-Migration.docx`](docs/Android-Java-Migration.docx). Both markdown logs predate later changes, so treat this README and the code as current. ## Status -TrackStack is under active development. The API, dashboard, and Android client are functional; the roadmap above tracks what is still in progress. CI builds and tests both Go services, lints and builds the dashboard, assembles the Android debug APK, builds the Docker images, and smoke-tests the full Compose stack on every push. +TrackStack is under active development. The API, dashboard, and Android client are functional; the roadmap above tracks what is still in progress. CI builds and tests both Go services, lints and builds the dashboard, assembles the Android debug APK, builds the Docker images, and smoke-tests the full Compose stack on pushes to `main` and on pull requests. diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 9406c0c..ee5e84e 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -13,7 +13,7 @@ diff --git a/android/app/src/main/java/com/trackproj/app/tracking/LocationTrackingService.java b/android/app/src/main/java/com/trackproj/app/tracking/LocationTrackingService.java index b86f1a1..d0b261f 100644 --- a/android/app/src/main/java/com/trackproj/app/tracking/LocationTrackingService.java +++ b/android/app/src/main/java/com/trackproj/app/tracking/LocationTrackingService.java @@ -180,7 +180,7 @@ private void reportTrackingState(boolean active) { private void startForegroundWithNotification() { Notification notification = new NotificationCompat.Builder(this, CHANNEL_ID) - .setContentTitle("TrackProj is tracking") + .setContentTitle("TrackStack is tracking") .setContentText("Sharing your location with the dashboard") .setSmallIcon(R.drawable.ic_stat_track) .setOngoing(true) diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml index ad895ea..f5b5bb0 100644 --- a/android/app/src/main/res/values/strings.xml +++ b/android/app/src/main/res/values/strings.xml @@ -1,6 +1,6 @@ - TrackProj + TrackStack Toggle map theme Zoom in @@ -20,8 +20,8 @@ Retry Location access needed - TrackProj needs location access to track this device. Please allow it to continue. - Location permission is turned off. Open settings and allow location to use TrackProj. + TrackStack needs location access to track this device. Please allow it to continue. + Location permission is turned off. Open settings and allow location to use TrackStack. Grant permission Open settings diff --git a/read_me.md b/docs/read_me.md similarity index 98% rename from read_me.md rename to docs/read_me.md index 86cc621..bd7a75a 100644 --- a/read_me.md +++ b/docs/read_me.md @@ -1,5 +1,12 @@ # Project: Phone/GPS Tracking Platform — Decision Log +> **Historical design log.** This records decisions from the initial build and +> is not a description of the current code. Several details have changed since: +> the Android client is now **Java + XML layouts** (not Kotlin/Compose), the +> dashboard uses keyless **Esri** basemaps (not raw OSM tiles), and some pages +> listed below were later renamed or split. Treat the code and the root +> `README.md` as the source of truth; see `AUDIT_LOG.md` for the audit notes. + General-purpose, self-hostable location tracking platform. Usable by companies (fleet) and self-hosting individuals (own devices). Android app is visible (icon, normal permission prompts, persistent notification while tracking). Designed to later extend diff --git a/session_log_android_bootstrap.md b/docs/session_log_android_bootstrap.md similarity index 97% rename from session_log_android_bootstrap.md rename to docs/session_log_android_bootstrap.md index 59bb0e4..15948a3 100644 --- a/session_log_android_bootstrap.md +++ b/docs/session_log_android_bootstrap.md @@ -1,5 +1,10 @@ # Session Log — Backend Fixes, Deployment Debugging, and Android App Bootstrap +> **Historical session log.** This was written while the Android client was a +> Kotlin/Compose scaffold. It has since been rewritten in **Java + XML layouts** +> (see `docs/Android-Java-Migration.docx` and the current `android/` sources), so +> the Kotlin class/file names below no longer exist. Kept for project history. + Continuation of `read_me.md`. This session covered fixing the backend deployment, verifying the tracking pipeline end-to-end, and starting the Android app from scratch (scaffold → build toolchain → auth flow). diff --git a/frontend/README.md b/frontend/README.md index dd086cd..670b091 100644 --- a/frontend/README.md +++ b/frontend/README.md @@ -1,6 +1,6 @@ # TrackStack Dashboard -React 19 + Vite dashboard for [TrackStack](../README.md). It talks to the Go API over REST and a WebSocket, and renders device positions on a Leaflet/OpenStreetMap map. +React 19 + Vite dashboard for [TrackStack](../README.md). It talks to the Go API over REST and a WebSocket, and renders device positions on a Leaflet map with keyless Esri basemaps (no tile API key required). ## Stack @@ -13,11 +13,11 @@ React 19 + Vite dashboard for [TrackStack](../README.md). It talks to the Go API ## Run locally ```bash -npm install +npm ci VITE_API_URL=http://localhost:8080/v1 npm run dev ``` -The app starts on `http://localhost:5173`. `VITE_API_URL` must point at the API service; without it the app falls back to the relative `/v1` path. +The app starts on `http://localhost:5173`. `VITE_API_URL` must point at the API service; without it the app falls back to the relative `/v1` path. The live WebSocket and the token-refresh call both derive their URL from `VITE_API_URL`, so they follow the same target in development. ## Scripts @@ -36,7 +36,7 @@ src/ AuthContext.jsx Login state and token handling useDevices.js Device queries useSocket.js Live WebSocket connection - mapTiles.js Shared basemap definitions + mapTiles.js Shared keyless Esri basemap definitions pages/ Login, admin, and organization views components/ Shared UI and the Leaflet map component ``` diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 23f6583..40b4dbc 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -25,21 +25,21 @@ } }, "node_modules/@emnapi/core": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.11.1.tgz", - "integrity": "sha512-RSvbQmHzdKzNsLYa/wHrbc3KN4sYLKAdPZxqiM2HATqv/SBk2/ENSHpvXGaLOMcsAyz0poEGqkmmKYG3OWiJEQ==", + "version": "2.0.0-beta.2", + "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-2.0.0-beta.2.tgz", + "integrity": "sha512-MzCVoWtcg4Pm2B3je5mMvYMvj3MmBKw+fU7vbsJc9/iT8ip6/eYIHo/Dsm/mr+wsHB6SEyJDuxB09Yy6r/8+4A==", "dev": true, "license": "MIT", "optional": true, "dependencies": { - "@emnapi/wasi-threads": "1.2.2", + "@emnapi/wasi-threads": "2.2.0", "tslib": "^2.4.0" } }, "node_modules/@emnapi/runtime": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.11.1.tgz", - "integrity": "sha512-vgj7R3y3Wgx24IQaGPA/R6YFXLHVMOZ0uVEyIQPaWs+rd1AzfEMXlAC22FYwO1XkKR6NPsq7mUandH8oIRdZFw==", + "version": "2.0.0-beta.2", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-2.0.0-beta.2.tgz", + "integrity": "sha512-JcrSPzPvZuNZvJqPTF9Fw25LbOJ8avzFVlaf2grmH4Cku0oGP47tRgqPZadcfj3YoZMHkFVnCYFbQM8I+i5QEw==", "dev": true, "license": "MIT", "optional": true, @@ -48,9 +48,9 @@ } }, "node_modules/@emnapi/wasi-threads": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.2.tgz", - "integrity": "sha512-c95qOXkHdydNKhscBTebqEC1CVAZpyqOfVfBzQ1qgzyl3gfeldUjIggDbIZgDKsHLgnsM+igH7TJ/eAasaVuMA==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-2.2.0.tgz", + "integrity": "sha512-JP7OYH38Q7+pyTAe14raZHLQIK7BDKbdwji+Xi3pcd/6QkJYQH3SX4wu6EplGrGJWRepoNzedfm0G3B9Z4e9Rw==", "dev": true, "license": "MIT", "optional": true, @@ -59,32 +59,35 @@ } }, "node_modules/@napi-rs/wasm-runtime": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.1.6.tgz", - "integrity": "sha512-ZLv/JdUfkvOy9eCnnBaGfiO+XimbjebAeO+MRQqD/B+FR1tnRN0tpKSJHRbE8sFfS6aqsXZ67TQjfwfsxULVbg==", + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.2.6.tgz", + "integrity": "sha512-mRyDmEw9/fCDXCGfL1sbgIw/GUK0PVxRW4YwgPN61F3LQ+fSyoBFarJVzgGyhF6kRzEQZ0FejDqm4WLXSeqQmw==", "dev": true, "license": "MIT", "optional": true, "dependencies": { "@tybys/wasm-util": "^0.10.3" }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=23.5.0" + }, "funding": { "type": "github", "url": "https://github.com/sponsors/Brooooooklyn" }, "peerDependencies": { - "@emnapi/core": "^1.7.1", - "@emnapi/runtime": "^1.7.1" + "@emnapi/core": "^1.7.1 || 2.0.0-beta.2", + "@emnapi/runtime": "^1.7.1 || 2.0.0-beta.2" } }, "node_modules/@oxc-project/types": { - "version": "0.137.0", - "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.137.0.tgz", - "integrity": "sha512-WT+Gb24i8hmvo85AIv2oEYouEXkRlKAlT9WaCa3TfLgNCN+GhrJOGZuIlMouAh38Qe4QOx26eUOVsq70qXrywA==", + "version": "0.156.0", + "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.156.0.tgz", + "integrity": "sha512-1Duyg48TdJNdyhEB8Xn1L36bT9Pv6GUtlKjHxOys8xkaF/rQq3XJE+bAurSK/AgIz5mGFsb77cn9Pb20+WCScw==", "dev": true, "license": "MIT", "funding": { - "url": "https://github.com/sponsors/Boshen" + "url": "https://github.com/sponsors/oxc-project" } }, "node_modules/@oxlint/binding-android-arm-eabi": { @@ -422,18 +425,35 @@ } }, "node_modules/@remix-run/router": { - "version": "1.23.3", - "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.23.3.tgz", - "integrity": "sha512-4An71tdz9X8+3sI4Qqqd2LWd9vS39J7sqd9EU4Scw7TJE/qB10Flv/UuqbPVgfQV9XoK8Np6jNquZitnZq5i+Q==", + "version": "1.23.4", + "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.23.4.tgz", + "integrity": "sha512-q7j5geK7xs3UJSdm9/iytUNclBnLmYx1EnSeCFXHPeutdqgIMeFeHtUZgS3EhlKxdBEAu8OwtJCwmLrEzpSs7Q==", "license": "MIT", "engines": { "node": ">=14.0.0" } }, + "node_modules/@rolldown/binding-android-arm-eabi": { + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm-eabi/-/binding-android-arm-eabi-1.2.19.tgz", + "integrity": "sha512-e+Ebe0WT+9tbXmNKPIiC8YrWAHYwug3m6i4p3rZGGulfZri1jtI4HslT+OZnFf/OIHowWF71DTlHwXBP2SiA7A==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, "node_modules/@rolldown/binding-android-arm64": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.1.3.tgz", - "integrity": "sha512-DT6Z3PhvioeHMvxo+xHc3KtqggrI7CCTXCmC2h/5zUlp5jVitv7XEy+9q5/7v8IolhlioawpMo8Kg0EEBy7J0g==", + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.2.19.tgz", + "integrity": "sha512-hOombrTJ+szt2ciEzS7oCA78lMPBgF5UMQWCJIyNfnrI7GLl8HYoFqCnpL2gcPOaXMqryGCU5ExdQKyDDcC+yA==", "cpu": [ "arm64" ], @@ -448,9 +468,9 @@ } }, "node_modules/@rolldown/binding-darwin-arm64": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.1.3.tgz", - "integrity": "sha512-0NwgwsjM7LrsuVnXMK3koTpagBNOhloc/BNjKqZjv4V5zI5r13qx69uVhRx+o5Z0yy4Hzq+lpy7TAgUG/ocvrw==", + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.2.19.tgz", + "integrity": "sha512-XoMA2pwCKGTQzUjPgtRwkedH4WmXhdIPKT6l6oOxd1PUbNodGI6DcBekgN7EC//+x3pfBYX/qL1gNmZAqivw5g==", "cpu": [ "arm64" ], @@ -465,9 +485,9 @@ } }, "node_modules/@rolldown/binding-darwin-x64": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.1.3.tgz", - "integrity": "sha512-YtiBp4disu6V560loT6PjMdiRaWmVvDNrUunAalbiFx2ggeJwxdAsgZMcoGP17uyAsTwAj5V1niksxlHnVQ1Sw==", + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.2.19.tgz", + "integrity": "sha512-zo8EsSSwMZCY/e+fRnGaX02YGgvJD0yvhNi/9hpGPA2MJ9ZF8dPCw75UGfpI6OpQ/myR/dIYmogRvqiZD0TrXg==", "cpu": [ "x64" ], @@ -482,9 +502,9 @@ } }, "node_modules/@rolldown/binding-freebsd-x64": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.1.3.tgz", - "integrity": "sha512-yD3EkEdXk2LypPxnf/kSZHirarsI8gcPzc62SukhR9VJTyvV+F9Q/GxWNuCojc7sXyuVC4DxRGhdDK4X8VSsbw==", + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.2.19.tgz", + "integrity": "sha512-O8ISAOfI1nj7AuBPd30FSF47z7f7lzlk5poQVGgiikvQuGEBFYvW8ki+UEnT+YJPnNGjQzn304klt4O9FUE7mA==", "cpu": [ "x64" ], @@ -499,9 +519,9 @@ } }, "node_modules/@rolldown/binding-linux-arm-gnueabihf": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.1.3.tgz", - "integrity": "sha512-c+8vieQbsD7HNAHKIA34w0GJ9FedFFuJGD+7E6vz7Q3uqAIugL5p45fhlsj4UaAsHpcmlqugBWMhA0/j7o0sIg==", + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.2.19.tgz", + "integrity": "sha512-/lYCba5NO0yq4S0jGMH8QTBtkvQxoXjoQWzF5BcWp9MjB9jxVRD1GQDNofkVjcOj30DWyhLIN/4Oe60JKzaONw==", "cpu": [ "arm" ], @@ -516,13 +536,16 @@ } }, "node_modules/@rolldown/binding-linux-arm64-gnu": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.1.3.tgz", - "integrity": "sha512-50jD0uUwLvur7Zz9LHz17kaAdTPjn5wN93hEgjvmYFRZwiR7ZJYovTd5ipyWJDAnXKvZ+wgc+/Ika6dwSF5OcA==", + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.2.19.tgz", + "integrity": "sha512-pm/apFMBnSbFb3O6nG5pHO1iqHhZrjGDFEjSm+ot9J17XXPvH9L90y5h+jgfHCE+Qdlsvy8qKEcU4VKxgjD+vA==", "cpu": [ "arm64" ], "dev": true, + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -533,13 +556,16 @@ } }, "node_modules/@rolldown/binding-linux-arm64-musl": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.1.3.tgz", - "integrity": "sha512-BO9+oPL8K9poZJBfYPsXNtYjPE5uM3qeehT3aFcW4LITOl+iSqhp0abzjR2nWBUNjIZeKXjAEWBZ64WjNoHd6w==", + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.2.19.tgz", + "integrity": "sha512-K1SmQp3FFichn8oqrNIwvFoZ5wcvjC7goBzpaMNvLf9FZc+QB/QvLmnpJZgAAGHiD980tP8FZZnXk2K94rvlxg==", "cpu": [ "arm64" ], "dev": true, + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -550,13 +576,16 @@ } }, "node_modules/@rolldown/binding-linux-ppc64-gnu": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.1.3.tgz", - "integrity": "sha512-f3VpLB1vQ0Eo6ecr/6cekLnvYMFF4YBFoVGkfkvPLq1bAkbAwHYQPZKoAmG6OJyTcxxoC+AvezGx/S1obNC0Mw==", + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.2.19.tgz", + "integrity": "sha512-I0xwD57jP/3A7+5UPZin2w8Y7XHEmEM5zqpYZOcQ45MlNW6tUJUziymV3yRr7rL4vwyfEcRsRksC4a7Kc08p5Q==", "cpu": [ "ppc64" ], "dev": true, + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -567,13 +596,16 @@ } }, "node_modules/@rolldown/binding-linux-s390x-gnu": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.1.3.tgz", - "integrity": "sha512-AmurZ26Pqx/RI9N1gzEOCklkKXl927yjfXWUUS0O7Puh8ARM/Ob8qfrD3qnWksScdw6cSrW5PSHE9DyLu7+PtA==", + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.2.19.tgz", + "integrity": "sha512-BrtEHT24SNXj9HiXqy+s/kXiSiQGt6EKCPUlRirAoIioVxKGnbXBUEkbZASAei7iZJB0/Ynm+0JP00Ipx7AnSw==", "cpu": [ "s390x" ], "dev": true, + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -584,13 +616,16 @@ } }, "node_modules/@rolldown/binding-linux-x64-gnu": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.1.3.tgz", - "integrity": "sha512-JJpqs8bRGITDOdbkNKnlojzBabbOHrqjSvDr0IVsZObE1lBcPjxItUEY9eWIDbxaJ3cGrXPWGfGkIxFijg/URg==", + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.2.19.tgz", + "integrity": "sha512-rm75/9DkHKeU2WnA8w4X94WGYgLlDCFCfkQC+4bguVJmC/jvDRv2B+2wLOYhyE0fVuv7//Ckk39OoOufyCu76Q==", "cpu": [ "x64" ], "dev": true, + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -601,13 +636,16 @@ } }, "node_modules/@rolldown/binding-linux-x64-musl": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.1.3.tgz", - "integrity": "sha512-rSJcdjPxzA/by/6/rYs+v+bXU7UjvnbUWz8MJb6kh6+knqB1dCrtHg0uu7C/4haqJvqdkYHQ5IGn+tCH9GLW/g==", + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.2.19.tgz", + "integrity": "sha512-irh/4+iYFM4GAzpluDErgjz89bj6NDtqqMAG/6O1LG38Ed3NpyebzCpcVNkFW8uhy+/3/BocUvnXDR33CXWe9A==", "cpu": [ "x64" ], "dev": true, + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -618,9 +656,9 @@ } }, "node_modules/@rolldown/binding-openharmony-arm64": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.1.3.tgz", - "integrity": "sha512-hQ3/PYkDJICgevvyNcVrihVeqq7k1Pp3VZ9lY+dauAYUJKO+auqApvANhvR1An9BhmqYKvW2Mu1F9u4DXSMLxQ==", + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.2.19.tgz", + "integrity": "sha512-+KWTWNoPt+CfSq94CiceWu3yPE+QzkaG+phPyz9G60tmZLwfQkcA4AeksafzvJAw4pvg1mcd5a1TkUqVv0s4JA==", "cpu": [ "arm64" ], @@ -635,9 +673,9 @@ } }, "node_modules/@rolldown/binding-wasm32-wasi": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/@rolldown/binding-wasm32-wasi/-/binding-wasm32-wasi-1.1.3.tgz", - "integrity": "sha512-Elcv/BtML9lXrV6JuKITc/grN2kYV9gjsQpW8Jfw4ioK0TOkjBjye0nnyqQNy9STNaI20lXNaQBRrD5gSgR0Yg==", + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-wasm32-wasi/-/binding-wasm32-wasi-1.2.19.tgz", + "integrity": "sha512-7EH+skOsl5qpWnK0vzamgJFhOv1cwxQpsxm8tI883K9fur5c27p8q87fzEO6BbBPabA2/+s/zR63/pLc137iOg==", "cpu": [ "wasm32" ], @@ -645,18 +683,18 @@ "license": "MIT", "optional": true, "dependencies": { - "@emnapi/core": "1.11.1", - "@emnapi/runtime": "1.11.1", - "@napi-rs/wasm-runtime": "^1.1.6" + "@emnapi/core": "2.0.0-beta.2", + "@emnapi/runtime": "2.0.0-beta.2", + "@napi-rs/wasm-runtime": "1.2.6" }, "engines": { - "node": "^20.19.0 || >=22.12.0" + "node": "^20.19.0 || ^22.13.0 || >=23.5.0" } }, "node_modules/@rolldown/binding-win32-arm64-msvc": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.1.3.tgz", - "integrity": "sha512-2DrEfhluH9yhiaFApmsjsjwrSYbNcY1oFTzYSP1a535jDbV98zCFanA/96TBUd0iDFcxGmw9QRExwGCXz3U+/g==", + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.2.19.tgz", + "integrity": "sha512-3Q1Yg1Q7tEvBWoZf5rFvG/GKZQPgwfru+p4wBajDfJFBs0SHCpL++dfTjW9gyAKd1T7ZpIYvdaUax7Pa/IhFVQ==", "cpu": [ "arm64" ], @@ -671,9 +709,9 @@ } }, "node_modules/@rolldown/binding-win32-x64-msvc": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.1.3.tgz", - "integrity": "sha512-OL4OMk7UPXOeVGGd3qo5zJyPIljf4AFgk5QAkPPS+OoLuOOozhuaQGC18MxVTnw/06q93gShAJzlwnSCY9YtqA==", + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.2.19.tgz", + "integrity": "sha512-y/sqRRc6d7hECzOFc5n3LSeqctmIp9mMjY1Kq4s14uLPd/LZ4z7i1zrW6fMtp2mPeuQIC4e6ULMcwQzMomqQag==", "cpu": [ "x64" ], @@ -721,9 +759,9 @@ } }, "node_modules/@tybys/wasm-util": { - "version": "0.10.3", - "resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.3.tgz", - "integrity": "sha512-F3fo1MYrRJYL3zER0OUOmkutjr1Vp23m7OsSgp7nq4SP6OqX6C/56XFIPAl5bt3zaBRjmW7SGz3u/6LwFpYcOg==", + "version": "0.10.4", + "resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.4.tgz", + "integrity": "sha512-W3c4gRigFS0T/Ma4qIYF3GDAc5AQdHb1yL5znJT1Zv1YaD9Kitx656wBjvr19qbiosmZT8lWDM5BEMynUqX65A==", "dev": true, "license": "MIT", "optional": true, @@ -796,13 +834,13 @@ "license": "MIT" }, "node_modules/axios": { - "version": "1.18.1", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.18.1.tgz", - "integrity": "sha512-3nTvFlvpn9Zu/RkHUqtc7/+al4UpRW5az71ap5zccp6e8RAYEzhMTecX8Dz1wWDYrPpUoB1HAQEGEAEvUr7S9g==", + "version": "1.21.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.21.1.tgz", + "integrity": "sha512-6eI5Q/Y4u/Um9dDlsRoq5pY2rxnUTv+L4PpLitnbk/i4jb3MxLZ5CsN5Ih3IysbeRYK4pR+P7qfMsOQl9fwwFQ==", "license": "MIT", "dependencies": { - "follow-redirects": "^1.16.0", - "form-data": "^4.0.5", + "follow-redirects": "^1.16.2", + "form-data": "^4.0.6", "https-proxy-agent": "^5.0.1", "proxy-from-env": "^2.1.0" } @@ -953,9 +991,9 @@ } }, "node_modules/follow-redirects": { - "version": "1.16.0", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.16.0.tgz", - "integrity": "sha512-y5rN/uOsadFT/JfYwhxRS5R7Qce+g3zG97+JrtFZlC9klX/W5hD7iiLzScI4nZqUS7DNUdhPgw4xI8W2LuXlUw==", + "version": "1.16.3", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.16.3.tgz", + "integrity": "sha512-toOSoqN6d51Wjf1aOFJYcoVv1aND9rj/CwjLU0Vz40oDuSpWDayCeKe4JpL5NL0WdFvoOOCI3BRo69HahjbR1A==", "funding": [ { "type": "individual", @@ -1120,9 +1158,9 @@ "license": "BSD-2-Clause" }, "node_modules/lightningcss": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.32.0.tgz", - "integrity": "sha512-NXYBzinNrblfraPGyrbPoD19C1h9lfI/1mzgWYvXUTe414Gz/X1FD2XBZSZM7rRTrMA8JL3OtAaGifrIKhQ5yQ==", + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.33.0.tgz", + "integrity": "sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA==", "dev": true, "license": "MPL-2.0", "dependencies": { @@ -1136,23 +1174,23 @@ "url": "https://opencollective.com/parcel" }, "optionalDependencies": { - "lightningcss-android-arm64": "1.32.0", - "lightningcss-darwin-arm64": "1.32.0", - "lightningcss-darwin-x64": "1.32.0", - "lightningcss-freebsd-x64": "1.32.0", - "lightningcss-linux-arm-gnueabihf": "1.32.0", - "lightningcss-linux-arm64-gnu": "1.32.0", - "lightningcss-linux-arm64-musl": "1.32.0", - "lightningcss-linux-x64-gnu": "1.32.0", - "lightningcss-linux-x64-musl": "1.32.0", - "lightningcss-win32-arm64-msvc": "1.32.0", - "lightningcss-win32-x64-msvc": "1.32.0" + "lightningcss-android-arm64": "1.33.0", + "lightningcss-darwin-arm64": "1.33.0", + "lightningcss-darwin-x64": "1.33.0", + "lightningcss-freebsd-x64": "1.33.0", + "lightningcss-linux-arm-gnueabihf": "1.33.0", + "lightningcss-linux-arm64-gnu": "1.33.0", + "lightningcss-linux-arm64-musl": "1.33.0", + "lightningcss-linux-x64-gnu": "1.33.0", + "lightningcss-linux-x64-musl": "1.33.0", + "lightningcss-win32-arm64-msvc": "1.33.0", + "lightningcss-win32-x64-msvc": "1.33.0" } }, "node_modules/lightningcss-android-arm64": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.32.0.tgz", - "integrity": "sha512-YK7/ClTt4kAK0vo6w3X+Pnm0D2cf2vPHbhOXdoNti1Ga0al1P4TBZhwjATvjNwLEBCnKvjJc2jQgHXH0NEwlAg==", + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.33.0.tgz", + "integrity": "sha512-gEpRTalKdosp4Bb8qWtc2iOgE5SeIHlpS1up9bFq2wAyYhl1UdTObYiHe98zEM9SQvSoqQZ1IQD0JNpg3Ml5pg==", "cpu": [ "arm64" ], @@ -1171,9 +1209,9 @@ } }, "node_modules/lightningcss-darwin-arm64": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.32.0.tgz", - "integrity": "sha512-RzeG9Ju5bag2Bv1/lwlVJvBE3q6TtXskdZLLCyfg5pt+HLz9BqlICO7LZM7VHNTTn/5PRhHFBSjk5lc4cmscPQ==", + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.33.0.tgz", + "integrity": "sha512-Sciaz8eenNTKn9b3t7+xr0ipTp9YxKQY4npwQ3mrRuL0BAVHBLyZxofhaKBAVtzmtRZ/zTyo0/to4B1uWG/Djg==", "cpu": [ "arm64" ], @@ -1192,9 +1230,9 @@ } }, "node_modules/lightningcss-darwin-x64": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.32.0.tgz", - "integrity": "sha512-U+QsBp2m/s2wqpUYT/6wnlagdZbtZdndSmut/NJqlCcMLTWp5muCrID+K5UJ6jqD2BFshejCYXniPDbNh73V8w==", + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.33.0.tgz", + "integrity": "sha512-Z5UPAxzrjlWNNyGy6i65cJzzvgJ5D3T6wMvs+gWpY9d7qRhANrxqAp6LhxIgZhWEw18RfJTGcRxjuLIBr+m8XQ==", "cpu": [ "x64" ], @@ -1213,9 +1251,9 @@ } }, "node_modules/lightningcss-freebsd-x64": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.32.0.tgz", - "integrity": "sha512-JCTigedEksZk3tHTTthnMdVfGf61Fky8Ji2E4YjUTEQX14xiy/lTzXnu1vwiZe3bYe0q+SpsSH/CTeDXK6WHig==", + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.33.0.tgz", + "integrity": "sha512-QQM/Ti/hQajJwCY+RiWuCZ9sdtI/XQk7nDK5vC8kkdwixezOlDgvDx7+RT+QjK6FcFT4MpsuoBnHIo/O3StRRg==", "cpu": [ "x64" ], @@ -1234,9 +1272,9 @@ } }, "node_modules/lightningcss-linux-arm-gnueabihf": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.32.0.tgz", - "integrity": "sha512-x6rnnpRa2GL0zQOkt6rts3YDPzduLpWvwAF6EMhXFVZXD4tPrBkEFqzGowzCsIWsPjqSK+tyNEODUBXeeVHSkw==", + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.33.0.tgz", + "integrity": "sha512-N7FVBe6iS24MlM6R/4RBTxGhQheZGs7tiQ9U32UtF75NzP5Q7xWPRqLBCKxlRQRk3rY1jCIPLzx7WzOhuUIRLQ==", "cpu": [ "arm" ], @@ -1255,13 +1293,16 @@ } }, "node_modules/lightningcss-linux-arm64-gnu": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.32.0.tgz", - "integrity": "sha512-0nnMyoyOLRJXfbMOilaSRcLH3Jw5z9HDNGfT/gwCPgaDjnx0i8w7vBzFLFR1f6CMLKF8gVbebmkUN3fa/kQJpQ==", + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.33.0.tgz", + "integrity": "sha512-j2v/itmy4HlNxlc6voKXYgBqNi0Ng2LShg4z7GufpEgs05P+2suBVyi9I6YHq5uoVFx9ETin3eCEhLVyXGQnKg==", "cpu": [ "arm64" ], "dev": true, + "libc": [ + "glibc" + ], "license": "MPL-2.0", "optional": true, "os": [ @@ -1276,13 +1317,16 @@ } }, "node_modules/lightningcss-linux-arm64-musl": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.32.0.tgz", - "integrity": "sha512-UpQkoenr4UJEzgVIYpI80lDFvRmPVg6oqboNHfoH4CQIfNA+HOrZ7Mo7KZP02dC6LjghPQJeBsvXhJod/wnIBg==", + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.33.0.tgz", + "integrity": "sha512-yiO5ROMuYQgXbC60yjZU5CYSFZGKXL0HFATXt9mHJn1+zW55oCtMI9NfcVhYLMFDL7gV7oBPon/EmMMGg2OvtQ==", "cpu": [ "arm64" ], "dev": true, + "libc": [ + "musl" + ], "license": "MPL-2.0", "optional": true, "os": [ @@ -1297,13 +1341,16 @@ } }, "node_modules/lightningcss-linux-x64-gnu": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.32.0.tgz", - "integrity": "sha512-V7Qr52IhZmdKPVr+Vtw8o+WLsQJYCTd8loIfpDaMRWGUZfBOYEJeyJIkqGIDMZPwPx24pUMfwSxxI8phr/MbOA==", + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.33.0.tgz", + "integrity": "sha512-ar+Ju7LmcN0Jo4FpL4hpFybwNG9/3A/Br5KW2n2jyODg3MEZXaDYADdemoNS+BDNfMgKvylJLj4S5tyRActuAg==", "cpu": [ "x64" ], "dev": true, + "libc": [ + "glibc" + ], "license": "MPL-2.0", "optional": true, "os": [ @@ -1318,13 +1365,16 @@ } }, "node_modules/lightningcss-linux-x64-musl": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.32.0.tgz", - "integrity": "sha512-bYcLp+Vb0awsiXg/80uCRezCYHNg1/l3mt0gzHnWV9XP1W5sKa5/TCdGWaR/zBM2PeF/HbsQv/j2URNOiVuxWg==", + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.33.0.tgz", + "integrity": "sha512-RYiYbkokw0trfKqqzfF55lginwEPrD3OJDfTuJzFs1MK6iFnDenaz1fqLLtX4ITG3OktJQXOeTaw1awrBAlZPw==", "cpu": [ "x64" ], "dev": true, + "libc": [ + "musl" + ], "license": "MPL-2.0", "optional": true, "os": [ @@ -1339,9 +1389,9 @@ } }, "node_modules/lightningcss-win32-arm64-msvc": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.32.0.tgz", - "integrity": "sha512-8SbC8BR40pS6baCM8sbtYDSwEVQd4JlFTOlaD3gWGHfThTcABnNDBda6eTZeqbofalIJhFx0qKzgHJmcPTnGdw==", + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.33.0.tgz", + "integrity": "sha512-1K+MPfLSFVpphzpdbfkhlWk6wBrTObBzS2T6db10PNOZgR9GoVsAWzwNyuhUYYbTp23j+4RrncfujZ4uAzXvwA==", "cpu": [ "arm64" ], @@ -1360,9 +1410,9 @@ } }, "node_modules/lightningcss-win32-x64-msvc": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.32.0.tgz", - "integrity": "sha512-Amq9B/SoZYdDi1kFrojnoqPLxYhQ4Wo5XiL8EVJrVsB8ARoC1PWW6VGtT0WKCemjy8aC+louJnjS7U18x3b06Q==", + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.33.0.tgz", + "integrity": "sha512-OlEICDx/Xl0FqSp4bry8zFnCvGpig3Gl4gCquvYwHuqJKEC1+n9NgDniFvqHGmMv1ZkqDJrDqKKSykTDX+ehuA==", "cpu": [ "x64" ], @@ -1417,9 +1467,9 @@ "license": "MIT" }, "node_modules/nanoid": { - "version": "3.3.15", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.15.tgz", - "integrity": "sha512-y7Wygv/7mEOvxTuEQDB8StXdMRBWf1kR/tlhAzBRUFkB2jfcLOAxO/SHmOO2zgz1pVgK29/kyupn059/bCHdjA==", + "version": "3.3.20", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.20.tgz", + "integrity": "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ==", "dev": true, "funding": [ { @@ -1492,9 +1542,9 @@ "license": "ISC" }, "node_modules/picomatch": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz", - "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==", + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", + "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", "dev": true, "license": "MIT", "engines": { @@ -1505,9 +1555,9 @@ } }, "node_modules/postcss": { - "version": "8.5.16", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.16.tgz", - "integrity": "sha512-vuwillviilfKZsg0VGj5R/YwwcHx4SLsIOI/7K6mQkWx+l5cUHTjj5g0AasTBcyXsbfTgrwsUNmVUb5xVwyPwg==", + "version": "8.5.32", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.32.tgz", + "integrity": "sha512-LJlKCCAUFKOuZxipUdYw1NzIITEsPcgyOG9LkvRJvuKj/bRzbuRY0ARXvL0pWGpsZvn8jku+LMep2eU0seHp8g==", "dev": true, "funding": [ { @@ -1525,9 +1575,9 @@ ], "license": "MIT", "dependencies": { - "nanoid": "^3.3.12", + "nanoid": "^3.3.20", "picocolors": "^1.1.1", - "source-map-js": "^1.2.1" + "source-map-js": "^1.2.2" }, "engines": { "node": "^10 || ^12 || >=14" @@ -1578,12 +1628,12 @@ } }, "node_modules/react-router": { - "version": "6.30.4", - "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.30.4.tgz", - "integrity": "sha512-SVUsDe+DybHM/WmYKIVYhZh1o5Dcuf16yM6WjG02Q9XVFMZIJyHYhwrr6bFBXZkVP6z69kNkMyBCujt8FaFLJA==", + "version": "6.30.6", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.30.6.tgz", + "integrity": "sha512-5HfK7k5im7LTOB0EqCQmfvy4C13G92Ssj1VTmouTK3AJvyjKTnFuCV0vcMAD/JS+JC4DvDIBRrlAeJIFjh5VWg==", "license": "MIT", "dependencies": { - "@remix-run/router": "1.23.3" + "@remix-run/router": "1.23.4" }, "engines": { "node": ">=14.0.0" @@ -1593,13 +1643,13 @@ } }, "node_modules/react-router-dom": { - "version": "6.30.4", - "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.30.4.tgz", - "integrity": "sha512-q4HvNl+mmDdkS0g+MqiBZNteQJCuimWoOyHMy4T/RQLAn9Z29+E91QXRaxOujeMl2HTzRSS0KFPd7lxX3PjV0Q==", + "version": "6.30.6", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.30.6.tgz", + "integrity": "sha512-0RHKZz7wwffvkU+2MFVT2NnjK44ssLEV+m0CAJaS2Ksmorrwj7WxH00jO0SOCW26/tINUnJHToXblDs33I38YQ==", "license": "MIT", "dependencies": { - "@remix-run/router": "1.23.3", - "react-router": "6.30.4" + "@remix-run/router": "1.23.4", + "react-router": "6.30.6" }, "engines": { "node": ">=14.0.0" @@ -1610,13 +1660,13 @@ } }, "node_modules/rolldown": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.1.3.tgz", - "integrity": "sha512-1F1eEtUBtFvcGm1HQ9TiUIUHPQG7mSAODrhIzjxoUEFuo8OcbrGLiVLkevNgj84TE4lnHvnumwFjhJO5Eu135g==", + "version": "1.2.19", + "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.19.tgz", + "integrity": "sha512-QIiV1J9d0pzN4jeeTH4sjPy0AZ6cAy2cG0ExeoE1+U8Rvj+hR3gYkokx0YbeUNGlZqiQJJ2utcETe0oKXwzsuA==", "dev": true, "license": "MIT", "dependencies": { - "@oxc-project/types": "=0.137.0", + "@oxc-project/types": "=0.156.0", "@rolldown/pluginutils": "^1.0.0" }, "bin": { @@ -1626,21 +1676,22 @@ "node": "^20.19.0 || >=22.12.0" }, "optionalDependencies": { - "@rolldown/binding-android-arm64": "1.1.3", - "@rolldown/binding-darwin-arm64": "1.1.3", - "@rolldown/binding-darwin-x64": "1.1.3", - "@rolldown/binding-freebsd-x64": "1.1.3", - "@rolldown/binding-linux-arm-gnueabihf": "1.1.3", - "@rolldown/binding-linux-arm64-gnu": "1.1.3", - "@rolldown/binding-linux-arm64-musl": "1.1.3", - "@rolldown/binding-linux-ppc64-gnu": "1.1.3", - "@rolldown/binding-linux-s390x-gnu": "1.1.3", - "@rolldown/binding-linux-x64-gnu": "1.1.3", - "@rolldown/binding-linux-x64-musl": "1.1.3", - "@rolldown/binding-openharmony-arm64": "1.1.3", - "@rolldown/binding-wasm32-wasi": "1.1.3", - "@rolldown/binding-win32-arm64-msvc": "1.1.3", - "@rolldown/binding-win32-x64-msvc": "1.1.3" + "@rolldown/binding-android-arm-eabi": "1.2.19", + "@rolldown/binding-android-arm64": "1.2.19", + "@rolldown/binding-darwin-arm64": "1.2.19", + "@rolldown/binding-darwin-x64": "1.2.19", + "@rolldown/binding-freebsd-x64": "1.2.19", + "@rolldown/binding-linux-arm-gnueabihf": "1.2.19", + "@rolldown/binding-linux-arm64-gnu": "1.2.19", + "@rolldown/binding-linux-arm64-musl": "1.2.19", + "@rolldown/binding-linux-ppc64-gnu": "1.2.19", + "@rolldown/binding-linux-s390x-gnu": "1.2.19", + "@rolldown/binding-linux-x64-gnu": "1.2.19", + "@rolldown/binding-linux-x64-musl": "1.2.19", + "@rolldown/binding-openharmony-arm64": "1.2.19", + "@rolldown/binding-wasm32-wasi": "1.2.19", + "@rolldown/binding-win32-arm64-msvc": "1.2.19", + "@rolldown/binding-win32-x64-msvc": "1.2.19" } }, "node_modules/scheduler": { @@ -1650,9 +1701,9 @@ "license": "MIT" }, "node_modules/source-map-js": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", - "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.2.tgz", + "integrity": "sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==", "dev": true, "license": "BSD-3-Clause", "engines": { @@ -1677,24 +1728,24 @@ } }, "node_modules/tslib": { - "version": "2.8.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", - "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.9.1.tgz", + "integrity": "sha512-a4Ux9VKuIMHsOS7ENbEq6hK2ZGYIT27Rtl0E4eD9KqwxhKiQeMZE/9xb3IdYwWaSOyIBQLExhQgXDTYoiCxnWA==", "dev": true, "license": "0BSD", "optional": true }, "node_modules/vite": { - "version": "8.1.2", - "resolved": "https://registry.npmjs.org/vite/-/vite-8.1.2.tgz", - "integrity": "sha512-6YYPbRXTxx6bRXmOn7XdnQAy5DQNHhDgtjhDHI13oe4pY93kkcdGJWxpGwOm++/Wh0QpQhDrpIoVMrmrsI5AGQ==", + "version": "8.3.8", + "resolved": "https://registry.npmjs.org/vite/-/vite-8.3.8.tgz", + "integrity": "sha512-LzOn3h9rG/0vhLdXrV4yJ4QFA9eEoqCl+Yx+kGJd7aB9w6nfNgVHKSYwLPZUHrz4ZGa+t+kXjV9itvcHDLQouA==", "dev": true, "license": "MIT", "dependencies": { - "lightningcss": "^1.32.0", - "picomatch": "^4.0.4", - "postcss": "^8.5.16", - "rolldown": "~1.1.3", + "lightningcss": "^1.33.0", + "picomatch": "^4.0.7", + "postcss": "^8.5.32", + "rolldown": "~1.2.18", "tinyglobby": "^0.2.17" }, "bin": { @@ -1711,7 +1762,7 @@ }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", - "@vitejs/devtools": "^0.3.0", + "@vitejs/devtools": "^0.7.1 || ^0.8.0", "esbuild": "^0.27.0 || ^0.28.0", "jiti": ">=1.21.0", "less": "^4.0.0", diff --git a/frontend/src/api.js b/frontend/src/api.js index 3f926c2..ceca1d6 100644 --- a/frontend/src/api.js +++ b/frontend/src/api.js @@ -1,8 +1,8 @@ import axios from 'axios' -const api = axios.create({ - baseURL: import.meta.env.VITE_API_URL ?? '/v1', -}) +const baseURL = import.meta.env.VITE_API_URL ?? '/v1' +const api = axios.create({ baseURL }) +const refreshURL = `${baseURL.replace(/\/+$/, '')}/auth/refresh` api.interceptors.request.use((config) => { const token = localStorage.getItem('access_token') @@ -23,7 +23,7 @@ api.interceptors.response.use( const refresh = localStorage.getItem('refresh_token') if (refresh) { try { - const { data } = await axios.post('/v1/auth/refresh', { refresh_token: refresh }) + const { data } = await axios.post(refreshURL, { refresh_token: refresh }) localStorage.setItem('access_token', data.access_token) original.headers.Authorization = `Bearer ${data.access_token}` return api(original) diff --git a/frontend/src/useSocket.js b/frontend/src/useSocket.js index 101689a..331cd98 100644 --- a/frontend/src/useSocket.js +++ b/frontend/src/useSocket.js @@ -1,22 +1,35 @@ import { useEffect, useRef, useCallback } from 'react' +// The live socket shares the API base URL so the Vite dev server (which has no +// proxy configured) can still reach the Go service when VITE_API_URL is set. +function liveUrl(token) { + const base = import.meta.env.VITE_API_URL ?? '/v1' + const url = new URL(base, window.location.href) + url.protocol = url.protocol === 'https:' ? 'wss:' : 'ws:' + url.pathname = url.pathname.replace(/\/+$/, '') + '/live' + url.search = `?token=${encodeURIComponent(token)}` + url.hash = '' + return url.toString() +} + /** - * useSocket connects to /v1/live (Step 15) and calls onMessage with each - * parsed JSON event. Reconnects automatically with exponential back-off. + * useSocket connects to the /live WebSocket endpoint and calls onMessage with + * each parsed JSON event. Reconnects automatically with exponential back-off. */ export function useSocket(onMessage) { const ws = useRef(null) const backoff = useRef(1000) + const reconnectTimer = useRef(null) + const stopped = useRef(false) const onMessageRef = useRef(onMessage) onMessageRef.current = onMessage const connect = useCallback(() => { + if (stopped.current) return const token = localStorage.getItem('access_token') if (!token) return - const proto = window.location.protocol === 'https:' ? 'wss' : 'ws' - const url = `${proto}://${window.location.host}/v1/live?token=${token}` - const socket = new WebSocket(url) + const socket = new WebSocket(liveUrl(token)) ws.current = socket socket.onopen = () => { @@ -33,17 +46,23 @@ export function useSocket(onMessage) { } socket.onclose = () => { - setTimeout(() => { - backoff.current = Math.min(backoff.current * 2, 30_000) - connect() - }, backoff.current) + ws.current = null + if (stopped.current) return + const delay = backoff.current + backoff.current = Math.min(backoff.current * 2, 30_000) + reconnectTimer.current = setTimeout(connect, delay) } socket.onerror = () => socket.close() }, []) useEffect(() => { + stopped.current = false connect() - return () => ws.current?.close() + return () => { + stopped.current = true + if (reconnectTimer.current) clearTimeout(reconnectTimer.current) + ws.current?.close() + } }, [connect]) } diff --git a/scripts/check_docs.py b/scripts/check_docs.py new file mode 100644 index 0000000..b4c1ad3 --- /dev/null +++ b/scripts/check_docs.py @@ -0,0 +1,73 @@ +#!/usr/bin/env python3 +"""Keep the README's headline versions in sync with the source of truth. + +CI runs this so a dependency bump cannot silently leave the README (or the +Docker/CI toolchain descriptions) stale. It only checks the values the README +advertises; it does not try to parse every dependency. +""" + +from __future__ import annotations + +import json +import re +import sys +from pathlib import Path + +ROOT = Path(__file__).resolve().parent.parent +README = (ROOT / "README.md").read_text(encoding="utf-8") +errors: list[str] = [] + + +def require(text: str, label: str) -> None: + if text not in README: + errors.append(f"README.md does not mention {label!r}") + + +# Go version from the API module. +gomod = (ROOT / "backend/api-service/go.mod").read_text(encoding="utf-8") +go_match = re.search(r"^go\s+(\d+\.\d+)", gomod, re.MULTILINE) +if not go_match: + errors.append("could not read the Go version from backend/api-service/go.mod") +else: + require(f"Go {go_match.group(1)}", f"Go {go_match.group(1)}") + +# React and Vite majors from the dashboard manifest. +package = json.loads((ROOT / "frontend/package.json").read_text(encoding="utf-8")) +for dependency, label in (("react", "React"), ("vite", "Vite")): + version = package.get("dependencies", {}).get(dependency) + if version is None: + version = package.get("devDependencies", {}).get(dependency) + if version is None: + errors.append(f"frontend/package.json has no {dependency} dependency") + continue + major = re.sub(r"[^0-9.]", "", version).split(".")[0] + require(f"{label} {major}", f"{label} {major}") + +# Postgres/PostGIS from the Compose image. +compose = (ROOT / "docker-compose.yml").read_text(encoding="utf-8") +pg_match = re.search(r"image:\s*postgis/postgis:(\d+)-([\d.]+)", compose) +if not pg_match: + errors.append("could not read the postgis image tag from docker-compose.yml") +else: + require(f"PostgreSQL {pg_match.group(1)}", f"PostgreSQL {pg_match.group(1)}") + require(f"PostGIS {pg_match.group(2)}", f"PostGIS {pg_match.group(2)}") + +# Node version must agree between CI and the dashboard image build. +ci = (ROOT / ".github/workflows/ci.yml").read_text(encoding="utf-8") +dockerfile = (ROOT / "Dockerfile.caddy").read_text(encoding="utf-8") +node_ci = re.search(r"node-version:\s*(\d+)", ci) +node_docker = re.search(r"FROM\s+node:(\d+)", dockerfile) +if not node_ci or not node_docker: + errors.append("could not read the Node version from CI and Dockerfile.caddy") +else: + if node_ci.group(1) != node_docker.group(1): + errors.append( + f"CI uses Node {node_ci.group(1)} but Dockerfile.caddy uses Node {node_docker.group(1)}" + ) + require(f"Node.js {node_ci.group(1)}", f"Node.js {node_ci.group(1)}") + +if errors: + print("\n".join(f"ERROR: {error}" for error in errors)) + sys.exit(1) + +print("README versions match go.mod, package.json, docker-compose.yml, CI and Dockerfile.caddy")