Replace em-dashes with hyphens across source and docs
Reads more like hand-written code than generated copy.
This commit is contained in:
+6
-6
@@ -6,8 +6,8 @@ All notable changes to Caelum are documented here. Format follows [Keep a Change
|
||||
|
||||
### Added
|
||||
- **Object deep-dive dossier (`/object/:name`).** Pick a frame from the Archive (or a research card) and open one page that pulls together everything Caelum knows about that object: every visible frame across telescopes, the observations that produced them (frozen provenance where linked), catalog identity (lazy SIMBAD), a local SpaceDB orbital match for NEO/comet objects, an observation-cadence timeline + per-filter coverage, prior frame analysis, and an embedded Lab that analyzes the object + its frames into a schedulable Nox program. Backend `GET /api/research/object/:name` is 100% local (works with no outbound network); catalog/SIMBAD is a separate optional call. Reuses the existing analysis engine via a new `target_inline` path so objects with no feed row can still be analyzed. Entry points from the Archive frame modal, research cards, and ⌘K. New server tests cover dossier visibility filtering, exact-vs-fuzzy name matching (no silent merging of M31/M310), and null-`observation_id` aggregation.
|
||||
- **Add research by hand, offline.** A prominent "+ Add research" button on the Research page opens a modal (category, designation, optional RA/Dec/magnitude/priority/note) that adds a target to the feed with `POST /api/research/targets` — no upstream fetch, no scheduling. Every prior add path needed the internet; this one works on the deploy that doesn't have it.
|
||||
- **In-app "buy me a coffee" support checkout.** The landing's coffee button now opens an in-app amount picker (presets + custom, server-validated bounds) and mounts Stripe's Embedded Checkout inside a modal — the supporter never leaves Caelum, and card fields stay in Stripe's iframe. Falls back to a hosted payment link when `STRIPE_SECRET_KEY` is unset. New `/api/support` route + 7 tests (amount validation, allowlisted return_url, offline fallback).
|
||||
- **Add research by hand, offline.** A prominent "+ Add research" button on the Research page opens a modal (category, designation, optional RA/Dec/magnitude/priority/note) that adds a target to the feed with `POST /api/research/targets` - no upstream fetch, no scheduling. Every prior add path needed the internet; this one works on the deploy that doesn't have it.
|
||||
- **In-app "buy me a coffee" support checkout.** The landing's coffee button now opens an in-app amount picker (presets + custom, server-validated bounds) and mounts Stripe's Embedded Checkout inside a modal - the supporter never leaves Caelum, and card fields stay in Stripe's iframe. Falls back to a hosted payment link when `STRIPE_SECRET_KEY` is unset. New `/api/support` route + 7 tests (amount validation, allowlisted return_url, offline fallback).
|
||||
|
||||
### Changed
|
||||
- **Settings toggles actually do something.** Theme and density were saved to the account but never applied to the page, so toggling them changed nothing visible. They now reflect onto `<html data-theme data-density>` (applied at boot from a localStorage cache and synced from the account on login): a real **light theme** (the app was dark-only), and a **compact density** that tightens the spacing + type scale. Every setting also shows a "Saved ✓" confirmation. A handful of views still hardcode colors and read slightly off in light until tokenized.
|
||||
@@ -19,10 +19,10 @@ All notable changes to Caelum are documented here. Format follows [Keep a Change
|
||||
- **Portal navigation follows the night's lifecycle.** The sidebar is re-grouped from data-category buckets (Observe/Plan/Observatory/Network/Data) into the arc the landing tells: **Tonight → Your Observatory → Plan & Book → Archive → Community**. The Dashboard ("Tonight") reads down that same arc and shows a first-run getting-started path for empty accounts. Duplicate surfaces consolidated: Archive's "Global Feed" tab now links to Activity, and Inbox's "Upcoming Sessions" card defers to the Schedule. DESIGN.md's IA section rewritten to match.
|
||||
- **Landing page rewritten.** Full-bleed banded layout (topbar, hero + auth, "Live on the network" explainer, features, Nox showcase, footer) that no longer strands the auth card in whitespace and no longer presents seeded sample data as a live network. Seed trimmed of invented community prose (fabricated users, generic comment/testimonial filler) while keeping the real gear, categories, and links.
|
||||
- **Nox Console works without an account.** `/nox` is now publicly viewable, so "Try Nox without signing up" → Examples → "Open in Console" no longer bounces guests to the landing (mock runs were already unauthenticated server-side; the router just disagreed).
|
||||
- **Clearer offline errors for research tools.** Upstream fetch failures (SIMBAD, JPL, NASA, AAVSO, and now the Lab's Anthropic call) surface "No outbound network from this server — this tool needs internet" instead of a raw "fetch failed"/"aborted", and the two mismatched timeouts (6s/15s) are unified to 12s.
|
||||
- **Clearer offline errors for research tools.** Upstream fetch failures (SIMBAD, JPL, NASA, AAVSO, and now the Lab's Anthropic call) surface "No outbound network from this server - this tool needs internet" instead of a raw "fetch failed"/"aborted", and the two mismatched timeouts (6s/15s) are unified to 12s.
|
||||
|
||||
### Fixed
|
||||
- **Vet endpoint 500 on MySQL.** `UPDATE sites SET successful_observations = MAX(0, …)` is a syntax error on MySQL (2-arg `MAX` is aggregate-only) — every `PUT /api/observations/:id/vet` failed in production while passing SQLite dev tests. Replaced with a portable `CASE` expression, verified against MySQL 8.4.
|
||||
- **Vet endpoint 500 on MySQL.** `UPDATE sites SET successful_observations = MAX(0, …)` is a syntax error on MySQL (2-arg `MAX` is aggregate-only) - every `PUT /api/observations/:id/vet` failed in production while passing SQLite dev tests. Replaced with a portable `CASE` expression, verified against MySQL 8.4.
|
||||
- **Simulator hardware control.** A freshly-seeded (idle) simulator now slews without a manual connect (the Nox real-mode path had no connect step), and disconnecting a simulator actually returns it to idle instead of leaving it stuck "connected". New HTTP-level `control.js` integration tests for the connect → status → slew → position → disconnect flow.
|
||||
- **Astra `api_key` no longer leaks.** `GET /api/astra/instances` returned `SELECT ai.*` including the credential that drives slew/expose/open-dome; now column-listed to exclude it.
|
||||
- **User emails no longer exposed.** The Leaderboard drill-down (`/api/network/stats/users`) selected `email`/`role` for any authenticated user; scoped to `id`/`username`/`created_at`.
|
||||
@@ -47,7 +47,7 @@ All notable changes to Caelum are documented here. Format follows [Keep a Change
|
||||
|
||||
- DB-outage resilience (TODO K). The server no longer hard-exits when MySQL is unreachable at boot or drops mid-flight. `initDb()` runs in the background with capped exponential backoff (1s → 30s); HTTP comes up immediately so `/api/health` can report `degraded`. Background services (`weather-sim`, `lifecycle`, `weather-stations`) now run under a shared `safeInterval` helper that catches errors, suppresses repeat log lines within a 60s window, prevents tick overlap, and logs a `recovered` line when the underlying error clears. 5 unit tests cover the helper. Verified live: stopping the `db` container during an active session left the app process untouched (`startedAt` unchanged), `/api/health` flipped to 503 in 16ms, `/api/nox/check` kept serving, and recovery happened within 4s of bringing the DB back.
|
||||
- Real-hardware confirmation dialog in the Nox Console (TODO A). When Mode is "Real hardware" and the user clicks Run, the IDE first does a mock-mode dry-run, then surfaces a dialog with op count, resource list, and the first op's signature. "Don't ask again this session" suppresses for subsequent runs. Esc and Cancel back out. The Run button stays disabled if the dry-run itself errored. Pure client-side UX safety gate; works against any real driver.
|
||||
- **ASCOM Alpaca driver translation for Nox (TODO H).** Real-mode Nox programs now reach real hardware when a telescope row has `driver_type='alpaca'`. New `services/alpaca-telescope.js` covers `slew` (slewtocoordinatesasync + connected + tracking), `park`, `home` (findhome), and `wait_until_settled` (polls Slewing then reads final RA/Dec). New `services/alpaca-camera.js` covers `cooldown` (cooler + setccdtemperature with poll) and `expose` (startexposure + imageready). `services/nox-driver.js` dispatches per-telescope based on `driver_type`: `simulator` → DB-only mock, `stellarium` → existing TCP packets, `alpaca` → REST. 5 dispatcher tests with intercepted fetch lock in the wiring. The Alpaca camera/telescope modules share the existing `alpacaGet/alpacaPut` helpers in `external-drivers.js`. **Scope honesty:** INDI (Linux native binary protocol) and ASCOM-over-COM (Windows-only) are not implemented; Alpaca reaches Windows ASCOM drivers via the Alpaca Remote Server bridge. Verified live by running a Nox program against a local fake Alpaca server — the exact ASCOM call sequence (connect, tracking, slewtocoordinatesasync, slewing poll, position read, park) was recorded.
|
||||
- **ASCOM Alpaca driver translation for Nox (TODO H).** Real-mode Nox programs now reach real hardware when a telescope row has `driver_type='alpaca'`. New `services/alpaca-telescope.js` covers `slew` (slewtocoordinatesasync + connected + tracking), `park`, `home` (findhome), and `wait_until_settled` (polls Slewing then reads final RA/Dec). New `services/alpaca-camera.js` covers `cooldown` (cooler + setccdtemperature with poll) and `expose` (startexposure + imageready). `services/nox-driver.js` dispatches per-telescope based on `driver_type`: `simulator` → DB-only mock, `stellarium` → existing TCP packets, `alpaca` → REST. 5 dispatcher tests with intercepted fetch lock in the wiring. The Alpaca camera/telescope modules share the existing `alpacaGet/alpacaPut` helpers in `external-drivers.js`. **Scope honesty:** INDI (Linux native binary protocol) and ASCOM-over-COM (Windows-only) are not implemented; Alpaca reaches Windows ASCOM drivers via the Alpaca Remote Server bridge. Verified live by running a Nox program against a local fake Alpaca server - the exact ASCOM call sequence (connect, tracking, slewtocoordinatesasync, slewing poll, position read, park) was recorded.
|
||||
- **Hardware discovery wizard in the Nox Console (TODO B).** When Mode = "Real hardware" the IDE shows a "Configure…" button that opens a wizard: enter host + port (defaults `127.0.0.1:11111`), hit Discover, see the Alpaca server's name + manufacturer + version, get a table of every configured device (DeviceType + DeviceName + DeviceNumber), and pick which Caelum telescope or enclosure row each one attaches to. Save runs PUT `/api/hardware/{telescopes|enclosures}/:id/driver` per attachment. Server-side: new `POST /api/hardware/discover/host` calls `/management/v1/configureddevices` on a known host (UDP broadcast is unreachable across docker / network boundaries, hence the manual-host variant). Devices that don't yet have a wizard attach surface (cameras, focusers, filter wheels) are listed as "not yet supported in the wizard" instead of silently dropped.
|
||||
- **SQLite as a first-class backend (TODO J).** Set `DB_KIND=sqlite` (with optional `SQLITE_PATH=...`) and the server boots without MySQL. Highlights:
|
||||
- New `server/src/config/database-sqlite.js` exposes the same `db.get/all/run/exec/tx` surface as the MySQL backend.
|
||||
@@ -77,7 +77,7 @@ Security and bug-fix patch. No schema or API-shape changes; safe to deploy over
|
||||
- **Sentry no longer leaks credentials.** `sendDefaultPii` disabled; a `beforeSend` hook strips `Authorization`/`Cookie` headers and redacts `cae_…`/`Bearer …` strings from payloads.
|
||||
- **Gate Astra hardware-read endpoints.** Seven `GET /api/astra/instances/:id/*` routes (status, position, autoguide/autofocus status, plate-solve result, camera status, weather) lacked the site-membership gate the mutating routes had, leaking another operator's live telescope state. `weather-stations/:id/poll` now requires `canEditSite`.
|
||||
- **Stop leaking email/role** from `GET /api/network/users/:username/profile`.
|
||||
- **SSRF guard on driver fetches.** Block the link-local/cloud-metadata range (`169.254.0.0/16`, `fe80::`, `metadata.google.internal`) and non-HTTP(S) schemes in weather/Alpaca driver requests. LAN and loopback hosts remain allowed — real ASCOM Alpaca drivers run there.
|
||||
- **SSRF guard on driver fetches.** Block the link-local/cloud-metadata range (`169.254.0.0/16`, `fe80::`, `metadata.google.internal`) and non-HTTP(S) schemes in weather/Alpaca driver requests. LAN and loopback hosts remain allowed - real ASCOM Alpaca drivers run there.
|
||||
- **Lock down CORS and add security headers.** Replaced wildcard CORS / Socket.IO origin with an env-configurable allowlist (`CORS_ORIGINS`); added `X-Content-Type-Options`, `X-Frame-Options: DENY`, `Referrer-Policy`, and prod-only HSTS; set `trust proxy` for accurate client IPs.
|
||||
|
||||
### Fixed
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ See the quick start in [README.md](README.md). Once `npm run dev` works, you hav
|
||||
```
|
||||
client/ Vue 3 SPA. Pages in src/views/, components in src/components/.
|
||||
server/ Express API. Routes in src/routes/, services in src/services/.
|
||||
nox/ The Nox DSL. Self-contained — parser, runtime, docs, examples.
|
||||
nox/ The Nox DSL. Self-contained - parser, runtime, docs, examples.
|
||||
sql/ Database dumps. Regenerate via `cd server && npm run migrate -- --dump ../sql`.
|
||||
scripts/ Tooling, including the deploy bundler.
|
||||
```
|
||||
|
||||
@@ -10,12 +10,12 @@ imaging sessions, coordinate with federated operators, and share an imaging
|
||||
archive. Ships with **Nox**, a typed DSL for telescope/dome control.
|
||||
|
||||
Users are observatory operators and astronomers. The UI is a **dark,
|
||||
data-dense control surface** — information density over whitespace. Operators
|
||||
data-dense control surface** - information density over whitespace. Operators
|
||||
want to see state at a glance, not scroll.
|
||||
|
||||
## Information architecture
|
||||
|
||||
Navigation follows the **lifecycle of a night**, top to bottom — the same arc
|
||||
Navigation follows the **lifecycle of a night**, top to bottom - the same arc
|
||||
the landing page tells. Read the sidebar as a story, not a taxonomy: your
|
||||
telescope goes on the network → people book it → it runs live → the data lands
|
||||
→ all inside a community. Sidebar order is fixed and is the narrative.
|
||||
@@ -28,14 +28,14 @@ telescope goes on the network → people book it → it runs live → the data l
|
||||
| **Archive** | Archive, SpaceDB | The data that lands |
|
||||
| **Community** | Community, Messages, Inbox | The people around it |
|
||||
|
||||
Live sessions render as a dynamic group **above** the workspaces when active —
|
||||
Live sessions render as a dynamic group **above** the workspaces when active -
|
||||
the "Run" beat, given top billing while it's happening. Quick-jump (⌘K)
|
||||
searches both destinations and remote entities.
|
||||
|
||||
Rule: a page belongs to exactly one workspace, and the workspace answers "which
|
||||
stage of the night is this?". If a concept spans two, the surfaces co-locate
|
||||
inside one page (e.g. "My Bookings" and "Schedule" are the same page, not two
|
||||
nav items) — this is what kills the "scheduled here but not there" confusion.
|
||||
nav items) - this is what kills the "scheduled here but not there" confusion.
|
||||
|
||||
**One home per surface.** A given kind of thing has a single canonical page:
|
||||
the network activity firehose lives on Activity (not also as an Archive tab);
|
||||
@@ -66,7 +66,7 @@ hard-code hex in a component.
|
||||
## Lifecycle state semantics (single source of truth)
|
||||
|
||||
The API returns `session_state` (`live` | `scheduled` | `completed` | raw
|
||||
status). Bind it directly to the pill component — never re-derive state in a
|
||||
status). Bind it directly to the pill component - never re-derive state in a
|
||||
view, never invent a fourth color:
|
||||
|
||||
```vue
|
||||
@@ -117,7 +117,7 @@ All sizes in rem via tokens. Font: system stack (air-gap safe, no CDN).
|
||||
One pattern per concern. Don't hand-roll a second variant in a view.
|
||||
|
||||
- **Page shell**: `.page-header` (title block + right-aligned actions slot)
|
||||
inside `.page-container` (max 1200px, centered) — provided by `App.vue`.
|
||||
inside `.page-container` (max 1200px, centered) - provided by `App.vue`.
|
||||
- **Card**: `.card`. Header row: `.card-header` + `<h3>`. Stack with
|
||||
`.card + .card`.
|
||||
- **Stat strip**: `.stat-card` with `.label` + `.value`, laid out in
|
||||
@@ -125,7 +125,7 @@ One pattern per concern. Don't hand-roll a second variant in a view.
|
||||
- **Table**: `.data-table`. Numeric columns get `.num` (right-aligned,
|
||||
tabular figures). Don't style raw `<table>`.
|
||||
- **State pill**: `.pill` + `.pill-<state>` (see lifecycle table). The only
|
||||
status component. `.badge-*` is legacy — migrate on touch, don't add new.
|
||||
status component. `.badge-*` is legacy - migrate on touch, don't add new.
|
||||
- **Buttons**: `.btn` + `.btn-primary` / `-secondary` / `-danger` / `-ghost`,
|
||||
`.btn-sm` for dense rows. Hover color is pinned (RouterLink renders `<a>`;
|
||||
global `a:hover` would otherwise eat the label).
|
||||
@@ -142,7 +142,7 @@ Never use auto-fill/auto-fit (it silently rendered 3 cramped columns in a
|
||||
|
||||
## Density rules
|
||||
|
||||
- Tables: compact rows (`--space-3` padding), no zebra — hover only.
|
||||
- Tables: compact rows (`--space-3` padding), no zebra - hover only.
|
||||
- Headers: roomy (`--space-6` below page header).
|
||||
- Lists of entities: prefer table over card grid past ~6 rows.
|
||||
- Calendar/sky-viewer keep their specialized treatments.
|
||||
@@ -157,7 +157,7 @@ Never use auto-fill/auto-fit (it silently rendered 3 cramped columns in a
|
||||
## Non-negotiables
|
||||
|
||||
1. Read this file before any visual change. In QA, flag deviations.
|
||||
2. No hard-coded colors, spacing, or font sizes — tokens only.
|
||||
2. No hard-coded colors, spacing, or font sizes - tokens only.
|
||||
3. One component per concern; migrate legacy on touch, never fork.
|
||||
4. Lifecycle state = API `session_state` → `.pill`. Never re-derive.
|
||||
5. A page lives in exactly one workspace.
|
||||
|
||||
@@ -4,7 +4,7 @@ A shared observatory network. Caelum lets observatories publish telescope time,
|
||||
|
||||
- **Site:** [caelum.network](https://caelum.network)
|
||||
- **Source:** [gitlab.com/paulhitt/caelum](https://gitlab.com/paulhitt/caelum)
|
||||
- **License:** MIT — see [LICENSE](LICENSE)
|
||||
- **License:** MIT - see [LICENSE](LICENSE)
|
||||
- **Support:** [☕ Buy me a coffee](https://buy.stripe.com/eVqaEX1S41hz5R42JVeQM00)
|
||||
|
||||
## What's in the box
|
||||
@@ -52,13 +52,13 @@ npm start # runs server.js, serves API + SPA on the same port
|
||||
After deploying code that changes the schema, run the idempotent upgrade:
|
||||
|
||||
```sh
|
||||
npm run db:upgrade # repo root — upgrades the active backend
|
||||
npm run db:upgrade # repo root - upgrades the active backend
|
||||
# or, inside server/:
|
||||
DB_KIND=mysql npm run db:upgrade:mysql
|
||||
```
|
||||
|
||||
It applies the full schema (`CREATE TABLE IF NOT EXISTS`) plus
|
||||
add-column-if-missing migrations. **Safe to run repeatedly** — it never
|
||||
add-column-if-missing migrations. **Safe to run repeatedly** - it never
|
||||
drops or rewrites data, so it's the right step to gate a deploy on. Exit
|
||||
code 1 on failure. Backend follows `DB_KIND` (sqlite default). The server
|
||||
also runs this automatically on boot; the script just exposes it as an
|
||||
@@ -72,7 +72,7 @@ docker compose up -d # boot MySQL + the app
|
||||
docker compose exec app sh -c "cd server && npm run seed"
|
||||
```
|
||||
|
||||
The app is then on `http://localhost:3002` (or whatever `CAELUM_PORT` is set to). MySQL data persists in the `caelum-db` volume — wipe with `docker compose down -v`. The compose file lives at the repo root; see [docker-compose.yml](docker-compose.yml) and the [`docker/initdb/`](docker/initdb/) scripts.
|
||||
The app is then on `http://localhost:3002` (or whatever `CAELUM_PORT` is set to). MySQL data persists in the `caelum-db` volume - wipe with `docker compose down -v`. The compose file lives at the repo root; see [docker-compose.yml](docker-compose.yml) and the [`docker/initdb/`](docker/initdb/) scripts.
|
||||
|
||||
## Nox
|
||||
|
||||
@@ -105,7 +105,7 @@ session "spring-galaxies" {
|
||||
Run it without installing anything:
|
||||
|
||||
```sh
|
||||
# After npm publish — see RELEASING.md
|
||||
# After npm publish - see RELEASING.md
|
||||
npx @caelum/nox-runtime run program.nox
|
||||
```
|
||||
|
||||
@@ -159,7 +159,7 @@ Set `MYSQL_SPACEDB_DATABASE=` (empty) to disable SpaceDB routes.
|
||||
|
||||
### Populate the databases
|
||||
|
||||
Start the server cold — it auto-creates the schema via `initDb()` in [server/src/config/database.js](server/src/config/database.js). Then run the seed script to load sample sites, telescopes, proposals, and frames:
|
||||
Start the server cold - it auto-creates the schema via `initDb()` in [server/src/config/database.js](server/src/config/database.js). Then run the seed script to load sample sites, telescopes, proposals, and frames:
|
||||
|
||||
```sh
|
||||
cd server && npm run seed
|
||||
@@ -173,7 +173,7 @@ The seed creates two accounts:
|
||||
SpaceDB routes return 503 until the catalog is available.
|
||||
|
||||
**SQLite dev path (no MySQL):** drop the SpaceDB catalog file `db.sqlite3`
|
||||
at the repo root (it's gitignored — the dump is ~1.4 GB) and SpaceDB works
|
||||
at the repo root (it's gitignored - the dump is ~1.4 GB) and SpaceDB works
|
||||
immediately; the server reads it directly. Override the location with
|
||||
`SPACEDB_SQLITE_PATH` or `SPACEDB_PATH`. If the file is absent, SpaceDB
|
||||
cleanly reports 503 and the rest of the app is unaffected.
|
||||
@@ -225,7 +225,7 @@ Pull requests welcome. See [CONTRIBUTING.md](CONTRIBUTING.md) for the developmen
|
||||
|
||||
Caelum is free and MIT-licensed. If it saved you time or you just like the
|
||||
project, you can [**☕ buy me a coffee**](https://buy.stripe.com/eVqaEX1S41hz5R42JVeQM00).
|
||||
Payments are handled securely by Stripe. Thank you — it genuinely helps keep
|
||||
Payments are handled securely by Stripe. Thank you - it genuinely helps keep
|
||||
development caffeinated.
|
||||
|
||||
## Security
|
||||
|
||||
+2
-2
@@ -13,7 +13,7 @@ with Docker (see the README).
|
||||
|
||||
## Versioning
|
||||
|
||||
Pre-1.0 SemVer: every minor may break, every patch is safe. Breaking changes go in `CHANGELOG.md`. All five workspaces share one version number — keep them in sync.
|
||||
Pre-1.0 SemVer: every minor may break, every patch is safe. Breaking changes go in `CHANGELOG.md`. All five workspaces share one version number - keep them in sync.
|
||||
|
||||
## Release checklist
|
||||
|
||||
@@ -21,7 +21,7 @@ Pre-1.0 SemVer: every minor may break, every patch is safe. Breaking changes go
|
||||
# 1. Bump versions across all five package.jsons. Pre-1.0 minor bump:
|
||||
# root, server, client, nox/parser, nox/runtime
|
||||
#
|
||||
# (Use find + sed, or do them by hand — they should all match.)
|
||||
# (Use find + sed, or do them by hand - they should all match.)
|
||||
#
|
||||
# 2. Move [Unreleased] to [<version>] in CHANGELOG.md and date it.
|
||||
#
|
||||
|
||||
@@ -28,14 +28,14 @@ Outstanding work from the DX review on 2026-05-14 (commit `dc6c460`). Each entry
|
||||
**Pros:** Eliminates docker-compose need (item F). Reaches Champion TTHW tier. New users can `npm run dev` immediately after clone.
|
||||
**Cons:** Multi-hour refactor:
|
||||
- DDL block in `server/src/config/database.js` uses MySQL-specific syntax (`ENGINE=InnoDB`, `AUTO_INCREMENT`, `utf8mb4`, backtick-quoted reserved words) that needs a parallel SQLite DDL or a transpiler
|
||||
- `addColumnIfMissing` queries `INFORMATION_SCHEMA` — needs SQLite's `PRAGMA table_info` equivalent
|
||||
- `addColumnIfMissing` queries `INFORMATION_SCHEMA` - needs SQLite's `PRAGMA table_info` equivalent
|
||||
- `mysql2` typeCast hook for DATETIME → ISO-8601 needs a SQLite equivalent (better-sqlite3 returns strings already, but format differs)
|
||||
- Transaction helper differs (begin/commit/rollback vs mysql2's `getConnection().beginTransaction()`)
|
||||
- Many routes use MySQL-only features (e.g., ON DUPLICATE KEY UPDATE, backtick-quoted column names like `\`dec\``). Each route's SQL needs ANSI-compatible variants.
|
||||
- The seed.js and migrate.js scripts already cross both — partial reuse possible
|
||||
- The seed.js and migrate.js scripts already cross both - partial reuse possible
|
||||
- Tests need to run against both DB types in CI
|
||||
|
||||
**Context:** All the SQL lives in `server/src/config/database.js` (DDL) and `server/src/routes/*.js` (individual queries). `better-sqlite3` is already in `server/package.json` dependencies. The legacy SQLite path that existed before the MySQL migration was removed — restoring it means building a fresh adapter, not reviving old code.
|
||||
**Context:** All the SQL lives in `server/src/config/database.js` (DDL) and `server/src/routes/*.js` (individual queries). `better-sqlite3` is already in `server/package.json` dependencies. The legacy SQLite path that existed before the MySQL migration was removed - restoring it means building a fresh adapter, not reviving old code.
|
||||
|
||||
**Estimate:** 4-8 hours of careful work plus a full QA pass on every route. Worth doing in a dedicated session.
|
||||
|
||||
|
||||
+15
-15
@@ -1,4 +1,4 @@
|
||||
# Caelum feature backlog — READY queue
|
||||
# Caelum feature backlog - READY queue
|
||||
|
||||
The Caelum daily sweep (`scripts/caelum-daily-sweep/`) reads this file each morning and ships the **first unchecked item** as a draft MR, with unit tests + UI verification.
|
||||
|
||||
@@ -7,12 +7,12 @@ The Caelum daily sweep (`scripts/caelum-daily-sweep/`) reads this file each morn
|
||||
Each item is one line, exactly:
|
||||
|
||||
```
|
||||
- [ ] <slug>: <one-line user-visible description> — scope: <server|client|nox|docs|infra> · evidence: <how to know it works>
|
||||
- [ ] <slug>: <one-line user-visible description> - scope: <server|client|nox|docs|infra> · evidence: <how to know it works>
|
||||
```
|
||||
|
||||
- `slug` — kebab-case, used in branch + commit (`feat/auto-<slug>-<date>`).
|
||||
- `scope` — primary surface the change touches. `nox` is disallowed (Section 7 rule).
|
||||
- `evidence` — the assertion the sweep should make to declare the feature shipped (a test name, a UI element appearing, an API response shape).
|
||||
- `slug` - kebab-case, used in branch + commit (`feat/auto-<slug>-<date>`).
|
||||
- `scope` - primary surface the change touches. `nox` is disallowed (Section 7 rule).
|
||||
- `evidence` - the assertion the sweep should make to declare the feature shipped (a test name, a UI element appearing, an API response shape).
|
||||
|
||||
Keep items small. The sweep aborts anything over 200 LOC of production code or 8 files.
|
||||
|
||||
@@ -20,17 +20,17 @@ Check the item off (`- [x]`) once it lands. The sweep skips checked items.
|
||||
|
||||
## Queue (top = next)
|
||||
|
||||
- [ ] route-meta-titles: per-route `document.title` + `meta[name=description]` for the 12 public Vue views — scope: client · evidence: navigating to `/discover` sets `document.title` to "Discover — Caelum"
|
||||
- [ ] static-og-tags: brand-level `og:title` / `og:description` / `og:image` / `twitter:card` in `client/index.html` — scope: client · evidence: `curl http://127.0.0.1:5173/ | grep 'og:title'` returns a match
|
||||
- [ ] robots-txt: ship `client/public/robots.txt` (allow all, link to sitemap) — scope: client · evidence: `curl http://127.0.0.1:5173/robots.txt` returns 200 with `Sitemap:` line
|
||||
- [ ] sitemap-static: generator script `scripts/build-sitemap.mjs` that walks `client/src/router.js` and writes `client/public/sitemap.xml` for public routes — scope: infra · evidence: `node scripts/build-sitemap.mjs && grep '<loc>' client/public/sitemap.xml | wc -l` ≥ 6
|
||||
- [ ] nox-doc-prevnext: prev/next links in NoxDocs.vue derived from the doc index — scope: client · evidence: opening `/nox/docs/parser` shows a "Next →" link to the next doc in order
|
||||
- [ ] healthz-endpoint: `GET /api/healthz` returns `{ ok: true, db: 'up'|'down'|'disabled', version }` — scope: server · evidence: `server/test/healthz.test.js` asserts 200 + shape
|
||||
- [ ] api-tokens-last-used-format: `/api/tokens` response includes `last_used_relative` (e.g. "3h ago") next to the existing ISO timestamp — scope: server · evidence: existing `tokens.test.js` extended with assertion
|
||||
- [ ] archive-frame-count-badge: home/landing tile shows total public frame count from `/api/network/stats/public_frames` — scope: client · evidence: count node visible on `/` with `data-testid="public-frames-count"`
|
||||
- [ ] route-meta-titles: per-route `document.title` + `meta[name=description]` for the 12 public Vue views - scope: client · evidence: navigating to `/discover` sets `document.title` to "Discover - Caelum"
|
||||
- [ ] static-og-tags: brand-level `og:title` / `og:description` / `og:image` / `twitter:card` in `client/index.html` - scope: client · evidence: `curl http://127.0.0.1:5173/ | grep 'og:title'` returns a match
|
||||
- [ ] robots-txt: ship `client/public/robots.txt` (allow all, link to sitemap) - scope: client · evidence: `curl http://127.0.0.1:5173/robots.txt` returns 200 with `Sitemap:` line
|
||||
- [ ] sitemap-static: generator script `scripts/build-sitemap.mjs` that walks `client/src/router.js` and writes `client/public/sitemap.xml` for public routes - scope: infra · evidence: `node scripts/build-sitemap.mjs && grep '<loc>' client/public/sitemap.xml | wc -l` ≥ 6
|
||||
- [ ] nox-doc-prevnext: prev/next links in NoxDocs.vue derived from the doc index - scope: client · evidence: opening `/nox/docs/parser` shows a "Next →" link to the next doc in order
|
||||
- [ ] healthz-endpoint: `GET /api/healthz` returns `{ ok: true, db: 'up'|'down'|'disabled', version }` - scope: server · evidence: `server/test/healthz.test.js` asserts 200 + shape
|
||||
- [ ] api-tokens-last-used-format: `/api/tokens` response includes `last_used_relative` (e.g. "3h ago") next to the existing ISO timestamp - scope: server · evidence: existing `tokens.test.js` extended with assertion
|
||||
- [ ] archive-frame-count-badge: home/landing tile shows total public frame count from `/api/network/stats/public_frames` - scope: client · evidence: count node visible on `/` with `data-testid="public-frames-count"`
|
||||
|
||||
## Notes for the sweep agent
|
||||
|
||||
- If every item is checked or skipped (e.g. they all touch the disallowed list), record `no candidate` in Section 7 — don't invent one.
|
||||
- If every item is checked or skipped (e.g. they all touch the disallowed list), record `no candidate` in Section 7 - don't invent one.
|
||||
- New items added by humans go at the top.
|
||||
- Do **not** auto-add items to this file from the sweep — only humans curate.
|
||||
- Do **not** auto-add items to this file from the sweep - only humans curate.
|
||||
|
||||
+9
-9
@@ -16,7 +16,7 @@ const route = useRoute();
|
||||
// Auth screens, the public landing, and the public Nox pages all need this.
|
||||
// Routes that always use the full-screen (no-sidebar) layout: auth/marketing/docs
|
||||
// pages, plus the purchase flow (checkout + order) which is a standalone public
|
||||
// funnel. Shop + Shop Catalog are NOT here — for a signed-in user they live
|
||||
// funnel. Shop + Shop Catalog are NOT here - for a signed-in user they live
|
||||
// inside the portal (sidebar). A guest has no sidebar, so the `|| !auth.token`
|
||||
// below renders any portal-eligible page (e.g. the public /shop) full-screen.
|
||||
const FULLSCREEN_ROUTES = new Set(['login', 'register', 'landing', 'nox-docs', 'nox-examples', 'setup', 'status', 'checkout', 'shop-order']);
|
||||
@@ -27,18 +27,18 @@ function logout() {
|
||||
router.push('/');
|
||||
}
|
||||
|
||||
// The sidebar is ordered as the night's lifecycle — the same arc the landing
|
||||
// page tells — instead of by abstract data category. Read top to bottom it's a
|
||||
// The sidebar is ordered as the night's lifecycle - the same arc the landing
|
||||
// page tells - instead of by abstract data category. Read top to bottom it's a
|
||||
// story: an operator opens up their telescope (Your Observatory), someone books
|
||||
// time on it (Plan & Book), the session runs live (pinned above + surfaced in
|
||||
// Tonight), and the data lands in the archive (Archive) — all inside a
|
||||
// Tonight), and the data lands in the archive (Archive) - all inside a
|
||||
// community. Grouping by the *arc* rather than by noun-buckets (Observe / Plan /
|
||||
// Data …) is what makes the nav feel like a flow instead of a pile of pages.
|
||||
// Tonight — what's happening now / next
|
||||
// Your Observatory — open up your telescope: sites, hardware, gear
|
||||
// Plan & Book — request time and prepare the run
|
||||
// Archive — the data that lands
|
||||
// Community — the people around it
|
||||
// Tonight - what's happening now / next
|
||||
// Your Observatory - open up your telescope: sites, hardware, gear
|
||||
// Plan & Book - request time and prepare the run
|
||||
// Archive - the data that lands
|
||||
// Community - the people around it
|
||||
const isAdmin = computed(() => auth.user?.role === 'admin');
|
||||
|
||||
const NAV_GROUPS = [
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
--danger: #f87171;
|
||||
--radius: 8px;
|
||||
|
||||
/* Spacing scale — every gap/padding/margin uses one of these.
|
||||
/* Spacing scale - every gap/padding/margin uses one of these.
|
||||
No ad-hoc 0.625rem / 0.35rem values in views anymore. */
|
||||
--space-1: 0.25rem;
|
||||
--space-2: 0.5rem;
|
||||
@@ -24,7 +24,7 @@
|
||||
--space-5: 1.5rem;
|
||||
--space-6: 2rem;
|
||||
|
||||
/* Type scale — one ladder for the whole app. */
|
||||
/* Type scale - one ladder for the whole app. */
|
||||
--text-xs: 0.75rem;
|
||||
--text-sm: 0.85rem;
|
||||
--text-base: 0.9rem;
|
||||
@@ -33,7 +33,7 @@
|
||||
--text-xl: 1.75rem;
|
||||
--text-2xl: 2rem;
|
||||
|
||||
/* Session/entity state semantics — the single source of truth for the
|
||||
/* Session/entity state semantics - the single source of truth for the
|
||||
four lifecycle colors. `session_state` from the API ('live' |
|
||||
'scheduled' | 'completed' | <raw status>) maps straight onto these so
|
||||
a session looks identical on Schedule, Proposal, Feed and Dashboard. */
|
||||
@@ -177,7 +177,7 @@ a:hover { color: var(--accent-hover); }
|
||||
|
||||
/* Sidebar is a fixed 240px rail. The content area fills the rest. Pages use
|
||||
the full available width (with comfortable responsive padding as the gutter)
|
||||
rather than a narrow centered column — a 1200px cap left big empty margins
|
||||
rather than a narrow centered column - a 1200px cap left big empty margins
|
||||
on wide monitors and made data-dense pages like Messages look awkward and
|
||||
stranded. A high safety cap keeps ultra-wide (4K) lines from getting silly. */
|
||||
.main-content {
|
||||
@@ -199,7 +199,7 @@ a:hover { color: var(--accent-hover); }
|
||||
|
||||
/* One header treatment for every page: title block on the left, optional
|
||||
action(s) on the right. Views no longer hand-roll
|
||||
`style="display:flex;justify-content:space-between"` — drop a heading
|
||||
`style="display:flex;justify-content:space-between"` - drop a heading
|
||||
(+ optional <p> subtitle) and an optional trailing action element and
|
||||
it lays out identically everywhere. */
|
||||
.page-header {
|
||||
@@ -295,7 +295,7 @@ a:hover { color: var(--accent-hover); }
|
||||
.btn-primary { background: var(--accent); color: var(--bg-primary); }
|
||||
/* color is re-asserted on :hover because RouterLink renders an <a>, and the
|
||||
global `a:hover { color: var(--accent-hover) }` (specificity 0,1,1) would
|
||||
otherwise beat `.btn-primary` (0,1,0) — turning the label the same color
|
||||
otherwise beat `.btn-primary` (0,1,0) - turning the label the same color
|
||||
as the hover background, making the text vanish. Same for the variants. */
|
||||
.btn-primary:hover { background: var(--accent-hover); color: var(--bg-primary); }
|
||||
.btn-secondary { background: var(--bg-input); color: var(--text-primary); border-color: var(--border); }
|
||||
@@ -419,7 +419,7 @@ textarea.form-control { resize: vertical; min-height: 80px; }
|
||||
.data-table tbody tr:hover { background: var(--bg-input); }
|
||||
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
|
||||
|
||||
/* Section spacer — consistent vertical rhythm between stacked blocks
|
||||
/* Section spacer - consistent vertical rhythm between stacked blocks
|
||||
on a page (stats strip → table → cards). */
|
||||
.section + .section { margin-top: var(--space-6); }
|
||||
.section-title {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script setup>
|
||||
// Quiet version stamp at the bottom of the sidebar. Just the version + short
|
||||
// commit, so it's clear what's running without a DevTools trip. Deliberately
|
||||
// no hover panel, no health readout, no test buttons — an ops widget there
|
||||
// no hover panel, no health readout, no test buttons - an ops widget there
|
||||
// both read as corporate SaaS and popped up over the Logout button.
|
||||
// Build-time values come from Vite's `define` block (inlined, no runtime cost).
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup>
|
||||
// Caelum Lab — extracted from Research.vue (which had grown past 1600 lines).
|
||||
// Caelum Lab - extracted from Research.vue (which had grown past 1600 lines).
|
||||
//
|
||||
// Self-contained responsibilities:
|
||||
// - Pick a research target + optional archive frames
|
||||
@@ -14,9 +14,9 @@
|
||||
//
|
||||
// Parent contract:
|
||||
// props: targets, telescopesGroupedBySite
|
||||
// emits: atlas-jump({ ra, dec }) — parent owns the atlas tool state
|
||||
// request-telescopes — parent loads + populates the prop
|
||||
// feed-stale — parent reloads /api/research/feed
|
||||
// emits: atlas-jump({ ra, dec }) - parent owns the atlas tool state
|
||||
// request-telescopes - parent loads + populates the prop
|
||||
// feed-stale - parent reloads /api/research/feed
|
||||
//
|
||||
// Anything visible only inside Lab lives here. Anything cross-tab (atlas,
|
||||
// feed, telescope picker source) stays parent-owned and is plumbed via
|
||||
@@ -60,13 +60,13 @@ function targetPayload() {
|
||||
|
||||
// Server-side preferences: did the user (or the bundled .env) supply an
|
||||
// Anthropic key? Lab disables Analyze when false. Server never echoes the
|
||||
// raw key — only a suffix + boolean.
|
||||
// raw key - only a suffix + boolean.
|
||||
const prefs = ref({ has_anthropic_key: false, anthropic_api_key_suffix: null, anthropic_key_source: null });
|
||||
async function loadPrefs() {
|
||||
try { prefs.value = await api.get('/preferences'); } catch { /* defaults are fine */ }
|
||||
}
|
||||
|
||||
// Frames matching the picked target — best-effort by target_name LIKE.
|
||||
// Frames matching the picked target - best-effort by target_name LIKE.
|
||||
// Lazily loaded when the target changes; empty is fine (Claude can analyze
|
||||
// catalog metadata alone).
|
||||
const labFrames = ref([]);
|
||||
@@ -121,7 +121,7 @@ let claudeTimer = null;
|
||||
// can show its own ack instead of a global toast.
|
||||
const copiedFlash = ref(null);
|
||||
|
||||
// When target changes, refetch frames. Empty list is OK — Claude can
|
||||
// When target changes, refetch frames. Empty list is OK - Claude can
|
||||
// analyze a target on its catalog metadata alone.
|
||||
watch(() => claude.value.targetId, async (tid) => {
|
||||
claude.value.frameIds = [];
|
||||
@@ -236,7 +236,7 @@ async function refineAnalysis() {
|
||||
}
|
||||
}
|
||||
|
||||
// "Try another lens" — re-run the same target/frames with a different
|
||||
// "Try another lens" - re-run the same target/frames with a different
|
||||
// template. Saves the user from retyping the question.
|
||||
async function rerunWithTemplate(tplKey) {
|
||||
claude.value.template = tplKey;
|
||||
@@ -398,7 +398,7 @@ onMounted(() => {
|
||||
<div v-if="pinnedTarget" class="muted-line">Analyzing <strong>{{ pinnedTarget.designation }}</strong></div>
|
||||
<label v-else>Target
|
||||
<select v-model="claude.targetId" class="form-control">
|
||||
<option value="">— pick one from the feed —</option>
|
||||
<option value="">- pick one from the feed -</option>
|
||||
<optgroup v-for="cat in ['neo','exoplanet_transit','variable_star','transient','satellite']" :key="cat" :label="cat">
|
||||
<option v-for="t in targets.filter(x => x.category === cat)" :key="t.id" :value="t.id">
|
||||
{{ t.designation }} ({{ t.priority }})
|
||||
@@ -413,7 +413,7 @@ onMounted(() => {
|
||||
<input type="checkbox" :value="f.id" v-model="claude.frameIds" />
|
||||
<span>{{ f.filename }}</span>
|
||||
<span class="muted-line">
|
||||
{{ f.filter || '—' }} · {{ f.exposure_time || '?' }}s · {{ f.date_obs?.slice(0, 10) || '?' }}
|
||||
{{ f.filter || '-' }} · {{ f.exposure_time || '?' }}s · {{ f.date_obs?.slice(0, 10) || '?' }}
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
@@ -519,7 +519,7 @@ onMounted(() => {
|
||||
<RouterLink v-if="savePlanState.saved" :to="`/plans?open=${savePlanState.saved}`" class="btn btn-ghost btn-sm">View plan →</RouterLink>
|
||||
<span v-if="claude.noxPrograms.length > 1" class="batch-controls">
|
||||
<select v-model="batchTelescopeId" class="form-control form-control-sm">
|
||||
<option value="">— schedule all on… —</option>
|
||||
<option value="">- schedule all on… -</option>
|
||||
<optgroup v-for="g in telescopesGroupedBySite" :key="g.site_id" :label="g.site_name + (g.site_experimental ? ' (testing)' : '')">
|
||||
<option v-for="t in g.telescopes" :key="t.id" :value="t.id">{{ t.label }}</option>
|
||||
</optgroup>
|
||||
@@ -558,7 +558,7 @@ onMounted(() => {
|
||||
<li v-for="(d, di) in noxScheduleState[idx].diagnostics" :key="di">
|
||||
<strong v-if="d.severity">{{ d.severity }}:</strong>
|
||||
{{ d.message }}
|
||||
<em v-if="d.suggest"> — suggest: {{ d.suggest }}</em>
|
||||
<em v-if="d.suggest"> - suggest: {{ d.suggest }}</em>
|
||||
</li>
|
||||
</ul>
|
||||
</details>
|
||||
@@ -567,7 +567,7 @@ onMounted(() => {
|
||||
|
||||
<div class="nox-prog-controls" v-if="noxScheduleState[idx]">
|
||||
<select v-model="noxScheduleState[idx].telescopeId" class="form-control form-control-sm">
|
||||
<option value="">— pick a telescope —</option>
|
||||
<option value="">- pick a telescope -</option>
|
||||
<optgroup v-for="g in telescopesGroupedBySite" :key="g.site_id" :label="g.site_name + (g.site_experimental ? ' (testing)' : '')">
|
||||
<option v-for="t in g.telescopes" :key="t.id" :value="t.id">{{ t.label }}</option>
|
||||
</optgroup>
|
||||
@@ -582,7 +582,7 @@ onMounted(() => {
|
||||
</div>
|
||||
<div v-if="noxScheduleState[idx]?.error" class="error-msg">{{ noxScheduleState[idx].error }}</div>
|
||||
<div v-else-if="noxScheduleState[idx]?.scheduled" class="muted-line">
|
||||
✓ Observation queued — daemon will pick it up at the next poll
|
||||
✓ Observation queued - daemon will pick it up at the next poll
|
||||
(id: <code>{{ noxScheduleState[idx].scheduled }}</code>).
|
||||
</div>
|
||||
</div>
|
||||
@@ -650,7 +650,7 @@ onMounted(() => {
|
||||
.refine-row input { flex: 1; }
|
||||
|
||||
/* Nox-extracted-from-response action panel. Mirrors the per-card schedule
|
||||
flow — same POST /api/observations, same daemon pickup. */
|
||||
flow - same POST /api/observations, same daemon pickup. */
|
||||
.nox-actions { margin-top: 1rem; padding: 0.75rem 1rem; background: var(--bg-card); border-radius: 6px; border: 1px solid var(--accent); }
|
||||
.nox-actions-head { font-size: 0.85rem; color: var(--accent); margin-bottom: 0.6rem; font-weight: 500; display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
|
||||
.nox-prog-card { padding: 0.6rem; background: var(--bg-elevated); border-radius: 4px; margin-bottom: 0.5rem; }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script setup>
|
||||
// Observation cadence for one object: its frames over time, laned by filter,
|
||||
// markers sized by exposure. Pure-local (no photometry) — it answers "when,
|
||||
// markers sized by exposure. Pure-local (no photometry) - it answers "when,
|
||||
// how often, and how well have we captured this?", the honest coverage view.
|
||||
// SVG, tokens only.
|
||||
import { computed } from 'vue';
|
||||
@@ -9,7 +9,7 @@ const props = defineProps({
|
||||
frames: { type: Array, default: () => [] },
|
||||
});
|
||||
|
||||
// Cycle a small token palette across filters — DESIGN.md forbids hardcoded hex.
|
||||
// Cycle a small token palette across filters - DESIGN.md forbids hardcoded hex.
|
||||
const LANE_VARS = ['--accent', '--success', '--warning', '--danger', '--text-secondary'];
|
||||
|
||||
const W = 720, H_LANE = 26, PAD_L = 64, PAD_R = 16, PAD_T = 10, PAD_B = 22;
|
||||
@@ -21,7 +21,7 @@ const model = computed(() => {
|
||||
.filter(f => isFinite(f.t));
|
||||
if (!usable.length) return null;
|
||||
|
||||
const lanes = [...new Set(usable.map(f => f.filter || '—'))];
|
||||
const lanes = [...new Set(usable.map(f => f.filter || '-'))];
|
||||
const laneIndex = Object.fromEntries(lanes.map((l, i) => [l, i]));
|
||||
let tMin = Math.min(...usable.map(f => f.t));
|
||||
let tMax = Math.max(...usable.map(f => f.t));
|
||||
@@ -30,13 +30,13 @@ const model = computed(() => {
|
||||
const expMax = Math.max(...usable.map(f => Number(f.exposure_time) || 0), 1);
|
||||
const plotW = W - PAD_L - PAD_R;
|
||||
const x = t => PAD_L + ((t - tMin) / (tMax - tMin)) * plotW;
|
||||
const y = filter => PAD_T + laneIndex[filter || '—'] * H_LANE + H_LANE / 2;
|
||||
const y = filter => PAD_T + laneIndex[filter || '-'] * H_LANE + H_LANE / 2;
|
||||
const r = exp => 2 + Math.sqrt((Number(exp) || 0) / expMax) * 5;
|
||||
|
||||
const marks = usable.map(f => ({
|
||||
cx: x(f.t), cy: y(f.filter), r: r(f.exposure_time),
|
||||
color: `var(${LANE_VARS[laneIndex[f.filter || '—'] % LANE_VARS.length]})`,
|
||||
title: `${f.target_name || ''} · ${f.filter || '—'} · ${f.exposure_time || '?'}s · ${(f.date_obs || '').slice(0, 10)}${f.fwhm_arcsec != null ? ` · FWHM ${Number(f.fwhm_arcsec).toFixed(1)}"` : ''}`,
|
||||
color: `var(${LANE_VARS[laneIndex[f.filter || '-'] % LANE_VARS.length]})`,
|
||||
title: `${f.target_name || ''} · ${f.filter || '-'} · ${f.exposure_time || '?'}s · ${(f.date_obs || '').slice(0, 10)}${f.fwhm_arcsec != null ? ` · FWHM ${Number(f.fwhm_arcsec).toFixed(1)}"` : ''}`,
|
||||
}));
|
||||
|
||||
const height = PAD_T + lanes.length * H_LANE + PAD_B;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script setup>
|
||||
// In-app "buy me a coffee". The supporter picks an amount here and pays here:
|
||||
// the card step is Stripe's Embedded Checkout, mounted inside this modal, so
|
||||
// they never leave Caelum. Card fields live in Stripe's own iframe — this app
|
||||
// they never leave Caelum. Card fields live in Stripe's own iframe - this app
|
||||
// never sees or handles them.
|
||||
//
|
||||
// Falls back to a plain hosted payment link when the server reports Stripe is
|
||||
@@ -50,7 +50,7 @@ const bounds = computed(() => ({
|
||||
}));
|
||||
|
||||
// Mirrors the server's rule so the user gets instant feedback; the server
|
||||
// re-validates regardless — this is UX, not a security control.
|
||||
// re-validates regardless - this is UX, not a security control.
|
||||
const validationError = computed(() => {
|
||||
const a = amountCents.value;
|
||||
if (a == null) return 'Enter an amount.';
|
||||
@@ -136,7 +136,7 @@ async function proceed() {
|
||||
|
||||
<p v-if="stage === 'amount'" class="sp-lede">
|
||||
Caelum is free and open source. A one-off contribution goes toward hosting
|
||||
and development — thank you.
|
||||
and development - thank you.
|
||||
</p>
|
||||
|
||||
<template v-if="config?.enabled">
|
||||
@@ -164,9 +164,9 @@ async function proceed() {
|
||||
<button class="btn btn-primary sp-go" :disabled="!canSubmit" @click="proceed">
|
||||
{{ busy ? 'Preparing…'
|
||||
: validationError && selected === null ? validationError
|
||||
: `Continue — ${amountCents != null && !validationError ? money(amountCents) : ''}` }}
|
||||
: `Continue - ${amountCents != null && !validationError ? money(amountCents) : ''}` }}
|
||||
</button>
|
||||
<p class="sp-fine">Card details go straight to Stripe — Caelum never sees them.</p>
|
||||
<p class="sp-fine">Card details go straight to Stripe - Caelum never sees them.</p>
|
||||
</template>
|
||||
|
||||
<!-- Step 2: pay, using Stripe's embedded card form mounted right here -->
|
||||
@@ -181,7 +181,7 @@ async function proceed() {
|
||||
send them to the hosted link rather than showing a dead picker. -->
|
||||
<template v-else>
|
||||
<p class="sp-fine sp-fallback-note">
|
||||
Choosing an amount here isn't available on this deploy — you can still
|
||||
Choosing an amount here isn't available on this deploy - you can still
|
||||
contribute through our Stripe page.
|
||||
</p>
|
||||
<a class="btn btn-primary sp-go" :href="config?.fallbackUrl" target="_blank" rel="noopener">
|
||||
|
||||
@@ -62,7 +62,7 @@ const seeingColor = s => s == null ? 'var(--text-muted)' : s < 1.5 ? '#4ade80' :
|
||||
<div v-else class="weather-grid">
|
||||
<div class="metric">
|
||||
<div class="label">Seeing</div>
|
||||
<div class="value" :style="{ color: seeingColor(latest.seeing_arcsec) }">{{ latest.seeing_arcsec?.toFixed(2) ?? '—' }}″</div>
|
||||
<div class="value" :style="{ color: seeingColor(latest.seeing_arcsec) }">{{ latest.seeing_arcsec?.toFixed(2) ?? '-' }}″</div>
|
||||
<svg viewBox="0 0 100 30" class="spark"><polyline :points="sparkPoints('seeing_arcsec')" fill="none" stroke="currentColor" stroke-width="1.2" :style="{ color: seeingColor(latest.seeing_arcsec) }"/></svg>
|
||||
</div>
|
||||
<div class="metric">
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ initAppearance();
|
||||
// Boot banner so the active environment is obvious in DevTools.
|
||||
// import.meta.env.MODE is 'development' under `vite dev` and 'production'
|
||||
// for built bundles served from server.js. Vite inlines this at build time.
|
||||
log.info(`[caelum] client boot — environment: ${import.meta.env.MODE}`);
|
||||
log.info(`[caelum] client boot - environment: ${import.meta.env.MODE}`);
|
||||
|
||||
const app = createApp(App);
|
||||
initSentry(app, router);
|
||||
|
||||
@@ -4,7 +4,7 @@ import { useAuthStore } from './stores/auth.js';
|
||||
const SITE_NAME = 'Caelum';
|
||||
|
||||
const routes = [
|
||||
{ path: '/', name: 'landing', component: () => import('./views/Landing.vue'), meta: { guest: true, title: 'Caelum — Federated Observatory Network', description: 'A shared observatory network for scheduling and controlling remote telescopes. Ships with the Nox typed DSL for telescope control.' } },
|
||||
{ path: '/', name: 'landing', component: () => import('./views/Landing.vue'), meta: { guest: true, title: 'Caelum - Federated Observatory Network', description: 'A shared observatory network for scheduling and controlling remote telescopes. Ships with the Nox typed DSL for telescope control.' } },
|
||||
{ path: '/login', name: 'login', component: () => import('./views/Login.vue'), meta: { guest: true, title: 'Sign in' } },
|
||||
{ path: '/register', name: 'register', component: () => import('./views/Register.vue'), meta: { guest: true, title: 'Create an account' } },
|
||||
{ path: '/dashboard', name: 'dashboard', component: () => import('./views/Dashboard.vue'), meta: { title: 'Dashboard' } },
|
||||
@@ -31,10 +31,10 @@ const routes = [
|
||||
{ path: '/object/:name', name: 'object', component: () => import('./views/ObjectDossier.vue'), props: true, meta: { title: 'Object' } },
|
||||
{ path: '/session/:bookingId', name: 'session', component: () => import('./views/Session.vue'), props: true, meta: { title: 'Live session' } },
|
||||
{ path: '/nox', name: 'nox', component: () => import('./views/Nox.vue'), meta: { title: 'Nox IDE' } },
|
||||
{ path: '/nox/docs', name: 'nox-docs', component: () => import('./views/NoxDocs.vue'), meta: { guest: true, title: 'Nox — Reference', description: 'Reference documentation for Nox, the typed DSL for telescope and dome control with first-class units, frames, and structured concurrency.' } },
|
||||
{ path: '/nox/examples', name: 'nox-examples', component: () => import('./views/NoxExamples.vue'), meta: { guest: true, title: 'Nox — Examples', description: 'Runnable Nox programs — slews, focus runs, dithered imaging, automated nights, calibration, and policy-driven safety.' } },
|
||||
{ path: '/setup', name: 'setup', component: () => import('./views/Setup.vue'), meta: { guest: true, title: 'Setup', description: 'Connect your telescope to the Caelum network — pick your imaging goals and how hands-on you want to be, then get a tailored setup path.' } },
|
||||
{ path: '/shop', name: 'shop', component: () => import('./views/Shop.vue'), meta: { guest: true, title: 'Shop', description: 'Telescopes, mounts, cameras and accessories matched to your observatory — buy the gear to get on the network.' } },
|
||||
{ path: '/nox/docs', name: 'nox-docs', component: () => import('./views/NoxDocs.vue'), meta: { guest: true, title: 'Nox - Reference', description: 'Reference documentation for Nox, the typed DSL for telescope and dome control with first-class units, frames, and structured concurrency.' } },
|
||||
{ path: '/nox/examples', name: 'nox-examples', component: () => import('./views/NoxExamples.vue'), meta: { guest: true, title: 'Nox - Examples', description: 'Runnable Nox programs - slews, focus runs, dithered imaging, automated nights, calibration, and policy-driven safety.' } },
|
||||
{ path: '/setup', name: 'setup', component: () => import('./views/Setup.vue'), meta: { guest: true, title: 'Setup', description: 'Connect your telescope to the Caelum network - pick your imaging goals and how hands-on you want to be, then get a tailored setup path.' } },
|
||||
{ path: '/shop', name: 'shop', component: () => import('./views/Shop.vue'), meta: { guest: true, title: 'Shop', description: 'Telescopes, mounts, cameras and accessories matched to your observatory - buy the gear to get on the network.' } },
|
||||
{ path: '/checkout', name: 'checkout', component: () => import('./views/Checkout.vue'), meta: { guest: true, title: 'Checkout' } },
|
||||
{ path: '/shop/order/:id', name: 'shop-order', component: () => import('./views/Order.vue'), props: true, meta: { title: 'Order' } },
|
||||
{ path: '/shop/admin', name: 'shop-admin', component: () => import('./views/ShopAdmin.vue'), meta: { title: 'Shop catalog' } },
|
||||
@@ -48,12 +48,12 @@ const router = createRouter({ history: createWebHistory(), routes });
|
||||
//
|
||||
// 'nox' belongs here: the landing sells "Try Nox without signing up" and
|
||||
// Examples has an "Open in Console" button, but /nox required a token, so a
|
||||
// guest following that path was bounced to the landing — and the example the
|
||||
// guest following that path was bounced to the landing - and the example the
|
||||
// button had just written to localStorage was silently dropped. The server
|
||||
// already treats mock runs as public on purpose (see requireRealModeSafety in
|
||||
// routes/nox.js: /nox/check, /nox/examples and mock /nox/run take no auth,
|
||||
// while real mode demands both auth and an explicit confirmation), so the IDE
|
||||
// itself is safe to expose — the driver-touching path is gated server-side.
|
||||
// itself is safe to expose - the driver-touching path is gated server-side.
|
||||
const ALWAYS_PUBLIC = new Set(['nox', 'nox-docs', 'nox-examples', 'setup', 'status', 'shop', 'checkout']);
|
||||
|
||||
router.beforeEach((to) => {
|
||||
@@ -64,13 +64,13 @@ router.beforeEach((to) => {
|
||||
});
|
||||
|
||||
// Per-route titles. The bare landing title is the full marketing string;
|
||||
// every other view gets "<page> — Caelum". SPA crawlers (and humans glancing
|
||||
// every other view gets "<page> - Caelum". SPA crawlers (and humans glancing
|
||||
// at tabs) now see distinct titles instead of one homepage label everywhere.
|
||||
router.afterEach((to) => {
|
||||
const t = to.meta?.title;
|
||||
if (typeof document === 'undefined') return;
|
||||
if (!t) { document.title = SITE_NAME; return; }
|
||||
document.title = to.name === 'landing' ? t : `${t} — ${SITE_NAME}`;
|
||||
document.title = to.name === 'landing' ? t : `${t} - ${SITE_NAME}`;
|
||||
const d = to.meta?.description;
|
||||
if (d) {
|
||||
let tag = document.querySelector('meta[name="description"]');
|
||||
|
||||
@@ -45,7 +45,7 @@ export function initSentry(app, router) {
|
||||
* callers can grep the Sentry UI for it.
|
||||
*/
|
||||
/**
|
||||
* Tag subsequent Sentry events with the authed user — id + username + role
|
||||
* Tag subsequent Sentry events with the authed user - id + username + role
|
||||
* only, never email or password. Called from the auth store on login,
|
||||
* register, and refresh. clearSentryUser() reverses it on logout.
|
||||
*
|
||||
@@ -72,6 +72,6 @@ export function sendTestEvent(label = 'caelum-sentry-test') {
|
||||
const env = client.getOptions?.()?.environment;
|
||||
const tag = `${label} @ ${env} @ ${new Date().toISOString()}`;
|
||||
const msgId = Sentry.captureMessage(tag, 'info');
|
||||
const errId = Sentry.captureException(new Error(`${tag} — test exception`));
|
||||
const errId = Sentry.captureException(new Error(`${tag} - test exception`));
|
||||
return { sent: true, environment: env, messageEventId: msgId, exceptionEventId: errId };
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Agena Astro affiliate (Refersion). The key is appended to outbound
|
||||
// agenaastro.com links at render time so clicks are attributed, WITHOUT baking
|
||||
// it into the stored product `source_url` — that column is the shop's upsert
|
||||
// it into the stored product `source_url` - that column is the shop's upsert
|
||||
// idempotency key and Stripe-match key (see server/src/seed-shop.js), so it
|
||||
// must stay canonical.
|
||||
const RFSN = '9156858.e7731ab';
|
||||
|
||||
@@ -8,13 +8,13 @@ function getToken() {
|
||||
//
|
||||
// Defensive against three classes of failure the old version surfaced as
|
||||
// opaque crashes:
|
||||
// 1. Network errors (server down, DNS, CORS preflight) — fetch rejects
|
||||
// 1. Network errors (server down, DNS, CORS preflight) - fetch rejects
|
||||
// without producing a Response. Surface as "Network error talking to <path>".
|
||||
// 2. Empty bodies (proxy returns 500 with no payload) — res.json() throws
|
||||
// 2. Empty bodies (proxy returns 500 with no payload) - res.json() throws
|
||||
// "Unexpected end of JSON input" in Chrome and the much worse
|
||||
// "The string did not match the expected pattern" in Safari. We
|
||||
// read text first and fall back gracefully.
|
||||
// 3. Non-JSON bodies (proxy returns HTML 502, plain text 500) — same
|
||||
// 3. Non-JSON bodies (proxy returns HTML 502, plain text 500) - same
|
||||
// treatment. We return a sensible HTTP <status> message instead of
|
||||
// letting JSON.parse crash.
|
||||
async function request(path, options = {}) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// Applies the user's theme + density preferences to the document. These used
|
||||
// to be saved to the server and then ignored — the toggles in /settings did
|
||||
// to be saved to the server and then ignored - the toggles in /settings did
|
||||
// nothing visible. This is the missing half: it reflects the prefs onto
|
||||
// <html data-theme data-density>, which the CSS in style.css keys off.
|
||||
//
|
||||
|
||||
@@ -2,7 +2,7 @@ import { defineStore } from 'pinia';
|
||||
|
||||
// Build-a-list cart for the shop surfaced in the Setup Wizard. Persisted to
|
||||
// localStorage so it survives navigation and refresh. Caelum doesn't sell gear
|
||||
// directly — checkout hands the list off to Agena Astro (our affiliate
|
||||
// directly - checkout hands the list off to Agena Astro (our affiliate
|
||||
// retailer), so each item keeps its `source_url` to deep-link there. Prices are
|
||||
// a DISPLAY-only snapshot for a rough running total; Agena has live pricing.
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// Each call writes to the matching native console method so DevTools still
|
||||
// shows everything. ALL five levels (debug, info, warning, error, fatal)
|
||||
// forward to Sentry as events when VITE_ENABLE_SENTRY is truthy and sentry.js
|
||||
// was initialised. Capturing info/debug is high-volume — disable with
|
||||
// was initialised. Capturing info/debug is high-volume - disable with
|
||||
// VITE_ENABLE_SENTRY=false where that's too noisy.
|
||||
//
|
||||
// Defaults: enabled in prod builds, disabled in `vite dev` (override with
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// Single source of truth for lifecycle / session state presentation.
|
||||
//
|
||||
// The API exposes two state vocabularies:
|
||||
// • booking session_state — 'live' | 'scheduled' | 'completed' | raw status
|
||||
// • request-group state — PENDING | SCHEDULED | IN_PROGRESS | COMPLETED |
|
||||
// • booking session_state - 'live' | 'scheduled' | 'completed' | raw status
|
||||
// • request-group state - PENDING | SCHEDULED | IN_PROGRESS | COMPLETED |
|
||||
// FAILED | CANCELED
|
||||
//
|
||||
// Both normalize onto ONE set of pill classes so a session/group reads
|
||||
|
||||
@@ -43,7 +43,7 @@ async function search() {
|
||||
if (filters.value.frame_type) params.set('frame_type', filters.value.frame_type);
|
||||
if (filters.value.tag) params.set('tag', filters.value.tag);
|
||||
// The network-wide public firehose lives on Activity now, not as a tab
|
||||
// here — Archive is your own frames plus targeted search. See DESIGN.md
|
||||
// here - Archive is your own frames plus targeted search. See DESIGN.md
|
||||
// "one home per surface".
|
||||
if (activeTab.value === 'bookmarks') params.set('bookmarked', '1');
|
||||
else if (filters.value.visibility) params.set('visibility', filters.value.visibility);
|
||||
@@ -518,7 +518,7 @@ const networkCount = computed(() => frames.value.filter(f => f.visibility === 'n
|
||||
<label>FITS File *</label>
|
||||
<input type="file" accept=".fits,.fit,.fz" class="form-control" @change="onFileSelected" required />
|
||||
<small v-if="uploadFile" style="color:var(--text-muted);font-size:0.75rem">
|
||||
{{ uploadFile.name }} ({{ (uploadFile.size / 1048576).toFixed(2) }} MB) — headers will be auto-parsed
|
||||
{{ uploadFile.name }} ({{ (uploadFile.size / 1048576).toFixed(2) }} MB) - headers will be auto-parsed
|
||||
</small>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
|
||||
@@ -77,7 +77,7 @@ const subtotal = computed(() => cart.subtotal);
|
||||
<h2>Summary</h2>
|
||||
<div class="srow"><span>Items</span><span>{{ cart.count }}</span></div>
|
||||
<div class="srow total"><span>Est. subtotal</span><span>{{ formatMoney(subtotal, cart.currency) }}</span></div>
|
||||
<p class="note">Estimated from a snapshot — Agena shows live pricing at checkout.</p>
|
||||
<p class="note">Estimated from a snapshot - Agena shows live pricing at checkout.</p>
|
||||
|
||||
<button class="primary-btn wide" @click="openAll">Open all at Agena ↗</button>
|
||||
<a class="ghost-btn wide" :href="AGENA_HOME" target="_blank" rel="noopener">Browse Agena Astro</a>
|
||||
@@ -85,7 +85,7 @@ const subtotal = computed(() => cart.subtotal);
|
||||
|
||||
<p class="fineprint">
|
||||
Each item opens on Agena Astro in a new tab. As an Agena affiliate, Caelum may earn a
|
||||
commission on purchases — at no extra cost to you.
|
||||
commission on purchases - at no extra cost to you.
|
||||
</p>
|
||||
</aside>
|
||||
</div>
|
||||
|
||||
@@ -8,7 +8,7 @@ import { pillClass, pillLabel } from '../utils/state.js';
|
||||
const auth = useAuthStore();
|
||||
|
||||
// The dashboard is "Tonight": it reads down the same arc the landing tells and
|
||||
// the sidebar follows — your observatory → what's booked → what's live → the
|
||||
// the sidebar follows - your observatory → what's booked → what's live → the
|
||||
// data that lands. Each section is a window into one lifecycle beat and links
|
||||
// to its full page; the dashboard itself owns nothing, it orients you.
|
||||
const sites = ref([]);
|
||||
@@ -35,7 +35,7 @@ onMounted(async () => {
|
||||
|
||||
// "Your observatory" means the sites you actually run. GET /sites also returns
|
||||
// every network-visible site, so counting all of them would put other people's
|
||||
// observatories under "your night" — and hide the getting-started path from a
|
||||
// observatories under "your night" - and hide the getting-started path from a
|
||||
// brand-new user who owns nothing. Scope to owner_id.
|
||||
const mySites = computed(() => sites.value.filter(s => s.owner_id === auth.user?.id));
|
||||
const onlineCount = computed(() => mySites.value.filter(s => s.status === 'online').length);
|
||||
@@ -54,7 +54,7 @@ const upcomingBookings = computed(() =>
|
||||
// A brand-new account has nothing of its own to roll up. Rather than cards that
|
||||
// say "Your observatory" over strangers' sites, show the same four-step path
|
||||
// the landing describes, each step a live link. Keyed off things that are
|
||||
// genuinely yours — owned sites, your bookings, your proposals.
|
||||
// genuinely yours - owned sites, your bookings, your proposals.
|
||||
const isNewUser = computed(() =>
|
||||
!loading.value && !mySites.value.length && !bookings.value.length && !proposals.value.length,
|
||||
);
|
||||
@@ -121,7 +121,7 @@ function formatDate(iso) {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Run — a session happening right now gets the top slot. -->
|
||||
<!-- Run - a session happening right now gets the top slot. -->
|
||||
<div v-if="liveSessions.length" class="card card-live" style="margin-bottom:1.5rem">
|
||||
<div class="card-header">
|
||||
<h3><span class="live-dot" aria-hidden="true"></span> Live now</h3>
|
||||
@@ -136,7 +136,7 @@ function formatDate(iso) {
|
||||
</div>
|
||||
|
||||
<div class="grid grid-2">
|
||||
<!-- Your Observatory — "open up your telescope" -->
|
||||
<!-- Your Observatory - "open up your telescope" -->
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3>Your observatory</h3>
|
||||
@@ -157,7 +157,7 @@ function formatDate(iso) {
|
||||
</RouterLink>
|
||||
</div>
|
||||
|
||||
<!-- Book — upcoming sessions -->
|
||||
<!-- Book - upcoming sessions -->
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3>Booked & upcoming</h3>
|
||||
@@ -180,7 +180,7 @@ function formatDate(iso) {
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- Plan — proposals -->
|
||||
<!-- Plan - proposals -->
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3>Your proposals</h3>
|
||||
@@ -201,7 +201,7 @@ function formatDate(iso) {
|
||||
</RouterLink>
|
||||
</div>
|
||||
|
||||
<!-- Archive — "the data that lands" -->
|
||||
<!-- Archive - "the data that lands" -->
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3>Recent data</h3>
|
||||
@@ -215,7 +215,7 @@ function formatDate(iso) {
|
||||
<span><strong>{{ f.target_name || 'Unknown' }}</strong> <span class="dash-code">{{ f.filter || '' }}</span></span>
|
||||
<span class="dash-code">{{ f.telescope_name }}</span>
|
||||
</div>
|
||||
<div class="dash-frame-meta">{{ f.filename }} · {{ f.exposure_time }}s · FWHM {{ f.fwhm_arcsec != null ? f.fwhm_arcsec.toFixed(2) : '—' }}"</div>
|
||||
<div class="dash-frame-meta">{{ f.filename }} · {{ f.exposure_time }}s · FWHM {{ f.fwhm_arcsec != null ? f.fwhm_arcsec.toFixed(2) : '-' }}"</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -235,7 +235,7 @@ function formatDate(iso) {
|
||||
}
|
||||
.stat-sub { font-size: 0.8rem; color: var(--text-muted); }
|
||||
|
||||
/* One row style for every dashboard list — sites, sessions, proposals. */
|
||||
/* One row style for every dashboard list - sites, sessions, proposals. */
|
||||
.dash-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -262,7 +262,7 @@ function formatDate(iso) {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
/* Getting-started path — mirrors the landing's four steps. */
|
||||
/* Getting-started path - mirrors the landing's four steps. */
|
||||
.gs-steps { list-style: none; display: grid; gap: 1rem; }
|
||||
.gs-step { display: grid; grid-template-columns: auto 1fr; gap: 0.75rem; align-items: start; }
|
||||
.gs-num {
|
||||
|
||||
@@ -140,7 +140,7 @@ function fmtRaDec(row) {
|
||||
const live = state.value[row.id];
|
||||
const ra = live?.live?.ra ?? row.current_ra;
|
||||
const dec = live?.live?.dec ?? row.current_dec;
|
||||
if (ra == null || dec == null) return '—';
|
||||
if (ra == null || dec == null) return '-';
|
||||
return `RA ${Number(ra).toFixed(3)}h · Dec ${Number(dec).toFixed(2)}°`;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,11 +14,11 @@ const router = useRouter();
|
||||
const showSupport = ref(false);
|
||||
|
||||
// Aggregate public counts, loaded best-effort. Non-PII, so the endpoint is
|
||||
// unauthenticated. Failure is silent — the tiles show a dash.
|
||||
// unauthenticated. Failure is silent - the tiles show a dash.
|
||||
//
|
||||
// This page deliberately renders NO individual network records. It used to
|
||||
// list recent frames and sessions by name, which meant the marketing page was
|
||||
// showing whatever happened to be in the database — on a seeded deploy that is
|
||||
// showing whatever happened to be in the database - on a seeded deploy that is
|
||||
// invented observatories and targets presented to visitors as a live network.
|
||||
// The section below describes how the network works instead of dressing up
|
||||
// sample rows as evidence.
|
||||
@@ -352,7 +352,7 @@ function goToNox() {
|
||||
dead space between them. Content-sized columns inside a bounded,
|
||||
centred band cannot drift apart, at any width.
|
||||
|
||||
Density over whitespace, per DESIGN.md. Tokens only — no raw hex,
|
||||
Density over whitespace, per DESIGN.md. Tokens only - no raw hex,
|
||||
no ad-hoc spacing.
|
||||
──────────────────────────────────────────────────────────────── */
|
||||
.landing {
|
||||
@@ -460,7 +460,7 @@ function goToNox() {
|
||||
margin-bottom: var(--space-6);
|
||||
}
|
||||
|
||||
/* Stat strip — reads as instrumentation, not marketing. */
|
||||
/* Stat strip - reads as instrumentation, not marketing. */
|
||||
.lp-stats {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
@@ -468,7 +468,7 @@ function goToNox() {
|
||||
max-width: 520px;
|
||||
}
|
||||
/* Column + space-between so the value sits on the tile's baseline even when
|
||||
a neighbour's label wraps to two lines — otherwise "Public frames" wrapping
|
||||
a neighbour's label wraps to two lines - otherwise "Public frames" wrapping
|
||||
drops its number ~19px below the others on narrow screens. */
|
||||
.lp-stat {
|
||||
display: flex;
|
||||
@@ -576,8 +576,8 @@ function goToNox() {
|
||||
}
|
||||
|
||||
/* The four stages of a night, as a 2x2. Not 4-up: that squeezed each body to
|
||||
a ~248px column — around 30 characters a line, less than half a readable
|
||||
measure — and turned four paragraphs into thin ribbons. Two columns give
|
||||
a ~248px column - around 30 characters a line, less than half a readable
|
||||
measure - and turned four paragraphs into thin ribbons. Two columns give
|
||||
each stage ~570px while still filling the band. Static copy: nothing here
|
||||
depends on what's in the database. */
|
||||
.lp-night {
|
||||
@@ -748,7 +748,7 @@ function goToNox() {
|
||||
.lp-features { grid-template-columns: minmax(0, 1fr); }
|
||||
.lp-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2); }
|
||||
.lp-stat { padding: var(--space-2); }
|
||||
/* A ~109px tile can't hold "OBSERVATORIES" in tracked-out uppercase — it
|
||||
/* A ~109px tile can't hold "OBSERVATORIES" in tracked-out uppercase - it
|
||||
needs 106px of an available 91 and spills. It's one word, so it can't
|
||||
wrap; drop the transform and tracking here rather than inventing a
|
||||
font size below the --text-xs token. */
|
||||
|
||||
@@ -31,9 +31,9 @@ function rowLabel(metric, r) {
|
||||
if (metric === 'users') return { primary: '@' + r.username, secondary: `${r.role} · joined ${r.created_at}` };
|
||||
if (metric === 'observatories') return { primary: r.name + ' (' + r.code + ')', secondary: `${r.visibility} · by @${r.owner} · ${r.status}` };
|
||||
if (metric === 'telescopes') return { primary: r.name, secondary: `${r.aperture_mm}mm · ${r.mount_type} · ${r.site_name}` };
|
||||
if (metric === 'public_frames') return { primary: r.target_name || 'untitled', secondary: `${r.filter || '—'} · ${r.exposure_time}s · by @${r.uploader} · ${r.telescope}` };
|
||||
if (metric === 'public_frames') return { primary: r.target_name || 'untitled', secondary: `${r.filter || '-'} · ${r.exposure_time}s · by @${r.uploader} · ${r.telescope}` };
|
||||
if (metric === 'sessions') return { primary: r.title || 'session', secondary: `${r.telescope_name} @ ${r.site_name} · @${r.host} · ${new Date(r.start_time).toLocaleString()}` };
|
||||
if (metric === 'total_integration_minutes') return { primary: `${r.minutes} min`, secondary: `${r.target_name || '?'} · ${r.filter || '—'} · ${r.exposure_count}×${r.exposure_time}s · by @${r.by_user}` };
|
||||
if (metric === 'total_integration_minutes') return { primary: `${r.minutes} min`, secondary: `${r.target_name || '?'} · ${r.filter || '-'} · ${r.exposure_count}×${r.exposure_time}s · by @${r.by_user}` };
|
||||
return { primary: JSON.stringify(r), secondary: '' };
|
||||
}
|
||||
|
||||
|
||||
@@ -181,7 +181,7 @@ onUnmounted(() => {
|
||||
watch([tabs, activeTabId], persist, { deep: true });
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Resource readiness strip — when Mode = Real hardware, parse the
|
||||
// Resource readiness strip - when Mode = Real hardware, parse the
|
||||
// program's `use telescope/dome NAME = "VALUE"` statements, resolve
|
||||
// each VALUE against configured hardware, and surface reachability so
|
||||
// the operator knows the program will hit real gear before Run.
|
||||
@@ -436,7 +436,7 @@ async function openHardwareWizard() {
|
||||
hwTelescopes.value = tels;
|
||||
hwEnclosures.value = encs;
|
||||
} catch {
|
||||
// Listing is optional — the wizard still works for discovery alone.
|
||||
// Listing is optional - the wizard still works for discovery alone.
|
||||
hwTelescopes.value = [];
|
||||
hwEnclosures.value = [];
|
||||
}
|
||||
@@ -475,7 +475,7 @@ function deviceKey(dev) {
|
||||
|
||||
function isAttachable(dev) {
|
||||
// Today we wire telescopes and domes. Cameras/focusers/filter wheels are
|
||||
// attached via the instruments table — a follow-up if needed.
|
||||
// attached via the instruments table - a follow-up if needed.
|
||||
const t = String(dev.DeviceType || '').toLowerCase();
|
||||
return t === 'telescope' || t === 'dome';
|
||||
}
|
||||
@@ -998,7 +998,7 @@ function relTime(ms) {
|
||||
<td><code>{{ dev.DeviceType }}</code></td>
|
||||
<td>
|
||||
<select v-if="isAttachable(dev)" v-model="hwAttachMap[deviceKey(dev)]" class="form-control">
|
||||
<option value="">— pick a Caelum row —</option>
|
||||
<option value="">- pick a Caelum row -</option>
|
||||
<option v-for="row in caelumOptionsFor(dev)" :key="row.id" :value="row.id">{{ row.name }}</option>
|
||||
</select>
|
||||
<span v-else class="hw-skip">not yet supported in the wizard</span>
|
||||
@@ -1173,7 +1173,7 @@ function relTime(ms) {
|
||||
font-family: ui-monospace, monospace;
|
||||
}
|
||||
|
||||
/* body: editor + output, no internal sidebar — discovery happens through
|
||||
/* body: editor + output, no internal sidebar - discovery happens through
|
||||
the page header (example picker) and the dedicated /nox/examples and
|
||||
/nox/docs routes, so we don't double-up on left chrome with the Caelum
|
||||
global sidebar. */
|
||||
@@ -1424,7 +1424,7 @@ function relTime(ms) {
|
||||
}
|
||||
.diags .diag-link:hover { text-decoration: underline; }
|
||||
|
||||
/* status row — slim, no shouting */
|
||||
/* status row - slim, no shouting */
|
||||
.statusbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
@@ -9,7 +9,7 @@ const selected = ref('');
|
||||
const loading = ref(true);
|
||||
const error = ref('');
|
||||
|
||||
// Inline-run state. Public, no-auth — uses /api/nox/run-stream in mock mode.
|
||||
// Inline-run state. Public, no-auth - uses /api/nox/run-stream in mock mode.
|
||||
const ops = ref([]);
|
||||
const runError = ref('');
|
||||
const running = ref(false);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup>
|
||||
// Object dossier — the deep-dive page for one object, reached from an archive
|
||||
// Object dossier - the deep-dive page for one object, reached from an archive
|
||||
// frame or a research card. Threads everything Caelum knows about it: frames
|
||||
// across telescopes, the observations that produced them, catalog identity,
|
||||
// prior analysis, a cadence chart, and an embedded Lab (analyze → schedulable
|
||||
@@ -103,7 +103,7 @@ const coverage = computed(() => {
|
||||
const d = dossier.value; if (!d) return [];
|
||||
const by = {};
|
||||
for (const f of d.frames) {
|
||||
const k = f.filter || '—';
|
||||
const k = f.filter || '-';
|
||||
by[k] = (by[k] || 0) + (Number(f.exposure_time) || 0);
|
||||
}
|
||||
const max = Math.max(...Object.values(by), 1);
|
||||
@@ -111,10 +111,10 @@ const coverage = computed(() => {
|
||||
.sort((a, b) => b.sec - a.sec);
|
||||
});
|
||||
|
||||
function fmtRa(deg) { if (deg == null) return '—'; const h = deg / 15; const hh = Math.floor(h); const mm = Math.floor((h - hh) * 60); return `${hh}h${String(mm).padStart(2, '0')}m`; }
|
||||
function fmtDec(deg) { if (deg == null) return '—'; const sign = deg < 0 ? '−' : '+'; const a = Math.abs(deg); const dd = Math.floor(a); const m = Math.floor((a - dd) * 60); return `${sign}${dd}°${String(m).padStart(2, '0')}′`; }
|
||||
function fmtRa(deg) { if (deg == null) return '-'; const h = deg / 15; const hh = Math.floor(h); const mm = Math.floor((h - hh) * 60); return `${hh}h${String(mm).padStart(2, '0')}m`; }
|
||||
function fmtDec(deg) { if (deg == null) return '-'; const sign = deg < 0 ? '−' : '+'; const a = Math.abs(deg); const dd = Math.floor(a); const m = Math.floor((a - dd) * 60); return `${sign}${dd}°${String(m).padStart(2, '0')}′`; }
|
||||
function fmtMin(sec) { return `${Math.round((sec || 0) / 60)}m`; }
|
||||
function fmtDate(s) { return s ? new Date(s).toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' }) : '—'; }
|
||||
function fmtDate(s) { return s ? new Date(s).toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' }) : '-'; }
|
||||
|
||||
function scrollToLab() { document.querySelector('.dossier-lab')?.scrollIntoView({ behavior: 'smooth', block: 'start' }); }
|
||||
|
||||
@@ -231,10 +231,10 @@ const priorFields = computed(() => {
|
||||
<tbody>
|
||||
<tr v-for="f in dossier.frames" :key="f.id">
|
||||
<td><RouterLink :to="`/archive?frame=${f.id}`" class="link">{{ f.target_name || f.filename }}</RouterLink></td>
|
||||
<td>{{ f.filter || '—' }}</td>
|
||||
<td>{{ f.filter || '-' }}</td>
|
||||
<td class="num">{{ f.exposure_time || '?' }}s</td>
|
||||
<td class="num">{{ f.fwhm_arcsec != null ? Number(f.fwhm_arcsec).toFixed(1) + '"' : '—' }}</td>
|
||||
<td>{{ (f.date_obs || '').slice(0, 10) || '—' }}</td>
|
||||
<td class="num">{{ f.fwhm_arcsec != null ? Number(f.fwhm_arcsec).toFixed(1) + '"' : '-' }}</td>
|
||||
<td>{{ (f.date_obs || '').slice(0, 10) || '-' }}</td>
|
||||
<td>{{ f.telescope_name }} <span class="muted">· {{ f.site_name }}</span></td>
|
||||
<td>
|
||||
<span v-if="f.observation" class="badge" :class="f.observation.vetted_status === 'good' ? 'badge-online' : 'badge-idle'">
|
||||
|
||||
@@ -181,7 +181,7 @@ const reqStatusBadge = s => ({ PENDING: 'badge-idle', APPROVED: 'badge-online',
|
||||
</div>
|
||||
|
||||
<div v-if="calendar.telescopes.length" class="card" style="margin-top:1rem">
|
||||
<div class="card-header"><h3>Availability — next {{ calendar.window_days }} days</h3>
|
||||
<div class="card-header"><h3>Availability - next {{ calendar.window_days }} days</h3>
|
||||
<span style="font-size:0.75rem;color:var(--text-muted)">click a free cell to request that night</span>
|
||||
</div>
|
||||
<BookingCalendar :telescopes="calendar.telescopes" :bookings="calendar.bookings" :days="calendar.window_days" @pick-slot="onPickSlot" @view-booking="onViewBooking" />
|
||||
@@ -229,10 +229,10 @@ const reqStatusBadge = s => ({ PENDING: 'badge-idle', APPROVED: 'badge-online',
|
||||
<button v-for="n in 5" :key="n" type="button" class="star-btn" :class="{ on: reviewForm.rating >= n }" @click="reviewForm.rating = n">★</button>
|
||||
</div>
|
||||
<label style="font-size:0.78rem;color:var(--text-muted)">Seeing
|
||||
<select v-model="reviewForm.seeing" class="form-control" style="width:80px;display:inline-block;margin-left:0.3rem"><option :value="null">—</option><option v-for="n in 5" :key="n" :value="n">{{ n }}</option></select>
|
||||
<select v-model="reviewForm.seeing" class="form-control" style="width:80px;display:inline-block;margin-left:0.3rem"><option :value="null">-</option><option v-for="n in 5" :key="n" :value="n">{{ n }}</option></select>
|
||||
</label>
|
||||
<label style="font-size:0.78rem;color:var(--text-muted)">Transparency
|
||||
<select v-model="reviewForm.transparency" class="form-control" style="width:80px;display:inline-block;margin-left:0.3rem"><option :value="null">—</option><option v-for="n in 5" :key="n" :value="n">{{ n }}</option></select>
|
||||
<select v-model="reviewForm.transparency" class="form-control" style="width:80px;display:inline-block;margin-left:0.3rem"><option :value="null">-</option><option v-for="n in 5" :key="n" :value="n">{{ n }}</option></select>
|
||||
</label>
|
||||
</div>
|
||||
<div style="display:flex;gap:0.5rem">
|
||||
@@ -256,7 +256,7 @@ const reqStatusBadge = s => ({ PENDING: 'badge-idle', APPROVED: 'badge-online',
|
||||
<p v-if="r.body" style="margin:0.3rem 0 0;font-size:0.88rem">{{ r.body }}</p>
|
||||
</div>
|
||||
<p v-if="!reviews.reviews.length && isOwner" style="color:var(--text-muted);font-size:0.85rem;text-align:center;padding:0.5rem">No reviews yet for your observatory.</p>
|
||||
<p v-else-if="!reviews.reviews.length" style="color:var(--text-muted);font-size:0.85rem;text-align:center;padding:0.5rem">No reviews yet — be the first.</p>
|
||||
<p v-else-if="!reviews.reviews.length" style="color:var(--text-muted);font-size:0.85rem;text-align:center;padding:0.5rem">No reviews yet - be the first.</p>
|
||||
</div>
|
||||
|
||||
<div class="card" style="margin-top:1rem">
|
||||
|
||||
@@ -13,7 +13,7 @@ const error = ref('');
|
||||
const loading = ref(true);
|
||||
let timer = null;
|
||||
|
||||
// The webhook is the source of truth — don't trust the client redirect alone.
|
||||
// The webhook is the source of truth - don't trust the client redirect alone.
|
||||
// Poll the order until it settles, then stop.
|
||||
const SETTLED = new Set(['paid', 'paid_oversold', 'failed', 'canceled']);
|
||||
|
||||
@@ -55,7 +55,7 @@ const pending = computed(() => order.value && order.value.status === 'pending');
|
||||
<div v-if="paid" class="banner ok">
|
||||
<h1>✓ Payment received</h1>
|
||||
<p>Thank you. A receipt has been emailed to {{ order.email }}.</p>
|
||||
<p v-if="order.status === 'paid_oversold'" class="warn">One or more items are short on stock — we'll be in touch about fulfillment or a refund.</p>
|
||||
<p v-if="order.status === 'paid_oversold'" class="warn">One or more items are short on stock - we'll be in touch about fulfillment or a refund.</p>
|
||||
</div>
|
||||
<div v-else-if="pending" class="banner pending">
|
||||
<h1>Confirming payment…</h1>
|
||||
@@ -76,7 +76,7 @@ const pending = computed(() => order.value && order.value.status === 'pending');
|
||||
<div class="srow total"><span>Total</span><span>{{ formatMoney(order.total_amount, order.currency) }}</span></div>
|
||||
</div>
|
||||
|
||||
<p v-if="paid && order.fulfillment_method === 'pickup'" class="muted">This is a local pickup order — we'll email you when it's ready to collect.</p>
|
||||
<p v-if="paid && order.fulfillment_method === 'pickup'" class="muted">This is a local pickup order - we'll email you when it's ready to collect.</p>
|
||||
<p class="muted">Order ID: {{ order.id }}</p>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
@@ -168,9 +168,9 @@ function pickCatalog(o) {
|
||||
<td>{{ i + 1 }}</td>
|
||||
<td><strong>{{ t.name }}</strong></td>
|
||||
<!-- ra and dec are independently nullable server-side (plans.js
|
||||
inserts `dec ?? null`), so they need independent guards —
|
||||
inserts `dec ?? null`), so they need independent guards -
|
||||
keying both off `ra` threw on a target with only an RA. -->
|
||||
<td style="font-family:monospace;font-size:0.78rem">{{ t.ra != null ? t.ra.toFixed(3) : '—' }} / {{ t.dec != null ? t.dec.toFixed(2) : '—' }}</td>
|
||||
<td style="font-family:monospace;font-size:0.78rem">{{ t.ra != null ? t.ra.toFixed(3) : '-' }} / {{ t.dec != null ? t.dec.toFixed(2) : '-' }}</td>
|
||||
<td>{{ t.priority }}</td>
|
||||
<td style="font-size:0.78rem;color:var(--text-secondary)">{{ t.note || '' }}</td>
|
||||
<td><button v-if="editing.owner_id === auth.user?.id" class="btn btn-ghost btn-sm" style="color:var(--danger)" @click="removeTarget(t)">×</button></td>
|
||||
@@ -207,7 +207,7 @@ function pickCatalog(o) {
|
||||
<div class="form-group">
|
||||
<label>Attach to Proposal (optional)</label>
|
||||
<select v-model="newPlan.proposal_id" class="form-control">
|
||||
<option value="">— none —</option>
|
||||
<option value="">- none -</option>
|
||||
<option v-for="p in myProposals" :key="p.id" :value="p.id">{{ p.name }}</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
@@ -207,7 +207,7 @@ function actionLabel(state) {
|
||||
<div>
|
||||
<strong style="color:var(--text-primary)">How this proposal flows:</strong>
|
||||
<span style="margin-left:0.3rem"><strong>Plans</strong> are reusable target lists.
|
||||
<strong>Request Groups</strong> are formal observation programs the proposal commits to — each can be scheduled as one or more sessions.
|
||||
<strong>Request Groups</strong> are formal observation programs the proposal commits to - each can be scheduled as one or more sessions.
|
||||
<strong>Bookings</strong> are the actual telescope reservations that fulfill them.</span>
|
||||
<div style="font-size:0.78rem;color:var(--text-muted);margin-top:0.3rem">
|
||||
States auto-update from bookings: PENDING → SCHEDULED (booking exists) → IN_PROGRESS (live) → COMPLETED (capture done). Use Cancel/Fail only for human decisions, and Reopen to bring back a closed group.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup>
|
||||
// Research — the science feed. Pulls observation candidates from external
|
||||
// Research - the science feed. Pulls observation candidates from external
|
||||
// catalogs (MPC for NEOs, NASA Exoplanet Archive for transits, AAVSO for
|
||||
// variable stars), surfaces them as actionable cards, and routes the
|
||||
// "Schedule" button through the same Observation snapshot + jobs queue
|
||||
@@ -63,7 +63,7 @@ const tools = ref({
|
||||
});
|
||||
const RESEARCH_CATEGORIES = ['neo', 'exoplanet_transit', 'variable_star', 'transient', 'satellite'];
|
||||
|
||||
// Add a target to the feed with no upstream fetch and no scheduling — the one
|
||||
// Add a target to the feed with no upstream fetch and no scheduling - the one
|
||||
// add path that works on an internet-less deploy. Surfaced both as the header
|
||||
// "+ Add research" modal and inside the Workshop.
|
||||
const showAddModal = ref(false);
|
||||
@@ -101,7 +101,7 @@ async function onAtlasJump({ ra, dec }) {
|
||||
runAtlas();
|
||||
}
|
||||
|
||||
// Per-card DSS toggles — sky preview embedded inline on existing cards.
|
||||
// Per-card DSS toggles - sky preview embedded inline on existing cards.
|
||||
const dssShown = ref({}); // { [targetId]: true }
|
||||
function toggleDss(target) {
|
||||
if (dssShown.value[target.id]) {
|
||||
@@ -125,7 +125,7 @@ const WS_SUBS = [
|
||||
{ key: 'lookups', label: 'Lookups' },
|
||||
];
|
||||
|
||||
// Per-card SIMBAD field crossmatch — "what's near this target?"
|
||||
// Per-card SIMBAD field crossmatch - "what's near this target?"
|
||||
const fieldShown = ref({}); // { [targetId]: { loading, matches?, error? } }
|
||||
async function toggleField(target) {
|
||||
if (fieldShown.value[target.id]) {
|
||||
@@ -141,9 +141,9 @@ async function toggleField(target) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---- Aladin Lite — interactive sky atlas (CDS, loaded from CDN on
|
||||
// ---- Aladin Lite - interactive sky atlas (CDS, loaded from CDN on
|
||||
// demand). Reuses a single in-page <script> load; subsequent inits are
|
||||
// instant. Per-card "⊕ atlas" complements the "◎ sky" DSS thumbnail —
|
||||
// instant. Per-card "⊕ atlas" complements the "◎ sky" DSS thumbnail -
|
||||
// DSS for a fast static glance, Aladin for interactive exploration with
|
||||
// catalog overlays.
|
||||
let aladinLoadPromise = null;
|
||||
@@ -302,7 +302,7 @@ async function ensureTelescopesLoaded() {
|
||||
}
|
||||
}
|
||||
telescopesForModal.value = list;
|
||||
} catch { /* silent — schedule UI shows "no telescopes" */ }
|
||||
} catch { /* silent - schedule UI shows "no telescopes" */ }
|
||||
}
|
||||
|
||||
const myObservatorySites = ref([]); // [{ name, code, lat, lng, alt }]
|
||||
@@ -349,7 +349,7 @@ function altAz(ra, dec, lat, lng, date) {
|
||||
const haR = deg2rad(ha), decR = deg2rad(dec), latR = deg2rad(lat);
|
||||
const sinAlt = Math.sin(decR) * Math.sin(latR) + Math.cos(decR) * Math.cos(latR) * Math.cos(haR);
|
||||
const alt = rad2deg(Math.asin(Math.max(-1, Math.min(1, sinAlt))));
|
||||
// Azimuth — not displayed but kept for completeness.
|
||||
// Azimuth - not displayed but kept for completeness.
|
||||
const cosAz = (Math.sin(decR) - Math.sin(deg2rad(alt)) * Math.sin(latR)) / (Math.cos(deg2rad(alt)) * Math.cos(latR));
|
||||
let az = rad2deg(Math.acos(Math.max(-1, Math.min(1, cosAz))));
|
||||
if (Math.sin(haR) > 0) az = 360 - az;
|
||||
@@ -373,7 +373,7 @@ function nextWindowFromSite(target, site) {
|
||||
else { if (alt > bestAlt) bestAlt = alt; }
|
||||
windowEnd = t;
|
||||
} else if (inWindow) {
|
||||
// First sustained window closed — return it.
|
||||
// First sustained window closed - return it.
|
||||
return { start: windowStart, end: windowEnd, maxAlt: bestAlt };
|
||||
}
|
||||
}
|
||||
@@ -471,11 +471,11 @@ async function submitSchedule() {
|
||||
}
|
||||
|
||||
// ----- Formatters -----
|
||||
function fmtRa(deg) { if (deg == null) return '—'; const h = deg / 15; const hh = Math.floor(h); const mm = Math.floor((h - hh) * 60); return `${hh}h${String(mm).padStart(2,'0')}m`; }
|
||||
function fmtDec(deg) { if (deg == null) return '—'; const sign = deg < 0 ? '−' : '+'; const a = Math.abs(deg); const d = Math.floor(a); const m = Math.floor((a - d) * 60); return `${sign}${d}°${String(m).padStart(2,'0')}′`; }
|
||||
function fmtMag(m) { return m == null ? '—' : Number(m).toFixed(1); }
|
||||
function fmtRa(deg) { if (deg == null) return '-'; const h = deg / 15; const hh = Math.floor(h); const mm = Math.floor((h - hh) * 60); return `${hh}h${String(mm).padStart(2,'0')}m`; }
|
||||
function fmtDec(deg) { if (deg == null) return '-'; const sign = deg < 0 ? '−' : '+'; const a = Math.abs(deg); const d = Math.floor(a); const m = Math.floor((a - d) * 60); return `${sign}${d}°${String(m).padStart(2,'0')}′`; }
|
||||
function fmtMag(m) { return m == null ? '-' : Number(m).toFixed(1); }
|
||||
function fmtWindow(s) {
|
||||
if (!s) return '—';
|
||||
if (!s) return '-';
|
||||
const d = new Date(s);
|
||||
const now = Date.now();
|
||||
const diffH = (d - now) / 3600_000;
|
||||
@@ -527,7 +527,7 @@ function fmtRefreshed(meta) {
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- ↓ Pull — add-by-hand (works offline) + upstream catalog pulls -->
|
||||
<!-- ↓ Pull - add-by-hand (works offline) + upstream catalog pulls -->
|
||||
<div v-if="workshopSub === 'pull'" class="ws-zone">
|
||||
<div class="card tool-card ws-manual">
|
||||
<h3>Add a target</h3>
|
||||
@@ -626,7 +626,7 @@ function fmtRefreshed(meta) {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ⊙ Atlas — Aladin Lite. Wide; only tool in this sub-tab. -->
|
||||
<!-- ⊙ Atlas - Aladin Lite. Wide; only tool in this sub-tab. -->
|
||||
<div v-if="workshopSub === 'atlas'" class="ws-zone">
|
||||
<div class="card tool-card tool-card-wide">
|
||||
<div class="tool-form-inline">
|
||||
@@ -652,7 +652,7 @@ function fmtRefreshed(meta) {
|
||||
@feed-stale="reloadFeed" />
|
||||
</div>
|
||||
|
||||
<!-- ⌖ Lookups — 2 compact one-shot lookups. Field-scan was removed
|
||||
<!-- ⌖ Lookups - 2 compact one-shot lookups. Field-scan was removed
|
||||
since the per-card "▣ field" button covers it for any target. -->
|
||||
<div v-if="workshopSub === 'lookups'" class="ws-zone">
|
||||
<div class="tool-grid tool-grid-tight">
|
||||
@@ -669,7 +669,7 @@ function fmtRefreshed(meta) {
|
||||
<div v-else-if="tools.resolve.result" class="tool-result tool-result-tight">
|
||||
<div class="ephem-grid">
|
||||
<div><span class="muted-line">name</span> {{ tools.resolve.result.canonical_name }}</div>
|
||||
<div><span class="muted-line">type</span> {{ tools.resolve.result.object_type || '—' }}</div>
|
||||
<div><span class="muted-line">type</span> {{ tools.resolve.result.object_type || '-' }}</div>
|
||||
<div><span class="muted-line">RA</span> {{ fmtRa(tools.resolve.result.ra_deg) }}</div>
|
||||
<div><span class="muted-line">Dec</span> {{ fmtDec(tools.resolve.result.dec_deg) }}</div>
|
||||
</div>
|
||||
@@ -732,7 +732,7 @@ function fmtRefreshed(meta) {
|
||||
</div>
|
||||
<p v-if="t.urgency_note" class="urgency-note">{{ t.urgency_note }}</p>
|
||||
|
||||
<!-- Visibility from user's sites — pure JS calc, updates with the target row. -->
|
||||
<!-- Visibility from user's sites - pure JS calc, updates with the target row. -->
|
||||
<div v-if="visibilityFor(t).length" class="vis-block">
|
||||
<div class="vis-label">Observable next 24h:</div>
|
||||
<div v-for="v in visibilityFor(t)" :key="v.site.id" class="vis-row">
|
||||
@@ -745,7 +745,7 @@ function fmtRefreshed(meta) {
|
||||
Not above {{ 30 }}° from any of your sites in the next 24h.
|
||||
</div>
|
||||
|
||||
<!-- Caelum history — expandable panel. -->
|
||||
<!-- Caelum history - expandable panel. -->
|
||||
<div class="history-section">
|
||||
<button class="history-toggle" @click="toggleHistory(t)">
|
||||
{{ expandedHistory[t.id] ? '▾' : '▸' }}
|
||||
@@ -854,7 +854,7 @@ function fmtRefreshed(meta) {
|
||||
<div class="form-group">
|
||||
<label>Telescope</label>
|
||||
<select v-model="telescopeId" class="form-control">
|
||||
<option value="" disabled>— pick a telescope —</option>
|
||||
<option value="" disabled>- pick a telescope -</option>
|
||||
<optgroup v-for="g in telescopesGroupedBySite" :key="g.site_id" :label="g.site_name + (g.site_experimental ? ' (testing)' : '')">
|
||||
<option v-for="t in g.telescopes" :key="t.id" :value="t.id">{{ t.label }}</option>
|
||||
</optgroup>
|
||||
@@ -873,7 +873,7 @@ function fmtRefreshed(meta) {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Add research — manual, offline, no scheduling. -->
|
||||
<!-- Add research - manual, offline, no scheduling. -->
|
||||
<div v-if="showAddModal" class="modal-overlay" @click.self="showAddModal = false">
|
||||
<div class="modal">
|
||||
<h3>Add research</h3>
|
||||
@@ -941,7 +941,7 @@ function fmtRefreshed(meta) {
|
||||
height: 100%;
|
||||
}
|
||||
/* Global stylesheet adds `.card + .card { margin-top: 1rem }` for
|
||||
stacked-card pages. Inside a grid we don't want that — the grid `gap`
|
||||
stacked-card pages. Inside a grid we don't want that - the grid `gap`
|
||||
already handles spacing, and the stray top margin made every card
|
||||
after the first 16px taller in its layout box. */
|
||||
.research-targets-grid .target-card + .target-card { margin-top: 0; }
|
||||
@@ -1023,7 +1023,7 @@ function fmtRefreshed(meta) {
|
||||
.muted { color: var(--text-muted); padding: 2rem; text-align: center; }
|
||||
.muted-line { color: var(--text-muted); font-size: 0.78rem; }
|
||||
|
||||
/* Workshop sub-tabs — smaller than the top tabs, render one zone at a
|
||||
/* Workshop sub-tabs - smaller than the top tabs, render one zone at a
|
||||
time to kill the scroll. */
|
||||
.ws-zone { margin-bottom: 1.25rem; }
|
||||
.ws-manual { margin-bottom: 0.9rem; }
|
||||
@@ -1049,7 +1049,7 @@ function fmtRefreshed(meta) {
|
||||
}
|
||||
.tool-card-compact h3 { font-size: 0.92rem; }
|
||||
/* Same .card + .card { margin-top: 1rem } trap as the research-targets
|
||||
grid — kill the rogue margin inside tool grids so adjacent cards
|
||||
grid - kill the rogue margin inside tool grids so adjacent cards
|
||||
don't pick up 16px of fake height in their layout box. */
|
||||
.tool-grid .tool-card + .tool-card,
|
||||
.tool-grid-tight .tool-card + .tool-card { margin-top: 0; }
|
||||
@@ -1060,7 +1060,7 @@ function fmtRefreshed(meta) {
|
||||
.tool-form-inline .form-control-sm { padding: 0.2rem 0.4rem; font-size: 0.82rem; max-width: 130px; }
|
||||
.tool-result-tight { padding: 0.35rem 0.5rem; font-size: 0.82rem; }
|
||||
|
||||
/* Spinner — pure CSS, color inherits from parent so it works on both
|
||||
/* Spinner - pure CSS, color inherits from parent so it works on both
|
||||
button text (currentColor on white) and standalone (currentColor on
|
||||
muted text). Two sizes: inline (12px) and lg (20px) for the thinking
|
||||
panel placeholder. Used by LabPanel too so this stays in the global
|
||||
@@ -1090,22 +1090,22 @@ function fmtRefreshed(meta) {
|
||||
/* Caelum Lab takes the full row so the form + response have breathing room. */
|
||||
.tool-card-wide { grid-column: 1 / -1; }
|
||||
|
||||
/* Chips — template selector + re-run chips. Shared between the resolver
|
||||
/* Chips - template selector + re-run chips. Shared between the resolver
|
||||
(Lookups tab) and any future chip-based UI. */
|
||||
.chip { padding: 0.2rem 0.6rem; border-radius: 999px; border: 1px solid var(--border); background: transparent; color: var(--text-muted); font-size: 0.78rem; cursor: pointer; }
|
||||
.chip:hover { color: var(--text-primary); border-color: var(--text-muted); }
|
||||
.chip-active { background: var(--accent); color: var(--bg-card); border-color: var(--accent); }
|
||||
|
||||
/* Copy button — small, inline, doesn't draw attention until hovered.
|
||||
/* Copy button - small, inline, doesn't draw attention until hovered.
|
||||
Used in Lab too; kept global so LabPanel can rely on it. */
|
||||
.btn-copy { background: transparent; border: 1px solid var(--border); color: var(--text-muted); padding: 0.2rem 0.5rem; border-radius: 4px; cursor: pointer; font-size: 0.85rem; line-height: 1; }
|
||||
.btn-copy:hover { color: var(--text-primary); border-color: var(--text-muted); }
|
||||
|
||||
/* Aladin Lite container — needs explicit height for the canvas to render. */
|
||||
/* Aladin Lite container - needs explicit height for the canvas to render. */
|
||||
.aladin-host { width: 100%; height: 320px; background: #000; border-radius: 4px; margin-top: 0.4rem; border: 1px solid var(--border); }
|
||||
.atlas-inline { padding-top: 0.4rem; border-top: 1px dashed var(--border); margin-top: 0.4rem; }
|
||||
|
||||
/* Field crossmatch list — compact, sortable by separation. */
|
||||
/* Field crossmatch list - compact, sortable by separation. */
|
||||
.field-inline { padding-top: 0.4rem; border-top: 1px dashed var(--border); margin-top: 0.4rem; font-size: 0.82rem; }
|
||||
.field-list { list-style: none; padding: 0; margin: 0.4rem 0 0; max-height: 220px; overflow-y: auto; }
|
||||
.field-list li { display: grid; grid-template-columns: 1fr 80px 50px; gap: 0.5rem; align-items: center; padding: 0.15rem 0; font-size: 0.82rem; }
|
||||
|
||||
@@ -16,7 +16,7 @@ const showModal = ref(false);
|
||||
const editing = ref(null);
|
||||
const error = ref('');
|
||||
// Details popover for clicking a booking on the calendar grid. Distinct from
|
||||
// the edit modal — even own bookings open in "details" first so the click
|
||||
// the edit modal - even own bookings open in "details" first so the click
|
||||
// affordance is uniform (own + others' look the same on the grid).
|
||||
const viewing = ref(null);
|
||||
|
||||
@@ -89,7 +89,7 @@ onMounted(async () => {
|
||||
openCreate({});
|
||||
form.value.telescope_id = String(route.query.telescope_id || form.value.telescope_id);
|
||||
form.value.title = String(route.query.title || form.value.title);
|
||||
if (route.query.nox_program) form.value.notes = '— Nox program from Caelum Lab —\n\n' + String(route.query.nox_program);
|
||||
if (route.query.nox_program) form.value.notes = '- Nox program from Caelum Lab -\n\n' + String(route.query.nox_program);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -138,13 +138,13 @@ function openCreate(prefill = {}) {
|
||||
showModal.value = true;
|
||||
}
|
||||
|
||||
// Today, at local midnight — used to disable past-date scheduling.
|
||||
// Today, at local midnight - used to disable past-date scheduling.
|
||||
const todayStart = computed(() => { const d = new Date(); d.setHours(0, 0, 0, 0); return d; });
|
||||
function isPastDay(day) { return day.date < todayStart.value; }
|
||||
|
||||
// Click on a day cell (anywhere not inside a booking event) → prefill the
|
||||
// create modal with this date so the user doesn't have to retype it.
|
||||
// Past days and adjacent-month padding cells are not clickable — you
|
||||
// Past days and adjacent-month padding cells are not clickable - you
|
||||
// can't book something that already happened.
|
||||
// A Date's LOCAL calendar date as YYYY-MM-DD. Never toISOString() for this:
|
||||
// it converts to UTC first, so west of Greenwich it can report tomorrow's
|
||||
@@ -209,7 +209,7 @@ async function saveBooking() {
|
||||
// Client-side guard: a same-day booking that crosses midnight must say so
|
||||
// explicitly. Catch the user mistake of leaving end_date blank with an
|
||||
// end_time earlier than start_time (which produces a negative window
|
||||
// that the server now refuses anyway — surface it nicer here).
|
||||
// that the server now refuses anyway - surface it nicer here).
|
||||
const startDate = form.value.start_date;
|
||||
const endDate = form.value.end_date || form.value.start_date;
|
||||
const startTs = new Date(`${startDate}T${form.value.start_time}`).getTime();
|
||||
@@ -318,7 +318,7 @@ const upcomingBookings = computed(() =>
|
||||
<div class="day-number">{{ day.date.getDate() }}</div>
|
||||
<div v-for="b in bookingsForDay(day.date)" :key="b.id" class="calendar-event"
|
||||
:class="{ 'event-others': !b.is_mine, 'event-mine': b.is_mine }"
|
||||
:title="b.is_mine ? b.title : `${b.title} — booked by ${b.booked_by}`"
|
||||
:title="b.is_mine ? b.title : `${b.title} - booked by ${b.booked_by}`"
|
||||
@click.stop="openDetails(b)">
|
||||
{{ formatTime(b.start_time) }} {{ b.title }}<span v-if="!b.is_mine" style="opacity:0.7"> · {{ b.booked_by }}</span>
|
||||
</div>
|
||||
@@ -429,14 +429,14 @@ const upcomingBookings = computed(() =>
|
||||
<div class="form-group">
|
||||
<label>Proposal (optional)</label>
|
||||
<select v-model="form.proposal_id" class="form-control">
|
||||
<option value="">— none —</option>
|
||||
<option value="">- none -</option>
|
||||
<option v-for="p in myProposals" :key="p.id" :value="p.id">{{ p.name }}{{ p.semester ? ' · ' + p.semester : '' }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Request Group</label>
|
||||
<select v-model="form.request_group_id" class="form-control" :disabled="!form.proposal_id">
|
||||
<option value="">— none —</option>
|
||||
<option value="">- none -</option>
|
||||
<option v-for="rg in proposalDetail?.request_groups || []" :key="rg.id" :value="rg.id">{{ rg.name }} ({{ rg.state }})</option>
|
||||
</select>
|
||||
</div>
|
||||
@@ -473,7 +473,7 @@ const upcomingBookings = computed(() =>
|
||||
.backlog-card.bl-failed,
|
||||
.backlog-card.bl-canceled { opacity: 0.5; }
|
||||
/* Bookings visible to the user but owned by someone else (proposal member,
|
||||
collaborator, or on a site they operate) — shown read-only so the
|
||||
collaborator, or on a site they operate) - shown read-only so the
|
||||
calendar agrees with the Request-Group Backlog. */
|
||||
.calendar-event.event-others {
|
||||
opacity: 0.75;
|
||||
@@ -485,7 +485,7 @@ const upcomingBookings = computed(() =>
|
||||
.calendar-day.day-clickable:hover { background: rgba(56, 189, 248, 0.06); }
|
||||
/* Past days: dimmed and non-interactive for empty cells. Bookings inside
|
||||
past cells stay clickable so users can still open historical session
|
||||
details — only the "click empty cell to schedule" affordance is killed. */
|
||||
details - only the "click empty cell to schedule" affordance is killed. */
|
||||
.calendar-day.day-past { background: rgba(0, 0, 0, 0.18); opacity: 0.55; cursor: not-allowed; }
|
||||
.calendar-day.day-past .day-number { color: var(--text-muted); }
|
||||
.calendar-day.day-past .calendar-event { cursor: pointer; }
|
||||
|
||||
@@ -278,13 +278,13 @@ function downloadSummary() {
|
||||
if (!summary.value) return;
|
||||
const s = summary.value;
|
||||
const lines = [
|
||||
`OBSERVING REPORT — ${s.booking.title || 'Untitled'}`,
|
||||
`OBSERVING REPORT - ${s.booking.title || 'Untitled'}`,
|
||||
`Site: ${s.site.name} Telescope: ${s.telescope.name}`,
|
||||
`Host: ${s.host} Participants: ${s.participants.join(', ')}`,
|
||||
`Window: ${s.booking.start_time} → ${s.booking.end_time}`,
|
||||
'',
|
||||
`TARGETS total=${s.target_summary.total} done=${s.target_summary.done} skipped=${s.target_summary.skipped} pending=${s.target_summary.pending}`,
|
||||
...s.targets.map(t => ` [${t.status}] ${t.name}${t.ra != null ? ` (RA ${t.ra} Dec ${t.dec})` : ''}${t.note ? ' — ' + t.note : ''}`),
|
||||
...s.targets.map(t => ` [${t.status}] ${t.name}${t.ra != null ? ` (RA ${t.ra} Dec ${t.dec})` : ''}${t.note ? ' - ' + t.note : ''}`),
|
||||
'',
|
||||
`EXPOSURES total=${s.exposure_summary.total} completed=${s.exposure_summary.completed} integration=${s.exposure_summary.total_integration_seconds}s`,
|
||||
...s.exposures.map(e => ` [${e.status}] ${e.target_name || '?'}: ${e.exposure_count}x${e.exposure_time}s ${e.filter || ''} ${e.filename || ''}`),
|
||||
@@ -367,7 +367,7 @@ const exposureProgress = e => {
|
||||
</div>
|
||||
|
||||
<div v-if="session.is_spectator" class="card" style="border:1px solid rgba(56,189,248,0.3);background:rgba(56,189,248,0.05);margin-bottom:1rem;display:flex;justify-content:space-between;align-items:center;font-size:0.85rem">
|
||||
<span><span style="font-size:1.1rem">👁</span> <strong>Spectator mode</strong> — you're watching live but cannot post notes or slew. Ask the host to invite you.</span>
|
||||
<span><span style="font-size:1.1rem">👁</span> <strong>Spectator mode</strong> - you're watching live but cannot post notes or slew. Ask the host to invite you.</span>
|
||||
<span class="badge badge-slewing">{{ session.visibility }}</span>
|
||||
</div>
|
||||
|
||||
@@ -486,7 +486,7 @@ const exposureProgress = e => {
|
||||
<a v-if="dssUrl(t)" :href="dssUrl(t)" target="_blank" rel="noopener" style="margin-left:0.4rem;font-size:0.7rem;color:var(--accent);text-decoration:none" title="View in Aladin DSS">↗ DSS</a>
|
||||
<div style="font-size:0.7rem;color:var(--text-muted)">added by {{ t.added_by_username }}</div>
|
||||
</td>
|
||||
<td style="font-family:monospace;font-size:0.78rem">{{ t.ra != null ? t.ra.toFixed(3) + ' / ' + t.dec.toFixed(3) : '—' }}</td>
|
||||
<td style="font-family:monospace;font-size:0.78rem">{{ t.ra != null ? t.ra.toFixed(3) + ' / ' + t.dec.toFixed(3) : '-' }}</td>
|
||||
<td>{{ t.priority }}</td>
|
||||
<td><span class="badge" :class="tStatusBadge(t.status)">{{ t.status }}</span></td>
|
||||
<td style="font-size:0.78rem;color:var(--text-secondary)">{{ t.note || '' }}</td>
|
||||
@@ -563,7 +563,7 @@ const exposureProgress = e => {
|
||||
<input v-model="inviteUsername" class="form-control" placeholder="username or email" />
|
||||
<button class="btn btn-secondary btn-sm">Invite</button>
|
||||
</form>
|
||||
<div v-else-if="session.is_host && !session.is_active" style="margin-top:0.5rem;font-size:0.78rem;color:var(--text-muted)">Session ended — collaborator changes are locked.</div>
|
||||
<div v-else-if="session.is_host && !session.is_active" style="margin-top:0.5rem;font-size:0.78rem;color:var(--text-muted)">Session ended - collaborator changes are locked.</div>
|
||||
<div v-if="presence.length" style="border-top:1px solid var(--border);margin-top:0.75rem;padding-top:0.5rem">
|
||||
<div style="font-size:0.7rem;color:var(--text-muted);text-transform:uppercase;letter-spacing:0.05em;margin-bottom:0.25rem">Activity</div>
|
||||
<div v-for="p in presence" :key="p.ts" style="font-size:0.78rem;color:var(--text-secondary);padding:0.15rem 0">{{ p.msg }}</div>
|
||||
@@ -609,7 +609,7 @@ const exposureProgress = e => {
|
||||
<strong>Targets</strong>
|
||||
<div v-for="t in summary.targets" :key="t.id" style="font-size:0.82rem;padding:0.2rem 0">
|
||||
<span class="badge" :class="tStatusBadge(t.status)" style="font-size:0.65rem">{{ t.status }}</span>
|
||||
{{ t.name }}<span v-if="t.note" style="color:var(--text-muted)"> — {{ t.note }}</span>
|
||||
{{ t.name }}<span v-if="t.note" style="color:var(--text-muted)"> - {{ t.note }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -36,7 +36,7 @@ async function save() {
|
||||
error.value = '';
|
||||
try {
|
||||
prefs.value = await api.patch('/preferences', prefs.value);
|
||||
// Apply theme + density immediately — this is what makes the toggles do
|
||||
// Apply theme + density immediately - this is what makes the toggles do
|
||||
// something visible instead of silently saving to the server.
|
||||
applyAppearance({ theme: prefs.value.theme, density: prefs.value.density });
|
||||
savedFlash.value = true;
|
||||
@@ -129,7 +129,7 @@ function copyToken() {
|
||||
<div class="card">
|
||||
<div class="card-header"><h3>API Tokens</h3><span style="font-size:0.72rem;color:var(--text-muted)">programmatic access</span></div>
|
||||
<div v-if="justCreated" class="token-banner">
|
||||
<div><strong>Save this token now — it won't be shown again.</strong></div>
|
||||
<div><strong>Save this token now - it won't be shown again.</strong></div>
|
||||
<code class="token-code">{{ justCreated.token }}</code>
|
||||
<div style="display:flex;gap:0.4rem;margin-top:0.4rem">
|
||||
<button class="btn btn-secondary btn-sm" @click="copyToken">Copy</button>
|
||||
|
||||
@@ -21,7 +21,7 @@ const loading = ref(true);
|
||||
const error = ref('');
|
||||
|
||||
// Shop: real products (Agena Astro-sourced) the operator curates. Loaded
|
||||
// best-effort — if the shop isn't configured the whole section stays hidden.
|
||||
// best-effort - if the shop isn't configured the whole section stays hidden.
|
||||
const shopEnabled = ref(false);
|
||||
const shopProducts = ref([]);
|
||||
|
||||
@@ -389,7 +389,7 @@ function copyShare() {
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- Domes (Agena doesn't stock these — shown only if seeded) -->
|
||||
<!-- Domes (Agena doesn't stock these - shown only if seeded) -->
|
||||
<div class="shop-cat" v-if="domeProducts.length">
|
||||
<h3>Domes & enclosures</h3>
|
||||
<div class="product-grid">
|
||||
@@ -459,7 +459,7 @@ function copyShare() {
|
||||
<li>Sign in to your Caelum instance.</li>
|
||||
<li>Go to <code>/sites</code> and create a Site (your physical location).</li>
|
||||
<li>If using a dome or roll-off: add an Enclosure under that Site.</li>
|
||||
<li>Add your Telescope under the Enclosure (or directly under the Site). Pick a short, memorable name — you'll reference it from Nox.</li>
|
||||
<li>Add your Telescope under the Enclosure (or directly under the Site). Pick a short, memorable name - you'll reference it from Nox.</li>
|
||||
<li>Set the driver type and connection details on each device. Test the connection.</li>
|
||||
<li>Open <code>/nox</code> and start with the template below. Replace <code>"My-Scope"</code> and <code>"My-Dome"</code> with the names you just chose.</li>
|
||||
</ol>
|
||||
@@ -481,9 +481,9 @@ function copyShare() {
|
||||
<div class="plan-section next-steps">
|
||||
<h2>Next steps</h2>
|
||||
<ul>
|
||||
<li><RouterLink to="/nox/docs">Read the Nox tutorial</RouterLink> — start with chapter 1 if you haven't seen the language before.</li>
|
||||
<li><RouterLink to="/nox/examples">Browse all examples</RouterLink> — 9 working programs you can run in mock mode without any hardware.</li>
|
||||
<li><RouterLink to="/nox">Open the Nox Console</RouterLink> — write and run programs after you sign in.</li>
|
||||
<li><RouterLink to="/nox/docs">Read the Nox tutorial</RouterLink> - start with chapter 1 if you haven't seen the language before.</li>
|
||||
<li><RouterLink to="/nox/examples">Browse all examples</RouterLink> - 9 working programs you can run in mock mode without any hardware.</li>
|
||||
<li><RouterLink to="/nox">Open the Nox Console</RouterLink> - write and run programs after you sign in.</li>
|
||||
<li>Get stuck? Check <a href="https://gitlab.com/paulhitt/caelum/-/issues" target="_blank" rel="noopener">GitLab issues</a>.</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -109,7 +109,7 @@ async function resyncOrder(o) {
|
||||
catch (e) { error.value = e.message || 'Re-sync failed.'; }
|
||||
}
|
||||
function formatAddr(s) {
|
||||
if (!s) return '— no address —';
|
||||
if (!s) return '- no address -';
|
||||
return [s.line1, s.line2, [s.city, s.state, s.postal_code].filter(Boolean).join(', '), s.country].filter(Boolean).join(' · ');
|
||||
}
|
||||
function orderDate(d) { try { return new Date(d).toLocaleString(); } catch { return d; } }
|
||||
@@ -215,7 +215,7 @@ function orderDate(d) { try { return new Date(d).toLocaleString(); } catch { ret
|
||||
</div>
|
||||
|
||||
<div class="ship-to">
|
||||
<strong>{{ o.fulfillment_method === 'pickup' ? 'Pickup' : 'Ship to' }}:</strong> {{ o.shipping_name || '—' }} <{{ o.email }}>
|
||||
<strong>{{ o.fulfillment_method === 'pickup' ? 'Pickup' : 'Ship to' }}:</strong> {{ o.shipping_name || '-' }} <{{ o.email }}>
|
||||
<template v-if="o.fulfillment_method !== 'pickup'"><br /><span class="addr">{{ formatAddr(o.shipping) }}</span></template>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -235,7 +235,7 @@ function instrumentIcon(t) { return ({ camera: '📸', filter_wheel: '🌈', foc
|
||||
<div v-if="sessionLock" class="card" style="border:1px solid rgba(251,191,36,0.4);background:rgba(251,191,36,0.05);max-width:600px;margin:2rem auto">
|
||||
<div style="display:flex;align-items:center;gap:0.75rem;margin-bottom:0.5rem">
|
||||
<span style="font-size:1.5rem">🔒</span>
|
||||
<h3 style="margin:0">Site Locked — Active Observing Session</h3>
|
||||
<h3 style="margin:0">Site Locked - Active Observing Session</h3>
|
||||
</div>
|
||||
<p style="color:var(--text-secondary);margin-bottom:0.75rem">This site is restricted to the user(s) currently holding a confirmed booking. You'll regain access when the session ends.</p>
|
||||
<div v-for="(s, i) in sessionLock.sessions" :key="i" style="padding:0.5rem 0;border-top:1px solid var(--border);font-size:0.85rem">
|
||||
@@ -250,7 +250,7 @@ function instrumentIcon(t) { return ({ camera: '📸', filter_wheel: '🌈', foc
|
||||
<div style="display:flex;align-items:center;gap:0.5rem;font-size:0.9rem">
|
||||
<span style="font-size:1.1rem">🔮</span>
|
||||
<strong>Live observing session</strong>
|
||||
<span style="color:var(--text-muted)">— site config is read-only until the session ends</span>
|
||||
<span style="color:var(--text-muted)">- site config is read-only until the session ends</span>
|
||||
</div>
|
||||
<div v-for="(s, i) in site.active_sessions" :key="i" style="padding:0.4rem 0 0;font-size:0.82rem;color:var(--text-secondary);display:flex;justify-content:space-between;align-items:center;gap:0.5rem">
|
||||
<span><strong>{{ s.username }}</strong> on {{ s.telescope_name }} until {{ new Date(s.end_time).toLocaleString() }}</span>
|
||||
|
||||
@@ -191,7 +191,7 @@ function formatNum(n) {
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p v-if="objects.length === 100" style="text-align:center;padding:0.75rem;color:var(--text-muted);font-size:0.82rem">Showing first 100 results — refine your search to find specific objects</p>
|
||||
<p v-if="objects.length === 100" style="text-align:center;padding:0.75rem;color:var(--text-muted);font-size:0.82rem">Showing first 100 results - refine your search to find specific objects</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -286,7 +286,7 @@ function formatNum(n) {
|
||||
|
||||
<!-- NHATS -->
|
||||
<div v-if="detail.nhats" style="margin:0.75rem 0;padding:0.75rem;background:var(--bg-card);border-radius:var(--radius);border-left:3px solid var(--accent)">
|
||||
<h4 style="font-size:0.85rem;margin-bottom:0.5rem;color:var(--accent)">NHATS — Near-Earth Human-Accessible Target</h4>
|
||||
<h4 style="font-size:0.85rem;margin-bottom:0.5rem;color:var(--accent)">NHATS - Near-Earth Human-Accessible Target</h4>
|
||||
<div style="display:grid;grid-template-columns:1fr 1fr;gap:0.3rem;font-size:0.82rem">
|
||||
<div><span style="color:var(--text-muted)">Trajectories:</span> {{ detail.nhats.num_trajectories?.toLocaleString() }}</div>
|
||||
<div><span style="color:var(--text-muted)">Min ΔV:</span> {{ detail.nhats.min_dv?.toFixed(3) }} km/s</div>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// you can share https://caelum.network/status during an incident and
|
||||
// people see real subsystem state without needing access to the app.
|
||||
//
|
||||
// No auth, no router guards needed — the underlying endpoint is public
|
||||
// No auth, no router guards needed - the underlying endpoint is public
|
||||
// and emits only operational data (no row contents, no user identities).
|
||||
|
||||
import { ref, computed, onMounted, onBeforeUnmount } from 'vue';
|
||||
@@ -33,7 +33,7 @@ async function refresh() {
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
// Best-effort history fetch — falls back silently to an empty
|
||||
// Best-effort history fetch - falls back silently to an empty
|
||||
// spark-bar so the page still loads if the table is missing.
|
||||
try {
|
||||
const r = await fetch('/api/health/history?limit=60', { cache: 'no-store' });
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Lightweight Nox syntax highlighter for static code previews (landing
|
||||
// page, docs, examples page). Matches the palette used by the IDE.
|
||||
// Not suitable for interactive editing — for that use the CodeMirror mode
|
||||
// Not suitable for interactive editing - for that use the CodeMirror mode
|
||||
// in ./language.js.
|
||||
|
||||
const HARD_KEYWORDS = new Set([
|
||||
|
||||
@@ -91,7 +91,7 @@ export const noxLanguage = StreamLanguage.define({
|
||||
}
|
||||
if (SOFT_KEYWORDS.has(word)) return 'keyword';
|
||||
if (TYPE_NAMES.has(word)) return 'typeName';
|
||||
// Catalog identifiers like M31, NGC_7000 — anything starting with uppercase
|
||||
// Catalog identifiers like M31, NGC_7000 - anything starting with uppercase
|
||||
// gets a soft "constant" highlight unless it's already a known type.
|
||||
if (/^[A-Z]/.test(word)) return 'variableConstant';
|
||||
return 'variableName';
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
// Tiny markdown renderer used by the IDE doc modal and the standalone
|
||||
// /nox/docs page. Handles enough of the format to read our own docs:
|
||||
// headings, fenced code, inline code, bullet lists, paragraphs, bold,
|
||||
// links, and pipe tables. Not spec-conformant — never feed it untrusted
|
||||
// links, and pipe tables. Not spec-conformant - never feed it untrusted
|
||||
// markdown.
|
||||
|
||||
function escape(s) {
|
||||
// Escape quotes too: inline() interpolates link hrefs/titles into double-quoted
|
||||
// attributes, so an unescaped " in a [label](href) lets crafted markdown break
|
||||
// out of the attribute and inject event handlers (DOM-XSS). Matters because the
|
||||
// Lab renders LLM output through this — a prompt-injection surface.
|
||||
// Lab renders LLM output through this - a prompt-injection surface.
|
||||
return s.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>')
|
||||
.replace(/"/g, '"').replace(/'/g, ''');
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Changelog
|
||||
|
||||
## 0.1.0 — initial release
|
||||
## 0.1.0 - initial release
|
||||
|
||||
- TextMate grammar for `.nox` (keywords, types, units, quantities, percent, decorators, string interpolation)
|
||||
- Snippets for `session`, `parallel`, `safety on`, `policy when`, `use telescope`, `use dome`, `use camera`, `for target in`, `repeat`, `slew`, `expose`, `park + close`, `import`
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Nox Language — VSCode extension
|
||||
# Nox Language - VSCode extension
|
||||
|
||||
Syntax highlighting and snippets for [Nox](https://gitlab.com/paulhitt/caelum/-/tree/main/nox), the typed DSL for telescope and dome control that ships with [Caelum](https://gitlab.com/paulhitt/caelum).
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ function cfg(prefix) {
|
||||
waitForConnections: true,
|
||||
connectionLimit: parseInt(process.env.MYSQL_POOL_LIMIT || '10', 10),
|
||||
multipleStatements: true, // needed for the DDL block in initDb()
|
||||
decimalNumbers: true, // return DECIMAL/AVG() as JS Number, not String — frontend calls .toFixed() on aggregates
|
||||
decimalNumbers: true, // return DECIMAL/AVG() as JS Number, not String - frontend calls .toFixed() on aggregates
|
||||
charset: 'utf8mb4',
|
||||
// Emit DATETIME/TIMESTAMP/DATE as ISO-8601 UTC strings so frontend `new Date(x)`
|
||||
// parses identically across Chrome/Firefox/Safari. Without this, mysql2 returns
|
||||
@@ -38,7 +38,7 @@ function cfg(prefix) {
|
||||
}
|
||||
|
||||
if (!process.env.MYSQL_DATABASE) {
|
||||
log.warn('[db] MYSQL_DATABASE is not set — server will fail to connect.');
|
||||
log.warn('[db] MYSQL_DATABASE is not set - server will fail to connect.');
|
||||
}
|
||||
|
||||
export const appPool = mysql.createPool(cfg('MYSQL_'));
|
||||
@@ -47,7 +47,7 @@ const spacedbName = process.env.MYSQL_SPACEDB_DATABASE || '';
|
||||
export const spacedbPool = spacedbName ? mysql.createPool(cfg('MYSQL_SPACEDB_')) : null;
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* Async helpers — drop-in replacements for better-sqlite3 patterns */
|
||||
/* Async helpers - drop-in replacements for better-sqlite3 patterns */
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
function wrapResult(r) {
|
||||
|
||||
@@ -59,10 +59,10 @@ export function translateDdl(mysqlDdl) {
|
||||
// KEY name (col, col) → drop (use CREATE INDEX separately)
|
||||
.replace(/(^|,)\s*UNIQUE\s+KEY\s+\w+\s*\(([^)]+)\)/gim, '$1 UNIQUE ($2)')
|
||||
.replace(/(^|,)\s*KEY\s+\w+\s*\([^)]+\)\s*(?=,|\s*\))/gim, '$1')
|
||||
// Strip MySQL-style FULLTEXT/SPATIAL key declarations (defensive — not
|
||||
// Strip MySQL-style FULLTEXT/SPATIAL key declarations (defensive - not
|
||||
// currently used in our schema but harmless).
|
||||
.replace(/(^|,)\s*(FULLTEXT|SPATIAL)\s+KEY\s+\w+\s*\([^)]+\)\s*(?=,|\s*\))/gim, '$1')
|
||||
// Column types. Order matters — match longest first.
|
||||
// Column types. Order matters - match longest first.
|
||||
.replace(/\bVARCHAR\s*\(\s*\d+\s*\)/gi, 'TEXT')
|
||||
.replace(/\bCHAR\s*\(\s*\d+\s*\)/gi, 'TEXT')
|
||||
.replace(/\bLONGTEXT\b/gi, 'TEXT')
|
||||
@@ -183,16 +183,16 @@ export const appPool = {
|
||||
};
|
||||
|
||||
// SpaceDB on SQLite. The catalog ships as a ~1.4 GB Django-schema SQLite
|
||||
// file (db.sqlite3 at the repo root) — the same source migrate.js pushes
|
||||
// file (db.sqlite3 at the repo root) - the same source migrate.js pushes
|
||||
// into MySQL. In the SQLite dev path there's no MySQL to point at, so we
|
||||
// read that file directly and expose a mysql2-compatible pool shim. The
|
||||
// /api/spacedb route only ever does `const [rows] = await pool.query(...)`
|
||||
// with portable SQL (SELECT, ?, LIMIT, backtick quotes — all valid in
|
||||
// with portable SQL (SELECT, ?, LIMIT, backtick quotes - all valid in
|
||||
// SQLite), so it works unchanged.
|
||||
//
|
||||
// Resolution order: SPACEDB_SQLITE_PATH → SPACEDB_PATH (also used by
|
||||
// migrate.js) → <repoRoot>/db.sqlite3. If the file is absent we export
|
||||
// null so the route degrades to a clean 503 instead of crashing — same
|
||||
// null so the route degrades to a clean 503 instead of crashing - same
|
||||
// contract as a missing MySQL spacedb.
|
||||
function resolveSpacedbPath() {
|
||||
const override = process.env.SPACEDB_SQLITE_PATH || process.env.SPACEDB_PATH;
|
||||
@@ -203,7 +203,7 @@ function resolveSpacedbPath() {
|
||||
function buildSqliteSpacedbPool() {
|
||||
const file = resolveSpacedbPath();
|
||||
if (!fs.existsSync(file)) {
|
||||
log.warn(`[db] spacedb sqlite not found at ${file} — SpaceDB disabled`);
|
||||
log.warn(`[db] spacedb sqlite not found at ${file} - SpaceDB disabled`);
|
||||
return null;
|
||||
}
|
||||
let _sdb = null;
|
||||
@@ -236,7 +236,7 @@ export const spacedbPool = buildSqliteSpacedbPool();
|
||||
//
|
||||
// For fresh databases the translated DDL creates everything. For existing
|
||||
// databases (seeded before later columns landed) we run COLUMN_MIGRATIONS
|
||||
// via SQLite's PRAGMA table_info to add anything missing — same shape as
|
||||
// via SQLite's PRAGMA table_info to add anything missing - same shape as
|
||||
// the MySQL addColumnIfMissing path.
|
||||
export async function initDb() {
|
||||
const conn = open();
|
||||
@@ -253,7 +253,7 @@ export async function initDb() {
|
||||
// SQLite ALTER doesn't support every MySQL spec verbatim. Most fail
|
||||
// due to defaults referencing functions or NOT NULL without a default
|
||||
// on a populated table. Log and continue so one bad row doesn't block
|
||||
// boot — callers handling that column will see NULL until it's set.
|
||||
// boot - callers handling that column will see NULL until it's set.
|
||||
log.warn(`[db-sqlite] column migration ${table}.${column} skipped: ${e.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
// DB_KIND=sqlite SQLITE_PATH=/tmp/c.db # explicit file
|
||||
//
|
||||
// 2. SpaceDB (1.5M-row NASA/JPL catalog)
|
||||
// Read-only. Always MySQL — the dump doesn't fit cleanly in
|
||||
// Read-only. Always MySQL - the dump doesn't fit cleanly in
|
||||
// SQLite and there's no scenario where the catalog needs the
|
||||
// same backend as the app DB. Enabled whenever
|
||||
// MYSQL_SPACEDB_DATABASE is set, regardless of DB_KIND. So a
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
// The HTTP server and background tick services start at boot *before*
|
||||
// bootDb()'s initDb() has finished applying the schema (initDb runs in the
|
||||
// background so /api/health is reachable while the DB is cold). Services
|
||||
// that query tables on their very first tick — public-feed, health-history —
|
||||
// that query tables on their very first tick - public-feed, health-history -
|
||||
// would otherwise race the `CREATE TABLE IF NOT EXISTS` DDL and log a
|
||||
// spurious "table doesn't exist" warning that surfaces in Sentry on every
|
||||
// cold start. They `await dbReady` (or `dbReady.then(...)`) before the first
|
||||
// query; index.js calls markDbReady() once initDb() succeeds.
|
||||
//
|
||||
// Only the first tick needs gating — by the time a service's interval fires
|
||||
// Only the first tick needs gating - by the time a service's interval fires
|
||||
// (15s/60s later) the idempotent DDL has long completed.
|
||||
|
||||
let resolveReady;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// The canonical CREATE TABLE in schema-mysql.js already includes these
|
||||
// columns for fresh installs. This list exists for EXISTING databases
|
||||
// (Mysql production deploys or SQLite files seeded before the columns
|
||||
// landed) — each backend's initDb() walks the list and ALTER TABLEs in
|
||||
// landed) - each backend's initDb() walks the list and ALTER TABLEs in
|
||||
// anything missing.
|
||||
//
|
||||
// Type spellings here are MySQL-flavored but pass through to SQLite via
|
||||
|
||||
@@ -194,7 +194,7 @@ CREATE TABLE IF NOT EXISTS observations (
|
||||
-- onto the observation itself: site coordinates, telescope capabilities,
|
||||
-- ephemeris source + timing, and the exact Nox program that drove it.
|
||||
-- A future site rename, telescope reconfiguration, or catalog update does
|
||||
-- not retroactively change what an observation "saw" — reproducibility
|
||||
-- not retroactively change what an observation "saw" - reproducibility
|
||||
-- and provenance survive deletions.
|
||||
site_lat DOUBLE,
|
||||
site_lng DOUBLE,
|
||||
@@ -224,7 +224,7 @@ CREATE TABLE IF NOT EXISTS observations (
|
||||
-- AAVSO for variable stars). The Research view (/research) renders these
|
||||
-- as actionable cards; "Schedule" creates an Observation snapshot. We
|
||||
-- cache the targets in our own table rather than hitting external APIs
|
||||
-- on every page load — a background refresher (TODO) keeps them current.
|
||||
-- on every page load - a background refresher (TODO) keeps them current.
|
||||
CREATE TABLE IF NOT EXISTS research_targets (
|
||||
id VARCHAR(64) PRIMARY KEY,
|
||||
category VARCHAR(32) NOT NULL, -- neo | exoplanet_transit | variable_star
|
||||
@@ -467,7 +467,7 @@ CREATE TABLE IF NOT EXISTS user_preferences (
|
||||
muted_notification_types TEXT,
|
||||
-- Per-user Anthropic API key for the /research Caelum Lab tool. Stored
|
||||
-- in cleartext (same trust boundary as other tokens in this DB); never
|
||||
-- echoed back in full from the preferences API — only the last-4 suffix.
|
||||
-- echoed back in full from the preferences API - only the last-4 suffix.
|
||||
anthropic_api_key TEXT,
|
||||
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
CONSTRAINT fk_user_prefs_user FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Idempotent database upgrade.
|
||||
*
|
||||
* Run this after deploying code that changes the schema (new tables, new
|
||||
* columns). Safe to run repeatedly — it never drops or rewrites data.
|
||||
* columns). Safe to run repeatedly - it never drops or rewrites data.
|
||||
*
|
||||
* node src/db-upgrade.js # upgrade the active backend (DB_KIND)
|
||||
* npm run db:upgrade # from server/
|
||||
@@ -14,7 +14,7 @@
|
||||
* 1. Applies the full schema DDL. Every CREATE TABLE is
|
||||
* `CREATE TABLE IF NOT EXISTS`, so existing tables/data are untouched
|
||||
* and any newly-added table is created.
|
||||
* 2. Runs COLUMN_MIGRATIONS — each entry is add-column-if-missing, so a
|
||||
* 2. Runs COLUMN_MIGRATIONS - each entry is add-column-if-missing, so a
|
||||
* column added in a later release lands on databases seeded before it
|
||||
* without touching existing rows.
|
||||
*
|
||||
@@ -57,7 +57,7 @@ try {
|
||||
}
|
||||
|
||||
log.info(
|
||||
`[db-upgrade] ok — ${tables.length} tables, ${Date.now() - started}ms`
|
||||
`[db-upgrade] ok - ${tables.length} tables, ${Date.now() - started}ms`
|
||||
);
|
||||
if (tables.length) log.info(`[db-upgrade] tables: ${tables.join(', ')}`);
|
||||
|
||||
|
||||
+14
-14
@@ -1,4 +1,4 @@
|
||||
// MUST be the first import — populates process.env before auth.js (and
|
||||
// MUST be the first import - populates process.env before auth.js (and
|
||||
// anything else) evaluates JWT_SECRET / ANTHROPIC_API_KEY / MYSQL_* at
|
||||
// module load time. ESM hoists imports and runs side-effects in source
|
||||
// order, so putting the dotenv call in a separate preload module is
|
||||
@@ -56,7 +56,7 @@ import { initSentry } from './services/sentry.js';
|
||||
|
||||
// The version, read from server/package.json at boot. npm_package_version is
|
||||
// only set when started via npm; the Docker image runs `node server.js`, so a
|
||||
// hardcoded fallback is what actually gets served — and it goes stale silently
|
||||
// hardcoded fallback is what actually gets served - and it goes stale silently
|
||||
// on every release. Read the real thing instead.
|
||||
function readPkgVersion() {
|
||||
try {
|
||||
@@ -68,17 +68,17 @@ const PKG_VERSION = readPkgVersion();
|
||||
|
||||
// Fire Sentry init early. Async because @sentry/node is lazy-imported only
|
||||
// when actually enabled (NODE_ENV=production or ENABLE_SENTRY=true), so
|
||||
// tests + dev don't pay the load cost. Fire-and-forget — by the time the
|
||||
// tests + dev don't pay the load cost. Fire-and-forget - by the time the
|
||||
// first error happens, init has long since completed.
|
||||
initSentry({ version: PKG_VERSION || 'unknown' }).catch(() => {});
|
||||
|
||||
const app = express();
|
||||
const server = createServer(app);
|
||||
|
||||
// Explicit CORS allowlist instead of a wildcard — see config/origins.js, which
|
||||
// Explicit CORS allowlist instead of a wildcard - see config/origins.js, which
|
||||
// also serves routes that need to build an absolute URL back into the SPA.
|
||||
function corsOrigin(origin, cb) {
|
||||
// No Origin header = same-origin, curl, or server-to-server — allow.
|
||||
// No Origin header = same-origin, curl, or server-to-server - allow.
|
||||
if (!origin || ALLOWED_ORIGINS.includes(origin)) return cb(null, true);
|
||||
cb(new Error('Not allowed by CORS'));
|
||||
}
|
||||
@@ -87,11 +87,11 @@ const io = new SocketIO(server, { cors: { origin: ALLOWED_ORIGINS } });
|
||||
app.set('io', io);
|
||||
|
||||
// Trust the first reverse-proxy hop so req.ip reflects X-Forwarded-For
|
||||
// (the Traefik edge proxy in prod) — needed for accurate per-IP rate limiting.
|
||||
// (the Traefik edge proxy in prod) - needed for accurate per-IP rate limiting.
|
||||
app.set('trust proxy', 1);
|
||||
|
||||
// Canonical host: 301 www.* → apex in production (SPA + API share one origin,
|
||||
// so this keeps a single canonical URL). Generic — strips a leading "www.".
|
||||
// so this keeps a single canonical URL). Generic - strips a leading "www.".
|
||||
app.use((req, res, next) => {
|
||||
const host = req.headers.host || '';
|
||||
if (process.env.NODE_ENV === 'production' && host.startsWith('www.')) {
|
||||
@@ -160,7 +160,7 @@ app.get('/api/health/history', async (req, res) => {
|
||||
res.json({ probes: rows });
|
||||
});
|
||||
|
||||
// External probe receiver — scripts/probe-uptime.mjs POSTs here from
|
||||
// External probe receiver - scripts/probe-uptime.mjs POSTs here from
|
||||
// cron/launchd so external observations end up in the same spark-bar.
|
||||
// Shared-secret only; if EXTERNAL_PROBE_SECRET is unset on the server
|
||||
// the endpoint refuses ALL requests (fail-closed). Same insert path
|
||||
@@ -322,7 +322,7 @@ const stopTelescopePositions = safeInterval('telescope-position', async () => {
|
||||
}, 1000, { unref: true });
|
||||
|
||||
// JSON error handler. LimitExceeded errors from services/limits.js
|
||||
// carry a structured `body` payload — pass it through verbatim so the
|
||||
// carry a structured `body` payload - pass it through verbatim so the
|
||||
// client can render "you hit the cap on archive.frames_per_user (200/200)"
|
||||
// without parsing the message string.
|
||||
app.use((err, req, res, next) => {
|
||||
@@ -341,7 +341,7 @@ const PORT = process.env.PORT || 3002;
|
||||
// retry with capped exponential backoff. /api/health stays at 503 until the
|
||||
// app DB becomes reachable. The previous behavior (process.exit on first
|
||||
// failure) caused docker compose to enter a tight restart loop on transient
|
||||
// MySQL outages — see TODOS.md item K.
|
||||
// MySQL outages - see TODOS.md item K.
|
||||
const NODE_ENV = process.env.NODE_ENV || 'development';
|
||||
server.listen(PORT, () => {
|
||||
log.info(`Caelum API running on http://localhost:${PORT} env=${NODE_ENV}`);
|
||||
@@ -361,11 +361,11 @@ async function autoSeedIfEmpty() {
|
||||
const row = await db.get('SELECT COUNT(*) AS c FROM users', []);
|
||||
userCount = row?.c ?? 0;
|
||||
} catch {
|
||||
return; // schema not ready / table missing — initDb path owns that
|
||||
return; // schema not ready / table missing - initDb path owns that
|
||||
}
|
||||
if (userCount > 0) return;
|
||||
|
||||
log.info('[caelum] empty database detected — auto-seeding…');
|
||||
log.info('[caelum] empty database detected - auto-seeding…');
|
||||
const { spawn } = await import('node:child_process');
|
||||
const seedScript = resolve(dirname(fileURLToPath(import.meta.url)), 'seed.js');
|
||||
await new Promise((res) => {
|
||||
@@ -375,7 +375,7 @@ async function autoSeedIfEmpty() {
|
||||
});
|
||||
child.on('exit', (code) => {
|
||||
log.info(code === 0
|
||||
? '[caelum] auto-seed complete — data is ready'
|
||||
? '[caelum] auto-seed complete - data is ready'
|
||||
: `[caelum] auto-seed exited with code ${code}; continuing anyway`);
|
||||
res();
|
||||
});
|
||||
@@ -392,7 +392,7 @@ async function autoSeedIfEmpty() {
|
||||
for (;;) {
|
||||
try {
|
||||
await initDb();
|
||||
// Schema is now applied — release the boot-time tick services that
|
||||
// Schema is now applied - release the boot-time tick services that
|
||||
// gate their first DB query on this (public-feed, health-history).
|
||||
markDbReady();
|
||||
if (attempt > 0) log.info(`[caelum] DB reachable after ${attempt + 1} attempts`);
|
||||
|
||||
@@ -13,7 +13,7 @@ function hashToken(t) { return crypto.createHash('sha256').update(t).digest('hex
|
||||
|
||||
// Methods that only read state. A `read`-scoped API token is allowed these;
|
||||
// anything that mutates requires `write` (or `daemon`). JWT sessions are not
|
||||
// scope-limited — a logged-in human has full account power.
|
||||
// scope-limited - a logged-in human has full account power.
|
||||
const READ_METHODS = new Set(['GET', 'HEAD', 'OPTIONS']);
|
||||
function tokenAllowsMethod(scopes, method) {
|
||||
const set = new Set(String(scopes || '').split(',').map(s => s.trim()).filter(Boolean));
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// Shared permission helpers. Centralized so every route uses the same
|
||||
// definition of "can this user write to this site's hardware" — the
|
||||
// definition of "can this user write to this site's hardware" - the
|
||||
// audit found many routes with no check at all, which made it possible
|
||||
// for any authenticated user to act on another operator's gear.
|
||||
//
|
||||
// All assert* helpers send a 403 response and return false on deny —
|
||||
// All assert* helpers send a 403 response and return false on deny -
|
||||
// the caller should `if (!await assertCanEditSite(...)) return;`.
|
||||
|
||||
import db from '../config/database.js';
|
||||
@@ -25,7 +25,7 @@ export async function canEditSite(siteId, user) {
|
||||
}
|
||||
|
||||
// True if user can schedule observations / commit work to this telescope.
|
||||
// Same trust as canEditSite — owner, operator, OR observer role at site.
|
||||
// Same trust as canEditSite - owner, operator, OR observer role at site.
|
||||
// (Observer can commit observations through the daemon job queue.)
|
||||
export async function canScheduleOnTelescope(telescopeId, user) {
|
||||
if (!telescopeId) return false;
|
||||
@@ -73,7 +73,7 @@ export async function canViewFrame(frame, user) {
|
||||
if (frame.uploader_id === user.id) return true;
|
||||
return canScheduleOnTelescope(frame.telescope_id, user);
|
||||
}
|
||||
// canEditFrame: who may mutate a frame's derived data (crossmatch/analysis) —
|
||||
// canEditFrame: who may mutate a frame's derived data (crossmatch/analysis) -
|
||||
// uploader, site member, or admin. Mirrors the PUT/DELETE frame checks.
|
||||
export async function canEditFrame(frame, user) {
|
||||
if (!frame) return false;
|
||||
@@ -91,7 +91,7 @@ export async function assertCanEditSite(siteId, user, res, label = 'this site')
|
||||
}
|
||||
export async function assertCanScheduleOnTelescope(telescopeId, user, res) {
|
||||
if (await canScheduleOnTelescope(telescopeId, user)) return true;
|
||||
res.status(403).json({ error: "You don't have permission to schedule on that telescope — it belongs to a site where you're not a member." });
|
||||
res.status(403).json({ error: "You don't have permission to schedule on that telescope - it belongs to a site where you're not a member." });
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
* SQLite → MySQL migration script.
|
||||
*
|
||||
* Reads connection strings from .env:
|
||||
* MYSQL_APP_URL — target for observatory.db (app data)
|
||||
* MYSQL_SPACEDB_URL — target for db.sqlite3 (SpaceDB catalog)
|
||||
* MYSQL_APP_URL - target for observatory.db (app data)
|
||||
* MYSQL_SPACEDB_URL - target for db.sqlite3 (SpaceDB catalog)
|
||||
*
|
||||
* URL format: mysql://user:pass@host:port/dbname
|
||||
*
|
||||
|
||||
@@ -135,7 +135,7 @@ router.post('/upload', authenticate, upload.single('file'), async (req, res) =>
|
||||
try { fs.unlinkSync(req.file.path); } catch {}
|
||||
return res.status(400).json({ error: `invalid frame_type "${frame_type}"` });
|
||||
}
|
||||
// Telescope perm — caller must be a member of the owning site (or admin).
|
||||
// Telescope perm - caller must be a member of the owning site (or admin).
|
||||
// Without this any authenticated user could attribute a frame to anyone's
|
||||
// telescope and consume their archive against another user's quota.
|
||||
const ok = await assertCanScheduleOnTelescope(telescope_id, req.user, res);
|
||||
@@ -143,7 +143,7 @@ router.post('/upload', authenticate, upload.single('file'), async (req, res) =>
|
||||
|
||||
// Archive caps: frame count + total storage. Both checks happen
|
||||
// BEFORE the INSERT so a 402 doesn't leave an orphan file on disk
|
||||
// — but if a check fails we still need to clean up the just-uploaded
|
||||
// - but if a check fails we still need to clean up the just-uploaded
|
||||
// multer tmp file.
|
||||
try {
|
||||
assertLimit(req.user, 'archive.frames_per_user', await framesByUser(req.user.id));
|
||||
@@ -183,14 +183,14 @@ router.post('/upload', authenticate, upload.single('file'), async (req, res) =>
|
||||
file_url, req.file.size, visibility || 'private',
|
||||
description || null, JSON.stringify(tagsArr), JSON.stringify(fits_headers)]);
|
||||
|
||||
// observation_id is optional — when a daemon uploads frames during a
|
||||
// observation_id is optional - when a daemon uploads frames during a
|
||||
// scheduled observation it sets this to link the frame back to the
|
||||
// observation record. JSON-body POST handler below has the same wiring.
|
||||
|
||||
invalidateUsage(req.user.id, 'archive.frames_per_user');
|
||||
invalidateUsage(req.user.id, 'archive.storage_mb_per_user');
|
||||
|
||||
// Fire-and-forget — pipeline runs (plate-solve/extract/photometry) in
|
||||
// Fire-and-forget - pipeline runs (plate-solve/extract/photometry) in
|
||||
// the background and updates analysis_json when it finishes. We don't
|
||||
// await so a slow stage never blocks the upload response.
|
||||
ingestFrame(id);
|
||||
@@ -239,7 +239,7 @@ router.put('/:id', authenticate, async (req, res) => {
|
||||
// public or rewrite its target/visibility/tags.
|
||||
if (req.user.role !== 'admin' && frame.uploader_id !== req.user.id
|
||||
&& !await canScheduleOnTelescope(frame.telescope_id, req.user)) {
|
||||
return res.status(403).json({ error: "You can't edit this frame — you're not the uploader or a member of its site." });
|
||||
return res.status(403).json({ error: "You can't edit this frame - you're not the uploader or a member of its site." });
|
||||
}
|
||||
|
||||
const { visibility, description, tags, target_name } = req.body;
|
||||
@@ -283,7 +283,7 @@ router.post('/:id/comments', authenticate, async (req, res) => {
|
||||
});
|
||||
|
||||
router.delete('/:frameId/comments/:commentId', authenticate, async (req, res) => {
|
||||
// Previously: `? = "admin"` — that's not standard SQL string comparison and
|
||||
// Previously: `? = "admin"` - that's not standard SQL string comparison and
|
||||
// depends on dialect quirks (MySQL strict mode or ANSI_QUOTES breaks it).
|
||||
// Branch in JS instead so the query is unambiguous on both backends.
|
||||
if (req.user.role === 'admin') {
|
||||
@@ -328,7 +328,7 @@ router.post('/:id/bookmark', authenticate, async (req, res) => {
|
||||
router.post('/:id/sdss-crossmatch', authenticate, async (req, res) => {
|
||||
const frame = await db.get('SELECT ra, dec_coord, visibility, uploader_id, telescope_id FROM archive_frames WHERE id = ?', [req.params.id]);
|
||||
if (!frame) return res.status(404).json({ error: 'Frame not found' });
|
||||
// Writes sdss_crossmatch_json onto the frame — restrict to uploader/site/admin.
|
||||
// Writes sdss_crossmatch_json onto the frame - restrict to uploader/site/admin.
|
||||
if (!await canEditFrame(frame, req.user)) return res.status(403).json({ error: "You can't modify this frame." });
|
||||
if (frame.ra == null || frame.dec_coord == null) return res.status(400).json({ error: 'Frame has no coordinates for cross-matching' });
|
||||
|
||||
@@ -368,7 +368,7 @@ router.post('/:id/sdss-crossmatch', authenticate, async (req, res) => {
|
||||
router.post('/:id/analyze', authenticate, async (req, res) => {
|
||||
const frame = await db.get('SELECT * FROM archive_frames WHERE id = ?', [req.params.id]);
|
||||
if (!frame) return res.status(404).json({ error: 'Frame not found' });
|
||||
// Writes analysis_json onto the frame — restrict to uploader/site/admin.
|
||||
// Writes analysis_json onto the frame - restrict to uploader/site/admin.
|
||||
if (!await canEditFrame(frame, req.user)) return res.status(403).json({ error: "You can't modify this frame." });
|
||||
|
||||
let headers = {};
|
||||
@@ -385,13 +385,13 @@ router.post('/:id/analyze', authenticate, async (req, res) => {
|
||||
const fwhm = frame.fwhm_arcsec;
|
||||
analysis.quality.seeing = fwhm;
|
||||
analysis.quality.seeing_rating = fwhm < 1.5 ? 'excellent' : fwhm < 2.5 ? 'good' : fwhm < 4 ? 'fair' : 'poor';
|
||||
if (fwhm > 3) analysis.recommendations.push('Seeing is poor — consider shorter exposures or waiting for better conditions');
|
||||
if (fwhm > 3) analysis.recommendations.push('Seeing is poor - consider shorter exposures or waiting for better conditions');
|
||||
}
|
||||
|
||||
if (frame.airmass) {
|
||||
analysis.quality.airmass = frame.airmass;
|
||||
analysis.quality.airmass_rating = frame.airmass < 1.3 ? 'excellent' : frame.airmass < 1.5 ? 'good' : frame.airmass < 2.0 ? 'fair' : 'poor';
|
||||
if (frame.airmass > 2.0) analysis.recommendations.push('High airmass — target was low on horizon, expect atmospheric dispersion');
|
||||
if (frame.airmass > 2.0) analysis.recommendations.push('High airmass - target was low on horizon, expect atmospheric dispersion');
|
||||
}
|
||||
|
||||
if (frame.exposure_time) {
|
||||
@@ -411,7 +411,7 @@ router.post('/:id/analyze', authenticate, async (req, res) => {
|
||||
if (frame.ra != null && frame.dec_coord != null) {
|
||||
analysis.metadata.coordinates = { ra: frame.ra, dec: frame.dec_coord };
|
||||
analysis.metadata.wcs_solved = !!frame.wcs_solved;
|
||||
if (!frame.wcs_solved) analysis.recommendations.push('Frame is not plate-solved — consider running astrometric calibration');
|
||||
if (!frame.wcs_solved) analysis.recommendations.push('Frame is not plate-solved - consider running astrometric calibration');
|
||||
}
|
||||
|
||||
if (headers.INSTRUME) analysis.metadata.instrument = headers.INSTRUME;
|
||||
@@ -430,7 +430,7 @@ router.post('/:id/analyze', authenticate, async (req, res) => {
|
||||
analysis.quality.snr_rating = snr > 15 ? 'excellent' : snr > 8 ? 'good' : snr > 4 ? 'fair' : 'poor';
|
||||
}
|
||||
|
||||
if (analysis.recommendations.length === 0) analysis.recommendations.push('No issues detected — frame quality looks good');
|
||||
if (analysis.recommendations.length === 0) analysis.recommendations.push('No issues detected - frame quality looks good');
|
||||
|
||||
await db.run('UPDATE archive_frames SET analysis_json = ? WHERE id = ?', [JSON.stringify(analysis), req.params.id]);
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import { getOrCreateClient, removeClient } from '../services/astra-client.js';
|
||||
const router = Router();
|
||||
|
||||
// Resolve an Astra instance's owning site for permission checks. Astra
|
||||
// instances drive physical hardware (slew, expose, open dome) — every
|
||||
// instances drive physical hardware (slew, expose, open dome) - every
|
||||
// mutating endpoint MUST gate on site membership, not just authentication.
|
||||
async function loadInstanceSite(instanceId) {
|
||||
return db.get('SELECT site_id FROM astra_instances WHERE id = ?', [instanceId]);
|
||||
@@ -274,7 +274,7 @@ router.get('/downtimes', authenticate, async (req, res) => {
|
||||
router.post('/downtimes', authenticate, async (req, res) => {
|
||||
const { site_id, enclosure_id, telescope_id, reason, start_time, end_time, description } = req.body;
|
||||
if (!site_id || !start_time || !end_time) return res.status(400).json({ error: 'site_id, start_time, and end_time are required' });
|
||||
// end must be strictly after start — otherwise a one-second-wide downtime
|
||||
// end must be strictly after start - otherwise a one-second-wide downtime
|
||||
// can poison conflict checks.
|
||||
if (new Date(end_time) <= new Date(start_time)) {
|
||||
return res.status(400).json({ error: 'end_time must be after start_time' });
|
||||
|
||||
@@ -50,7 +50,7 @@ router.get('/my', authenticate, async (req, res) => {
|
||||
// Every booking the user legitimately has visibility into, so the Schedule
|
||||
// calendar agrees with the Request-Group Backlog shown on the same page.
|
||||
// Before this, the calendar used /bookings/my (own bookings only) while the
|
||||
// backlog showed proposal-wide RG state — a request group could read
|
||||
// backlog showed proposal-wide RG state - a request group could read
|
||||
// "SCHEDULED · 1 booked" yet never appear on the calendar because the
|
||||
// booking belonged to another proposal member. Union of:
|
||||
// 1. bookings the user owns
|
||||
|
||||
@@ -89,7 +89,7 @@ router.post('/telescopes', authenticate, async (req, res) => {
|
||||
if (!enc) return res.status(404).json({ error: 'Enclosure not found' });
|
||||
if (!(await canEditSite(req.user.id, enc.site_id)) && req.user.role !== 'admin') return res.status(403).json({ error: 'Not authorized' });
|
||||
|
||||
// Limit applies to the SITE OWNER, not the editor — keeps the cap
|
||||
// Limit applies to the SITE OWNER, not the editor - keeps the cap
|
||||
// meaningful when an editor adds telescopes to someone else's site.
|
||||
const site = await db.get('SELECT owner_id FROM sites WHERE id = ?', [enc.site_id]);
|
||||
if (site?.owner_id) {
|
||||
|
||||
@@ -130,7 +130,7 @@ router.post('/telescopes/:id/slew', authenticate, async (req, res) => {
|
||||
if (!(await canEditSite(tel.site_id, req.user))) return res.status(403).json({ error: 'Not authorized' });
|
||||
const { ra, dec } = req.body;
|
||||
if (ra == null || dec == null) return res.status(400).json({ error: 'ra and dec required' });
|
||||
// Hardware can't physically slew to nonsense — refuse before sending to driver.
|
||||
// Hardware can't physically slew to nonsense - refuse before sending to driver.
|
||||
if (typeof ra !== 'number' || ra < 0 || ra >= 24) return res.status(400).json({ error: 'ra must be 0..24 hours' });
|
||||
if (typeof dec !== 'number' || dec < -90 || dec > 90) return res.status(400).json({ error: 'dec must be -90..+90 degrees' });
|
||||
if (tel.driver_type === 'alpaca') {
|
||||
@@ -162,7 +162,7 @@ router.put('/instruments/:id/driver', authenticate, async (req, res) => {
|
||||
router.get('/instruments/:id/state', authenticate, async (req, res) => {
|
||||
const inst = await loadInstrument(req.params.id);
|
||||
if (!inst) return res.status(404).json({ error: 'Instrument not found' });
|
||||
// Live state via Alpaca isn't wired yet — return the DB record only. When
|
||||
// Live state via Alpaca isn't wired yet - return the DB record only. When
|
||||
// we add an instrument driver, populate `live` from a hardware-driver call.
|
||||
res.json({ id: inst.id, name: inst.name, type: inst.type, driver_type: inst.driver_type, live: null });
|
||||
});
|
||||
@@ -170,7 +170,7 @@ router.get('/instruments/:id/state', authenticate, async (req, res) => {
|
||||
// --- Weather Stations ---
|
||||
router.get('/sites/:siteId/weather-stations', authenticate, async (req, res) => {
|
||||
const rows = await db.all(`SELECT * FROM weather_stations WHERE site_id = ? ORDER BY created_at ASC`, [req.params.siteId]);
|
||||
// api_key is a third-party credential (e.g. OpenWeatherMap) — redact for
|
||||
// api_key is a third-party credential (e.g. OpenWeatherMap) - redact for
|
||||
// non-editors. Editors get a `has_api_key` flag instead of the raw value.
|
||||
const isEditor = await canEditSite(req.params.siteId, req.user);
|
||||
for (const r of rows) {
|
||||
@@ -219,7 +219,7 @@ router.delete('/weather-stations/:id', authenticate, async (req, res) => {
|
||||
router.post('/weather-stations/:id/poll', authenticate, async (req, res) => {
|
||||
const ws = await db.get('SELECT * FROM weather_stations WHERE id = ?', [req.params.id]);
|
||||
if (!ws) return res.status(404).json({ error: 'Station not found' });
|
||||
// Polling makes an outbound fetch using the site's stored api_key — restrict
|
||||
// Polling makes an outbound fetch using the site's stored api_key - restrict
|
||||
// to site editors so it can't be abused to burn another site's quota / SSRF.
|
||||
if (!(await canEditSite(ws.site_id, req.user))) return res.status(403).json({ error: 'Not authorized' });
|
||||
try {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// An "observatory daemon" is a small process running at a remote
|
||||
// observatory that polls Caelum for work, executes Nox programs locally
|
||||
// against real hardware drivers, and PUTs results back. This is the same
|
||||
// shape SatNOGS's station daemon uses, adapted for telescopes — the job
|
||||
// shape SatNOGS's station daemon uses, adapted for telescopes - the job
|
||||
// payload carries the full Nox program instead of an RF (freq, mode,
|
||||
// baud) tuple.
|
||||
//
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// GET /api/limits/me — returns the caller's caps and current usage so
|
||||
// GET /api/limits/me - returns the caller's caps and current usage so
|
||||
// the UI can render a "you're at 180/200 frames" panel before they hit
|
||||
// the wall. Unlimited entries (no cap configured) are reported as null
|
||||
// so the client can render them as "∞" rather than a bogus number.
|
||||
|
||||
@@ -27,7 +27,7 @@ function sinceCutoff(since) {
|
||||
const router = Router();
|
||||
|
||||
// Public aggregate counts for the landing page. Unauthenticated by design
|
||||
// — only returns numbers, no user/site/frame identities. Cheap (3 SELECT
|
||||
// - only returns numbers, no user/site/frame identities. Cheap (3 SELECT
|
||||
// COUNTs, all single-table) and cache-friendly on the client.
|
||||
router.get('/public/stats', async (_req, res) => {
|
||||
try {
|
||||
@@ -42,13 +42,13 @@ router.get('/public/stats', async (_req, res) => {
|
||||
telescopes: Number(telescopes?.c) || 0,
|
||||
});
|
||||
} catch {
|
||||
// Don't 500 a public read — return zeros so the landing tile stays
|
||||
// Don't 500 a public read - return zeros so the landing tile stays
|
||||
// graceful when the DB is cold.
|
||||
res.json({ frames: 0, sites: 0, telescopes: 0 });
|
||||
}
|
||||
});
|
||||
|
||||
// Public recent-activity feed for the landing page. Unauth by design —
|
||||
// Public recent-activity feed for the landing page. Unauth by design -
|
||||
// returns aggregated events with NO user PII, NO message bodies, only
|
||||
// what's already public ("M51 captured 3h ago at Mountain Peak"). Pulls
|
||||
// recent frames and confirmed bookings from public+network surfaces only.
|
||||
@@ -56,7 +56,7 @@ router.get('/public/stats', async (_req, res) => {
|
||||
//
|
||||
// One subject appears at most once. A target is normally shot several times
|
||||
// in a night across filters, so "the most recent N frames" collapsed into the
|
||||
// same object repeated — the feed read as "M31 · L, M31 · Ha, M31 · OIII"
|
||||
// same object repeated - the feed read as "M31 · L, M31 · Ha, M31 · OIII"
|
||||
// instead of showing what the network is actually working on. We over-fetch
|
||||
// and keep only the newest row per subject, so the caller still gets `limit`
|
||||
// events but they're `limit` *distinct* ones.
|
||||
@@ -636,7 +636,7 @@ router.get('/stats/:metric', authenticate, async (req, res) => {
|
||||
if (metric === 'users') {
|
||||
// id/username/created_at only. This is the Leaderboard drill-down, open to
|
||||
// any authenticated user, so it must match the public-profile stance in
|
||||
// /users/:username/profile below — email and role are not other people's
|
||||
// /users/:username/profile below - email and role are not other people's
|
||||
// business, and every other metric here is scoped to public/network too.
|
||||
cols = 'id, username, created_at';
|
||||
body = `FROM users${cutoff ? ' WHERE created_at >= ?' : ''}`;
|
||||
@@ -652,7 +652,7 @@ router.get('/stats/:metric', authenticate, async (req, res) => {
|
||||
body = `FROM telescopes t JOIN enclosures e ON t.enclosure_id = e.id JOIN sites s ON e.site_id = s.id WHERE s.visibility IN ('public','network')`;
|
||||
order = 'ORDER BY t.aperture_mm DESC';
|
||||
description = 'Telescopes at public + network observatories (window does not filter telescopes)';
|
||||
// No cutoff filter for telescopes — but skip the param push if cutoff is set.
|
||||
// No cutoff filter for telescopes - but skip the param push if cutoff is set.
|
||||
} else if (metric === 'public_frames') {
|
||||
cols = 'af.id, af.target_name, af.filter, af.exposure_time, af.created_at, u.username as uploader, t.name as telescope';
|
||||
body = `FROM archive_frames af LEFT JOIN users u ON af.uploader_id = u.id LEFT JOIN telescopes t ON af.telescope_id = t.id WHERE af.visibility IN ('public','network')${cutoff ? ' AND af.created_at >= ?' : ''}`;
|
||||
@@ -751,7 +751,7 @@ router.get('/leaderboard', authenticate, async (req, res) => {
|
||||
|
||||
// --- User profile (public stats) ---
|
||||
router.get('/users/:username/profile', authenticate, async (req, res) => {
|
||||
// Public profile — do NOT expose email or role to other users.
|
||||
// Public profile - do NOT expose email or role to other users.
|
||||
const u = await db.get('SELECT id, username, created_at FROM users WHERE username = ?', [req.params.username]);
|
||||
if (!u) return res.status(404).json({ error: 'User not found' });
|
||||
const sites_owned = await db.all(`SELECT id, name, code, visibility FROM sites WHERE owner_id = ? AND visibility IN ('public','network')`, [u.id]);
|
||||
|
||||
@@ -18,7 +18,7 @@ import { log } from '../services/log.js';
|
||||
const router = Router();
|
||||
|
||||
// `mode: 'real'` reaches live telescope drivers and MUST be authenticated AND
|
||||
// carry an explicit `confirmed: true` flag (defense in depth — the client UI
|
||||
// carry an explicit `confirmed: true` flag (defense in depth - the client UI
|
||||
// preview is one safety layer, this server check is the other). `mode: 'mock'`
|
||||
// stays frictionless so the "Try Nox without signing up" landing keeps working.
|
||||
const VALID_MODES = new Set(['mock', 'real']);
|
||||
@@ -156,7 +156,7 @@ router.get('/docs-search', async (req, res) => {
|
||||
}
|
||||
});
|
||||
|
||||
// Serve documentation markdown. Self-contained handler — no reliance on
|
||||
// Serve documentation markdown. Self-contained handler - no reliance on
|
||||
// serve-static's error shape or Express wildcard semantics, both of which
|
||||
// vary between Express 4 and 5 and bit us before.
|
||||
router.use('/docs', async (req, res) => {
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// PUT /api/observations/:id/result -> daemon reports state transition
|
||||
// PUT /api/observations/:id/vet -> human vets the observation (good/bad/failed)
|
||||
//
|
||||
// The "snapshot" idea — copy site coords + telescope capabilities + Nox
|
||||
// program + ephemeris-source onto the row at creation time — is the
|
||||
// The "snapshot" idea - copy site coords + telescope capabilities + Nox
|
||||
// program + ephemeris-source onto the row at creation time - is the
|
||||
// SatNOGS reproducibility pattern. Reasons:
|
||||
// • renames/reconfigs don't retroactively change what an observation saw
|
||||
// • the observation outlives the rows it points at (a deleted site
|
||||
@@ -68,7 +68,7 @@ router.post('/', authenticate, async (req, res) => {
|
||||
// Permission check: caller must be able to schedule on the telescope's
|
||||
// parent site. Allowed when caller is the site owner OR a site_member
|
||||
// (any role above "viewer"), OR admin role. Visibility=public/network
|
||||
// is NOT enough on its own — you can SEE a public site but not commit
|
||||
// is NOT enough on its own - you can SEE a public site but not commit
|
||||
// observations to its hardware without explicit access.
|
||||
if (!await assertCanScheduleOnTelescope(telescope_id, req.user, res)) return;
|
||||
|
||||
@@ -117,7 +117,7 @@ router.put('/:id/result', authenticate, async (req, res) => {
|
||||
if (!obs) return res.status(404).json({ error: 'observation not found' });
|
||||
|
||||
// Only members of the owning site (or admin) can post results. This is what
|
||||
// a daemon-issued `cae_*` token will hit — same auth as the human path.
|
||||
// a daemon-issued `cae_*` token will hit - same auth as the human path.
|
||||
if (!await assertCanScheduleOnTelescope(obs.telescope_id, req.user, res)) return;
|
||||
|
||||
// State-transition guard: refuse to re-COMPLETE an observation that already
|
||||
@@ -159,7 +159,7 @@ router.put('/:id/vet', authenticate, async (req, res) => {
|
||||
if (!obs) return res.status(404).json({ error: 'observation not found' });
|
||||
|
||||
// Vetting moves the site's public trust counter, so require owner/operator
|
||||
// (canEditSite) — NOT the weaker observer-level canScheduleOnTelescope, which
|
||||
// (canEditSite) - NOT the weaker observer-level canScheduleOnTelescope, which
|
||||
// would let an invited observer inflate a site's score and graduate it.
|
||||
const site = await db.get(`
|
||||
SELECT s.id, s.experimental, s.successful_observations
|
||||
@@ -179,7 +179,7 @@ router.put('/:id/vet', authenticate, async (req, res) => {
|
||||
);
|
||||
|
||||
// Move the per-site successful counter only on transitions in/out of
|
||||
// good — keeps the counter consistent across re-vettings.
|
||||
// good - keeps the counter consistent across re-vettings.
|
||||
if (previousGood !== nowGood) {
|
||||
if (site) {
|
||||
const delta = nowGood ? 1 : -1;
|
||||
|
||||
@@ -67,7 +67,7 @@ router.patch('/:id', authenticate, async (req, res) => {
|
||||
if (!plan) return res.status(404).json({ error: 'Plan not found' });
|
||||
if (plan.owner_id !== req.user.id && req.user.role !== 'admin') return res.status(403).json({ error: 'Not authorized' });
|
||||
const { name, description, is_public, proposal_id } = req.body;
|
||||
// If linking to a proposal, the caller must be PI/CI of that proposal —
|
||||
// If linking to a proposal, the caller must be PI/CI of that proposal -
|
||||
// otherwise anyone could attach their plan to an unrelated proposal and
|
||||
// poison its plan listing.
|
||||
if (proposal_id !== undefined && proposal_id) {
|
||||
|
||||
@@ -14,7 +14,7 @@ async function loadOrInit(userId) {
|
||||
// FK constraint fails when the JWT's user_id no longer exists in
|
||||
// the users table (typical after dev:reset wipes/reseeds). Return
|
||||
// a defaulted prefs object so the endpoint doesn't 500 and the
|
||||
// client UI can still render — auth flow handles re-login.
|
||||
// client UI can still render - auth flow handles re-login.
|
||||
return {
|
||||
user_id: userId,
|
||||
theme: 'dark', density: 'comfortable',
|
||||
|
||||
@@ -141,7 +141,7 @@ router.post('/:id/request-groups', authenticate, async (req, res) => {
|
||||
|
||||
// Per-request validation: every telescope_id (if provided) must exist AND
|
||||
// the caller must be allowed to schedule on it. Catch bad telescope_ids
|
||||
// before writing — otherwise requests sit in PENDING forever.
|
||||
// before writing - otherwise requests sit in PENDING forever.
|
||||
for (const r of reqs) {
|
||||
if (!r.target_name) return res.status(400).json({ error: 'each request needs target_name' });
|
||||
if (r.telescope_id) {
|
||||
@@ -296,7 +296,7 @@ router.delete('/:id/members/:userId', authenticate, async (req, res) => {
|
||||
// Note the 1-arg GROUP_CONCAT below: it defaults to a ',' separator in BOTH
|
||||
// dialects. The 2-arg form is a separator in SQLite but a per-row concat in
|
||||
// MySQL, so GROUP_CONCAT(target_name, ', ') returned "M31, ,M42, " on prod.
|
||||
// MySQL spells the separator with a SEPARATOR keyword, which SQLite rejects —
|
||||
// MySQL spells the separator with a SEPARATOR keyword, which SQLite rejects -
|
||||
// there is no 2-arg syntax common to both backends.
|
||||
router.get('/request-groups/mine', authenticate, async (req, res) => {
|
||||
const state = req.query.state;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Research feed — science-driven observation candidates sourced from
|
||||
// Research feed - science-driven observation candidates sourced from
|
||||
// external catalogs (MPC, NASA Exoplanet Archive, AAVSO). The /research
|
||||
// page renders these as actionable cards; "Schedule" routes through the
|
||||
// same Observation snapshot + jobs queue spine that powers the daemon.
|
||||
@@ -10,7 +10,7 @@
|
||||
// The feed is paginated by recency of `updated_at` so the freshest
|
||||
// alerts (urgent NEOs, current transits) bubble up. The schedule action
|
||||
// builds a Nox program from the target's recommended filters/exposure
|
||||
// metadata and POSTs an Observation with the full snapshot pre-filled —
|
||||
// metadata and POSTs an Observation with the full snapshot pre-filled -
|
||||
// the daemon polling /api/jobs will pick it up like any other job.
|
||||
|
||||
import { Router } from 'express';
|
||||
@@ -86,7 +86,7 @@ router.get('/feed', authenticate, async (req, res) => {
|
||||
res.json(rows);
|
||||
});
|
||||
|
||||
// Manually add a target to the feed — no upstream fetch, no scheduling. Every
|
||||
// Manually add a target to the feed - no upstream fetch, no scheduling. Every
|
||||
// other add path (SIMBAD resolve, the pull tools) needs the internet, which
|
||||
// leaves the offline box unable to add research at all. This closes that gap
|
||||
// and answers "add research without scheduling anything": importTargets is
|
||||
@@ -116,7 +116,7 @@ router.post('/targets', authenticate, async (req, res) => {
|
||||
res.status(201).json(result);
|
||||
});
|
||||
|
||||
// Object dossier — everything Caelum knows about one object, keyed by name.
|
||||
// Object dossier - everything Caelum knows about one object, keyed by name.
|
||||
// 100% local (zero outbound calls) so it renders on the internet-less box;
|
||||
// catalog identity / SIMBAD stay a lazy, optional client call. This is the
|
||||
// deep-dive target reached from an archive frame or a research card.
|
||||
@@ -147,7 +147,7 @@ router.get('/object/:name', authenticate, async (req, res) => {
|
||||
LIMIT 200
|
||||
`, [uid, name]);
|
||||
|
||||
// How many more frames merely *contain* the name (M31 vs M310) — surfaced
|
||||
// How many more frames merely *contain* the name (M31 vs M310) - surfaced
|
||||
// as a count so the UI can offer them without silently lumping them in.
|
||||
const fuzzyRow = await db.get(`
|
||||
SELECT COUNT(*) AS c FROM archive_frames af
|
||||
@@ -155,7 +155,7 @@ router.get('/object/:name', authenticate, async (req, res) => {
|
||||
AND af.target_name LIKE ? AND LOWER(af.target_name) <> LOWER(?)
|
||||
`, [uid, `%${name}%`, name]);
|
||||
|
||||
// Observations independent of frames — most frames have a null
|
||||
// Observations independent of frames - most frames have a null
|
||||
// observation_id, so provenance comes from here, keyed by name.
|
||||
const observations = await db.all(`
|
||||
SELECT o.id, o.state, o.start_time, o.end_time, o.vetted_status, o.vetting_reason,
|
||||
@@ -204,7 +204,7 @@ router.get('/object/:name', authenticate, async (req, res) => {
|
||||
framesOut.push(f);
|
||||
}
|
||||
|
||||
// Aggregate stats in JS (portable — no GROUP BY / GROUP_CONCAT).
|
||||
// Aggregate stats in JS (portable - no GROUP BY / GROUP_CONCAT).
|
||||
const uniq = (arr) => [...new Set(arr.filter(Boolean))];
|
||||
const stats = {
|
||||
frame_count: framesOut.length,
|
||||
@@ -294,7 +294,7 @@ router.post('/:targetId/schedule', authenticate, async (req, res) => {
|
||||
`, [telescope_id]);
|
||||
if (!ctx) return res.status(404).json({ error: 'telescope not found' });
|
||||
|
||||
// Permission check: same as direct observation create — caller must be
|
||||
// Permission check: same as direct observation create - caller must be
|
||||
// a member of the telescope's owning site, otherwise they're attempting
|
||||
// to book hardware they don't have access to.
|
||||
if (!await assertCanScheduleOnTelescope(telescope_id, req.user, res)) return;
|
||||
@@ -396,7 +396,7 @@ router.post('/tools/ephemeris', authenticate, async (req, res) => {
|
||||
} catch (e) { res.status(502).json({ error: `Horizons lookup failed: ${e.message}` }); }
|
||||
});
|
||||
|
||||
// Name resolver — turn any catalog/common name into RA/Dec via SIMBAD.
|
||||
// Name resolver - turn any catalog/common name into RA/Dec via SIMBAD.
|
||||
// GET because it's a pure lookup; results are safe to cache.
|
||||
router.get('/tools/resolve', authenticate, async (req, res) => {
|
||||
const { name } = req.query || {};
|
||||
@@ -464,7 +464,7 @@ router.post('/tools/field-scan', authenticate, async (req, res) => {
|
||||
} catch (e) { res.status(502).json({ error: `Field scan failed: ${e.message}` }); }
|
||||
});
|
||||
|
||||
// Claude Lab — scientific analysis powered by the user's Anthropic key.
|
||||
// Claude Lab - scientific analysis powered by the user's Anthropic key.
|
||||
// Server pulls the target + frame headers + SpaceDB matches and builds
|
||||
// the prompt so the browser never sees the key or the synthesis logic.
|
||||
router.get('/tools/analyze/templates', authenticate, (_req, res) => {
|
||||
|
||||
@@ -226,7 +226,7 @@ router.post('/:bookingId/exposures', authenticate, requireLiveSession, async (re
|
||||
|
||||
const noteId = uuid();
|
||||
const totalSec = exposure_time * (exposure_count || 1);
|
||||
await db.run('INSERT INTO session_notes (id, booking_id, user_id, body, note_type) VALUES (?, ?, ?, ?, ?)', [noteId, b.id, req.user.id, `Capture started: ${resolvedTarget || 'target'} — ${exposure_count || 1} × ${exposure_time}s${filter ? ' (' + filter + ')' : ''}`, 'exposure']);
|
||||
await db.run('INSERT INTO session_notes (id, booking_id, user_id, body, note_type) VALUES (?, ?, ?, ?, ?)', [noteId, b.id, req.user.id, `Capture started: ${resolvedTarget || 'target'} - ${exposure_count || 1} × ${exposure_time}s${filter ? ' (' + filter + ')' : ''}`, 'exposure']);
|
||||
|
||||
if (req.app.get('io')) {
|
||||
const io = req.app.get('io');
|
||||
@@ -311,7 +311,7 @@ router.get('/:bookingId/summary', authenticate, async (req, res) => {
|
||||
router.post('/:bookingId/notes', authenticate, requireLiveSession, async (req, res) => {
|
||||
const b = await db.get('SELECT id, title FROM bookings WHERE id = ?', [req.params.bookingId]);
|
||||
if (!b) return res.status(404).json({ error: 'Booking not found' });
|
||||
if (!(await isSessionMember(b.id, req.user.id)) && req.user.role !== 'admin') return res.status(403).json({ error: 'Spectators cannot post notes — ask the host to invite you' });
|
||||
if (!(await isSessionMember(b.id, req.user.id)) && req.user.role !== 'admin') return res.status(403).json({ error: 'Spectators cannot post notes - ask the host to invite you' });
|
||||
const { body, note_type } = req.body;
|
||||
if (!body || !body.trim()) return res.status(400).json({ error: 'Note body is required' });
|
||||
const id = uuid();
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// Money is integer minor units (cents) end-to-end. The DB is the source of
|
||||
// truth for catalog/price/inventory; Stripe Product/Price are a mirror kept
|
||||
// in sync by admin actions, and the charged amount is ALWAYS computed
|
||||
// server-side from shop_products — never from the client, never from Stripe.
|
||||
// server-side from shop_products - never from the client, never from Stripe.
|
||||
//
|
||||
// Catalog management is admin-only. Checkout requires a logged-in user.
|
||||
// The webhook handler is exported separately so index.js can mount it with a
|
||||
@@ -25,7 +25,7 @@ const router = Router();
|
||||
const CATEGORIES = new Set(['mount', 'ota', 'camera', 'filter_wheel', 'focuser', 'computer', 'dome', 'accessory']);
|
||||
|
||||
// Payment/checkout paths fail closed until Stripe is configured. The public
|
||||
// catalog (/config, /products) is NOT gated on Stripe — the shop runs as an
|
||||
// catalog (/config, /products) is NOT gated on Stripe - the shop runs as an
|
||||
// Agena Astro affiliate, so the catalog must show even with no payment backend.
|
||||
function requireShop(req, res, next) {
|
||||
if (!isShopEnabled()) return res.status(503).json({ error: 'Shop is not configured' });
|
||||
@@ -150,7 +150,7 @@ router.post('/checkout', requireShop, authenticate, async (req, res) => {
|
||||
// so the dashboard, receipt, and exports are legible. Stripe limits:
|
||||
// description ≤ 1000 chars, each metadata value ≤ 500 chars, ≤ 50 keys.
|
||||
const summary = lineItems.map(li => `${li.qty}× ${li.product.name}`).join(', ');
|
||||
const description = `Caelum shop order ${orderId.slice(0, 8)} — ${summary}`.slice(0, 900);
|
||||
const description = `Caelum shop order ${orderId.slice(0, 8)} - ${summary}`.slice(0, 900);
|
||||
|
||||
let pi;
|
||||
try {
|
||||
@@ -324,7 +324,7 @@ router.put('/admin/products/:id', requireShop, authenticate, requireRole('admin'
|
||||
await db.run('UPDATE shop_products SET stripe_price_id = ? WHERE id = ?', [price.id, row.id]);
|
||||
}
|
||||
} else if (stripe) {
|
||||
// Row never synced — do the full create now.
|
||||
// Row never synced - do the full create now.
|
||||
await syncProductToStripe(await db.get('SELECT * FROM shop_products WHERE id = ?', [row.id]));
|
||||
}
|
||||
} catch (e) {
|
||||
@@ -419,7 +419,7 @@ export async function shopWebhookHandler(req, res) {
|
||||
log.info(`[shop] webhook received: ${event.type} (${event.id})`);
|
||||
|
||||
// Exactly-once: the event-id ledger is the gate. A duplicate insert means
|
||||
// we've already processed this event — ack and skip.
|
||||
// we've already processed this event - ack and skip.
|
||||
try {
|
||||
await db.run('INSERT INTO shop_webhook_events (id, type) VALUES (?, ?)', [event.id, event.type]);
|
||||
} catch {
|
||||
@@ -458,7 +458,7 @@ async function handlePaymentSucceeded(pi) {
|
||||
const oversold = [];
|
||||
await db.tx(async (t) => {
|
||||
for (const it of items) {
|
||||
// Guarded conditional decrement — atomic on both backends. changes=0
|
||||
// Guarded conditional decrement - atomic on both backends. changes=0
|
||||
// means insufficient stock (rare; the checkout soft-check guards it).
|
||||
const r = await t.run(
|
||||
'UPDATE shop_products SET inventory_count = inventory_count - ?, updated_at = CURRENT_TIMESTAMP WHERE id = ? AND inventory_count >= ?',
|
||||
|
||||
@@ -59,7 +59,7 @@ router.get('/:id', authenticate, async (req, res) => {
|
||||
|
||||
const downtimes = await db.all("SELECT * FROM downtimes WHERE site_id = ? AND end_time > CURRENT_TIMESTAMP ORDER BY start_time ASC", [site.id]);
|
||||
|
||||
// Derived trust metric — single read instead of an aggregate. The
|
||||
// Derived trust metric - single read instead of an aggregate. The
|
||||
// counters live on the row (see sites schema + migrations.js) and are
|
||||
// moved by /api/observations/:id/result and /api/observations/:id/vet.
|
||||
const success_rate = (site.total_observations > 0)
|
||||
|
||||
@@ -160,7 +160,7 @@ router.get('/stats', authenticate, async (req, res) => {
|
||||
});
|
||||
|
||||
// Best-effort small-body lookup by designation, for the object dossier.
|
||||
// Returns null (never throws) when the catalog is absent — the internet-less
|
||||
// Returns null (never throws) when the catalog is absent - the internet-less
|
||||
// box has no spacedbPool, and a deep-sky object simply isn't in a small-body
|
||||
// catalog. This is the local SpaceDB thread in the object page: a NEO/comet
|
||||
// research object resolves straight to its orbital elements + close approaches.
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
// "Buy me a coffee" — a one-off support payment with a caller-chosen amount.
|
||||
// "Buy me a coffee" - a one-off support payment with a caller-chosen amount.
|
||||
//
|
||||
// Deliberately NOT part of routes/shop.js: the shop sells catalogue rows with
|
||||
// authoritative DB prices, inventory and an order record. This has no product,
|
||||
// no stock and no order — it's a tip. Sharing that code would mean teaching the
|
||||
// no stock and no order - it's a tip. Sharing that code would mean teaching the
|
||||
// order pipeline about a line item that doesn't exist.
|
||||
//
|
||||
// Uses hosted Stripe Checkout rather than the shop's PaymentIntent + Elements
|
||||
// flow: card details are then entered on Stripe's own page and never touch
|
||||
// Caelum. The only thing we hand Stripe is an amount.
|
||||
//
|
||||
// Unauthenticated by design — supporters shouldn't need an account — which is
|
||||
// Unauthenticated by design - supporters shouldn't need an account - which is
|
||||
// exactly why the amount is validated here and the endpoint is rate limited.
|
||||
import { Router } from 'express';
|
||||
import { getStripe, isShopEnabled } from '../services/stripe.js';
|
||||
@@ -57,7 +57,7 @@ router.get('/config', (_req, res) => {
|
||||
|
||||
router.post('/checkout', supportLimiter, async (req, res) => {
|
||||
if (!isShopEnabled()) {
|
||||
// Not an error the user can act on — tell the client to use the link.
|
||||
// Not an error the user can act on - tell the client to use the link.
|
||||
return res.status(503).json({ error: 'Support checkout is not configured', fallbackUrl: FALLBACK_LINK });
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ const router = Router();
|
||||
|
||||
// Scopes enforced today: only the *string* is stored, not interpreted at
|
||||
// auth time. Until middleware actually checks `scopes` against the request,
|
||||
// constrain creation to the names we plan to honor — accidental typos like
|
||||
// constrain creation to the names we plan to honor - accidental typos like
|
||||
// "all", "*", or "scheule" would silently grant nothing later.
|
||||
const VALID_TOKEN_SCOPES = new Set(['read', 'write', 'daemon']);
|
||||
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
// DB_KIND=mysql node src/seed-shop.js # prod-shaped DB
|
||||
//
|
||||
// Prices/inventory are a SNAPSHOT taken from agenaastro.com product pages and
|
||||
// are integer cents. The DB is the source of truth from here on — verify and
|
||||
// are integer cents. The DB is the source of truth from here on - verify and
|
||||
// adjust in the admin UI (/shop/admin); retail prices drift. Idempotent:
|
||||
// upserts by source_url, so re-running refreshes price/inventory/name without
|
||||
// duplicating rows or clobbering products you added by hand.
|
||||
//
|
||||
// Agena is a telescope retailer — it carries scopes, mounts, cameras and
|
||||
// Agena is a telescope retailer - it carries scopes, mounts, cameras and
|
||||
// accessories, but NOT observatory domes/roll-off roofs, so no 'dome' rows are
|
||||
// seeded. Add those by hand if you find a supplier.
|
||||
//
|
||||
@@ -36,7 +36,7 @@ const PRODUCTS = [
|
||||
{ name: 'Sky-Watcher EvoStar 80ED 80mm APO Refractor', category: 'ota',
|
||||
price: 59999, tiers: ['easy', 'moderate', 'advanced'], goals: ['deepsky'],
|
||||
url: `${A}/sky-watcher-evostar-80-apo-refractor-s11100.html`,
|
||||
description: 'The classic 80mm ED doublet — the deep-sky beginner default for a reason.' },
|
||||
description: 'The classic 80mm ED doublet - the deep-sky beginner default for a reason.' },
|
||||
{ name: 'Sky-Watcher EvoStar 100ED APO Refractor', category: 'ota',
|
||||
price: 99900, tiers: ['moderate', 'advanced'], goals: ['deepsky', 'planetary'],
|
||||
url: `${A}/sky-watcher-evostar-100ed-apo-refractor-s11120.html`,
|
||||
@@ -100,7 +100,7 @@ const PRODUCTS = [
|
||||
{ name: 'ZWO EAF Electronic Automatic Focuser (Advanced)', category: 'focuser',
|
||||
price: 24900, tiers: ['moderate', 'advanced'], goals: ['deepsky', 'automation'],
|
||||
url: `${A}/zwo-electronic-automatic-focuser-eaf-advanced.html`,
|
||||
description: 'Motorized focus with temperature probe — enables autofocus routines.' },
|
||||
description: 'Motorized focus with temperature probe - enables autofocus routines.' },
|
||||
|
||||
// --- Control computer ---
|
||||
{ name: 'ZWO ASIAIR Mini Wi-Fi Smart Camera Controller', category: 'computer',
|
||||
@@ -112,13 +112,13 @@ const PRODUCTS = [
|
||||
{ name: 'ZWO ASI533MM Pro Cooled Monochrome Astronomy Camera', category: 'camera',
|
||||
price: 99900, tiers: ['advanced'], goals: ['deepsky'],
|
||||
url: `${A}/zwo-533mm-cooled-monochrome-astronomy-camera.html`,
|
||||
description: 'Cooled square-sensor mono CMOS. Pair with a filter wheel for LRGB/narrowband — top deep-sky quality.' },
|
||||
description: 'Cooled square-sensor mono CMOS. Pair with a filter wheel for LRGB/narrowband - top deep-sky quality.' },
|
||||
|
||||
// --- More telescopes ---
|
||||
{ name: 'Sky-Watcher 8" Flextube SynScan 200P GoTo Dobsonian', category: 'ota',
|
||||
price: 162500, tiers: ['easy', 'moderate'], goals: ['visual'],
|
||||
url: `${A}/sky-watcher-8-goto-collapsible-dobsonian-telescope-s11800.html`,
|
||||
description: 'Collapsible 8" GoTo Dobsonian — push-button object location with big visual aperture.' },
|
||||
description: 'Collapsible 8" GoTo Dobsonian - push-button object location with big visual aperture.' },
|
||||
|
||||
// --- Accessories: guiding & power ---
|
||||
{ name: 'ZWO ASI120MM-Mini Guide Camera', category: 'accessory',
|
||||
@@ -192,7 +192,7 @@ async function main() {
|
||||
}
|
||||
}
|
||||
log.info(`[seed-shop] done. ${PRODUCTS.length} products upserted${stripeOn ? `, ${synced} synced to Stripe` : ''}.`);
|
||||
log.info('[seed-shop] NOTE: prices are an Agena Astro snapshot — verify in /shop/admin before going live.');
|
||||
log.info('[seed-shop] NOTE: prices are an Agena Astro snapshot - verify in /shop/admin before going live.');
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
|
||||
+34
-34
@@ -35,7 +35,7 @@ for (const t of tables) {
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// users — a small community so feed / leaderboard / messages have life
|
||||
// users - a small community so feed / leaderboard / messages have life
|
||||
// ------------------------------------------------------------------
|
||||
const USERS = [
|
||||
['admin@observatory.local', 'admin', 'admin123', 'admin'],
|
||||
@@ -63,7 +63,7 @@ const adminId = u.admin, observerId = u.observer;
|
||||
// show real states: simulator, stellarium, alpaca.
|
||||
// ------------------------------------------------------------------
|
||||
// site spec: [name, code, owner, lat, lon, alt, tz, visibility, status, about]
|
||||
// `about` stays factual — location, sky quality, altitude. Marketing prose
|
||||
// `about` stays factual - location, sky quality, altitude. Marketing prose
|
||||
// here reads as invented filler on the public landing feed, which pulls
|
||||
// these names straight through.
|
||||
const SITES = [
|
||||
@@ -223,7 +223,7 @@ for (const [key, pid, sub, name, tcode, state, reqs] of RGS) {
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// bookings — every RG-linked booking's window matches its RG state, plus
|
||||
// bookings - every RG-linked booking's window matches its RG state, plus
|
||||
// a few standalone (no-proposal) bookings for variety.
|
||||
// booking: [tcode, user, title, startH, durH, status, vis, proposalId, rgKey]
|
||||
// ------------------------------------------------------------------
|
||||
@@ -246,14 +246,14 @@ for (const [tcode, user, title, startH, durH, status, vis, pid, rgKey] of BOOKIN
|
||||
null, vis, pid, rgKey ? rg[rgKey].id : null]);
|
||||
}
|
||||
|
||||
// active IN_PROGRESS session (NGC 7000) — collaborators, notes, exposures
|
||||
// active IN_PROGRESS session (NGC 7000) - collaborators, notes, exposures
|
||||
const active = bookingIds.find(b => b.rgKey === 'na');
|
||||
await db.run('INSERT INTO session_collaborators (booking_id, user_id, invited_by) VALUES (?, ?, ?)', [active.id, adminId, u.nova]);
|
||||
await db.run('INSERT INTO session_collaborators (booking_id, user_id, invited_by) VALUES (?, ?, ?)', [active.id, observerId, u.nova]);
|
||||
await db.run('INSERT INTO session_notes (id, booking_id, user_id, body, note_type) VALUES (?, ?, ?, ?, ?)',
|
||||
[uuid(), active.id, u.nova, 'Seeing 1.8", transparency excellent. Starting OIII set after Ha completes.', 'note']);
|
||||
await db.run('INSERT INTO session_notes (id, booking_id, user_id, body, note_type) VALUES (?, ?, ?, ?, ?)',
|
||||
[uuid(), active.id, adminId, 'Dew heater bumped to 60% — objective was fogging.', 'warning']);
|
||||
[uuid(), active.id, adminId, 'Dew heater bumped to 60% - objective was fogging.', 'warning']);
|
||||
for (let i = 0; i < 6; i++) {
|
||||
const done = i < 4;
|
||||
await db.run(`INSERT INTO session_exposures (id, booking_id, triggered_by, telescope_id, target_name, ra, \`dec\`, exposure_time, exposure_count, filter, status, started_at, completed_at)
|
||||
@@ -262,7 +262,7 @@ for (let i = 0; i < 6; i++) {
|
||||
done ? 'COMPLETED' : 'RUNNING', dt(hoursFromNow(-0.4 + i * 0.1)), done ? dt(hoursFromNow(-0.3 + i * 0.1)) : null]);
|
||||
}
|
||||
|
||||
// past COMPLETED session (2024 PT5) — needs completed exposures so the
|
||||
// past COMPLETED session (2024 PT5) - needs completed exposures so the
|
||||
// COMPLETED request-group state has supporting evidence and matches the
|
||||
// lifecycle COMPLETED criterion (completedExposures > 0).
|
||||
const doneSession = bookingIds.find(b => b.rgKey === 'pt5');
|
||||
@@ -297,28 +297,28 @@ for (const sc of ['BYO', 'MPO', 'ARN', 'DSR']) {
|
||||
await db.run('INSERT INTO downtimes (id, site_id, telescope_id, reason, start_time, end_time, description) VALUES (?, ?, ?, ?, ?, ?, ?)',
|
||||
[uuid(), site.MPO, tel.CDK14, 'MAINTENANCE', dt(daysFromNow(2)), dt(daysFromNow(2)), 'Scheduled mirror cleaning and collimation']);
|
||||
await db.run('INSERT INTO downtimes (id, site_id, telescope_id, reason, start_time, end_time, description) VALUES (?, ?, ?, ?, ?, ?, ?)',
|
||||
[uuid(), site.LAU, tel.ESP120, 'WEATHER', dt(daysFromNow(-1)), dt(daysFromNow(3)), 'Storm system — dome sealed until conditions improve']);
|
||||
[uuid(), site.LAU, tel.ESP120, 'WEATHER', dt(daysFromNow(-1)), dt(daysFromNow(3)), 'Storm system - dome sealed until conditions improve']);
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// archive frames — broad target + filter + visibility mix
|
||||
// archive frames - broad target + filter + visibility mix
|
||||
// ------------------------------------------------------------------
|
||||
const insertFrame = (...a) => db.run(
|
||||
`INSERT INTO archive_frames (id, telescope_id, uploader_id, filename, frame_type, target_name, ra, dec_coord, filter, exposure_time, date_obs, airmass, fwhm_arcsec, visibility, description, tags, fits_headers_json, wcs_solved, file_size_bytes) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`, a);
|
||||
|
||||
const FRAMES = [
|
||||
// tcode, uploader, file, type, target, ra, dec, filter, exp, daysAgo, vis, desc, tags
|
||||
['CDK14','admin','M31_L_001.fits','EXPOSE','M31',10.6847,41.2689,'L',300,8,'public','Luminance of Andromeda — excellent transparency.',['galaxy','andromeda']],
|
||||
['CDK14','admin','M31_L_001.fits','EXPOSE','M31',10.6847,41.2689,'L',300,8,'public','Luminance of Andromeda - excellent transparency.',['galaxy','andromeda']],
|
||||
['CDK14','admin','M31_Ha_001.fits','EXPOSE','M31',10.6847,41.2689,'Ha',600,8,'public','H-alpha reveals HII regions in the spiral arms.',['galaxy','narrowband','ha']],
|
||||
['C8SE','observer','Jupiter_001.fits','EXPOSE','Jupiter',63.0,18.5,null,0.05,8,'network','Lucky-imaging Jupiter — GRS visible.',['planet','jupiter']],
|
||||
['CDK14','admin','NGC7293_OIII.fits','EXPOSE','NGC 7293',337.41,-20.83,'OIII',900,9,'public','Helix Nebula OIII — full ring resolved.',['nebula','planetary','oiii']],
|
||||
['CDK14','observer','M42_Ha_001.fits','EXPOSE','M42',83.8221,-5.3911,'Ha',300,10,'public','Orion Nebula narrowband — trapezium crisp.',['nebula','emission','ha']],
|
||||
['RC600','nova','NGC7000_SHO.fits','EXPOSE','NGC 7000',314.75,44.31,'SII',600,2,'public','North America Nebula SHO — Cygnus wall.',['nebula','sho','cygnus']],
|
||||
['RC600','nova','IC1396_Ha.fits','EXPOSE','IC 1396',324.74,57.49,'Ha',600,5,'network','Elephant Trunk in Ha — dusty pillars.',['nebula','ha']],
|
||||
['C8SE','observer','Jupiter_001.fits','EXPOSE','Jupiter',63.0,18.5,null,0.05,8,'network','Lucky-imaging Jupiter - GRS visible.',['planet','jupiter']],
|
||||
['CDK14','admin','NGC7293_OIII.fits','EXPOSE','NGC 7293',337.41,-20.83,'OIII',900,9,'public','Helix Nebula OIII - full ring resolved.',['nebula','planetary','oiii']],
|
||||
['CDK14','observer','M42_Ha_001.fits','EXPOSE','M42',83.8221,-5.3911,'Ha',300,10,'public','Orion Nebula narrowband - trapezium crisp.',['nebula','emission','ha']],
|
||||
['RC600','nova','NGC7000_SHO.fits','EXPOSE','NGC 7000',314.75,44.31,'SII',600,2,'public','North America Nebula SHO - Cygnus wall.',['nebula','sho','cygnus']],
|
||||
['RC600','nova','IC1396_Ha.fits','EXPOSE','IC 1396',324.74,57.49,'Ha',600,5,'network','Elephant Trunk in Ha - dusty pillars.',['nebula','ha']],
|
||||
['RC600','rigel','2024PT5_seq.fits','EXPOSE','2024 PT5',0,0,'L',30,6,'network','NEO 2024 PT5 astrometry sequence frame.',['neo','astrometry']],
|
||||
['FSQ106','orion','Cygnus_widefield.fits','EXPOSE','Cygnus',310.0,40.0,'L',120,4,'public','Wide-field Cygnus star clouds.',['mosaic','milkyway']],
|
||||
['RC600','rigel','M104_L.fits','EXPOSE','M104',189.9976,-11.6231,'L',240,3,'public','Sombrero Galaxy — dust lane sharp at 0.4" pixels.',['galaxy','sombrero']],
|
||||
['RC600','rigel','M104_L.fits','EXPOSE','M104',189.9976,-11.6231,'L',240,3,'public','Sombrero Galaxy - dust lane sharp at 0.4" pixels.',['galaxy','sombrero']],
|
||||
['ESP120','lyra','Aurora_20260513.fits','EXPOSE','Aurora',0,60,null,2,1,'public','Auroral arc over the Cairngorms.',['aurora','atmospheric']],
|
||||
['CDK14','admin','flat_R_001.fits','FLAT',null,null,null,'R',5,8,'private','Twilight flat — R filter.',['calibration']],
|
||||
['CDK14','admin','flat_R_001.fits','FLAT',null,null,null,'R',5,8,'private','Twilight flat - R filter.',['calibration']],
|
||||
['RC600','nova','dark_600s.fits','DARK',null,null,null,null,600,2,'private','Master dark, 600s, -10C.',['calibration']],
|
||||
];
|
||||
const frameIds = [];
|
||||
@@ -356,7 +356,7 @@ await db.run('INSERT INTO archive_comments (id, frame_id, user_id, body) VALUES
|
||||
[uuid(), social[0].id, observerId, 'What was the seeing on this one?']);
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// observations — the spine of the platform. Each one is the immutable
|
||||
// observations - the spine of the platform. Each one is the immutable
|
||||
// record of "telescope T ran Nox program P at time W and saw the
|
||||
// following frames." Snapshot fields (site coords, telescope caps,
|
||||
// ephemeris source, Nox source) are FROZEN onto the row at create
|
||||
@@ -400,7 +400,7 @@ function noxProgram({ telescopeCode, target, exposureSec, filter, count }) {
|
||||
`use telescope T = "${telescopeCode}"`,
|
||||
`T.slew(${slewArg})`,
|
||||
];
|
||||
// Filter is a named arg on T.expose — there is no T.filter() method.
|
||||
// Filter is a named arg on T.expose - there is no T.filter() method.
|
||||
const filterArg = filter ? `, filter: "${filter}"` : '';
|
||||
for (let i = 0; i < (count || 1); i++) {
|
||||
lines.push(`T.expose(${exposureSec}s${filterArg})`);
|
||||
@@ -431,7 +431,7 @@ const OBSERVATIONS = [
|
||||
['CDK14', 'M13', 250.42, 36.46, 'L', 180, 8, 'COMPLETED', 70, 290, 65, 11, 'good', null, 'admin'],
|
||||
['CDK14', 'M45', 56.75, 24.12, 'L', 120, 12, 'COMPLETED', 80, 280, 60, 13, 'good', null, 'admin'],
|
||||
|
||||
// RC600 narrowband campaign at ARN — Atacama gets photometric nights, this
|
||||
// RC600 narrowband campaign at ARN - Atacama gets photometric nights, this
|
||||
// site should graduate easily. Mix in one bad (wind) for realism.
|
||||
['RC600', 'NGC 7000', 314.75, 44.31, 'Ha', 600, 20, 'COMPLETED', 70, 290, 55, 2, 'good', 'transparency excellent', 'nova'],
|
||||
['RC600', 'NGC 7000', 314.75, 44.31, 'OIII',600, 8, 'IN_PROGRESS', 70, 290, 55, 0, 'unknown', null, 'nova'],
|
||||
@@ -444,20 +444,20 @@ const OBSERVATIONS = [
|
||||
['RC600', 'M51', 202.4696, 47.1952,'Ha', 900, 6, 'COMPLETED', 50, 310, 80, 14, 'good', null, 'nova'],
|
||||
['RC600', 'M101', 210.8025, 54.3491,'OIII',900, 6, 'COMPLETED', 30, 330, 84, 4, 'good', null, 'nova'],
|
||||
|
||||
// C8SE (BYO) — public-feed planetary work. Fewer obs so this stays in
|
||||
// C8SE (BYO) - public-feed planetary work. Fewer obs so this stays in
|
||||
// experimental probation.
|
||||
['C8SE', 'Jupiter', 63.0, 18.5, null, 0.05, 1000, 'COMPLETED', 100, 260, 55, 8, 'good', 'GRS captured, lucky imaging stack', 'observer'],
|
||||
['C8SE', 'Saturn', 297.0, -18.0, null, 0.1, 500, 'COMPLETED', 110, 250, 45, 6, 'good', null, 'observer'],
|
||||
['C8SE', 'Moon', 0, 0, null, 0.001, 100, 'COMPLETED', 90, 270, 65, 14, 'good', null, 'observer'],
|
||||
|
||||
// FSQ106 (DSR — Bortle 2 site, low usage, still experimental).
|
||||
// FSQ106 (DSR - Bortle 2 site, low usage, still experimental).
|
||||
['FSQ106','Cygnus', 310.0, 40.0, 'L', 120, 12, 'COMPLETED', 65, 295, 70, 4, 'good', 'wide-field stack came out clean', 'orion'],
|
||||
['FSQ106','M31', 10.6847, 41.2689,'L', 180, 10, 'COMPLETED', 62, 302, 76, 9, 'good', null, 'orion'],
|
||||
|
||||
// ESP120 (LAU — weathered-in, aurora only, deeply experimental).
|
||||
// ESP120 (LAU - weathered-in, aurora only, deeply experimental).
|
||||
['ESP120','Aurora', 0, 60, null, 2, 80, 'COMPLETED', 0, 180, 70, 1, 'good', 'auroral arc, time-lapse', 'lyra'],
|
||||
|
||||
// SCHEDULED future PENDING observation for the M51 booking — this is the
|
||||
// SCHEDULED future PENDING observation for the M51 booking - this is the
|
||||
// job a polling daemon will pick up. Lifecycle proof: GET /api/jobs?
|
||||
// telescope_id=CDK14 must return THIS record.
|
||||
['CDK14', 'M51', 202.4696, 47.1952,'L', 300, 10, 'PENDING', 50, 310, 80, -2, 'unknown', null, 'admin'],
|
||||
@@ -479,7 +479,7 @@ for (const [tc, target, ra, dec, filter, exp, count, state, riseAz, setAz, maxAl
|
||||
const noxSrc = noxProgram({ telescopeCode: tc, target, exposureSec: exp, filter, count });
|
||||
// request_id stays null: requests are seeded without IDs we track here, and
|
||||
// ad-hoc observations are allowed. (This used to compute an rgMatch key and
|
||||
// then feed it to `rgMatch ? null : null` — both branches null, so it never
|
||||
// then feed it to `rgMatch ? null : null` - both branches null, so it never
|
||||
// linked anything. Dropped rather than left looking load-bearing.)
|
||||
const requestId = null;
|
||||
const vettedDt = vetted !== 'unknown' && state === 'COMPLETED' ? dt(hoursFromNow(-daysAgo * 24 + 24)) : null;
|
||||
@@ -555,17 +555,17 @@ for (const srow of sitesRows) {
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// research targets — the science feed that drives the /research view.
|
||||
// research targets - the science feed that drives the /research view.
|
||||
// Real designations from MPC / NASA Exoplanet Archive / AAVSO so the
|
||||
// cards look like the actual thing an observer would see. A future
|
||||
// background refresher will swap this static list for live API pulls;
|
||||
// the table shape is identical either way.
|
||||
// ------------------------------------------------------------------
|
||||
const RESEARCH_TARGETS = [
|
||||
// Near-Earth Asteroids — MPC + JPL SBDB. Mix of urgent (closes soon)
|
||||
// Near-Earth Asteroids - MPC + JPL SBDB. Mix of urgent (closes soon)
|
||||
// and standard follow-up.
|
||||
['neo', '2024 PT5', 'Earth\'s second moon (temporarily captured)', 0, 0, 19.5, 'urgent',
|
||||
'Closes Earth orbit again on Nov 25, 2026 — only 2 nights left for astrometry.', 1,
|
||||
'Closes Earth orbit again on Nov 25, 2026 - only 2 nights left for astrometry.', 1,
|
||||
'MPC', 'https://www.minorplanetcenter.net/db_search/show_object?object_id=2024+PT5',
|
||||
{ filters_recommended: ['L'], exposure_per_filter_s: 30, dither: true, plate_solve: true }],
|
||||
['neo', '2024 AS9', 'NEA brightening, mag rising fast', 245.3, 12.4, 17.2, 'urgent',
|
||||
@@ -585,7 +585,7 @@ const RESEARCH_TARGETS = [
|
||||
'MPC', 'https://www.minorplanetcenter.net/db_search/show_object?object_id=2010+SO16',
|
||||
{ filters_recommended: ['L'], exposure_per_filter_s: 90 }],
|
||||
|
||||
// Exoplanet transits — NASA Exoplanet Archive. Times are real transit
|
||||
// Exoplanet transits - NASA Exoplanet Archive. Times are real transit
|
||||
// ephemerides, simplified.
|
||||
['exoplanet_transit', 'TOI-1338 b', 'Circumbinary planet, TESS', 89.50, -64.83, 11.7, 'urgent',
|
||||
'Predicted transit at 03:14 UTC tomorrow (~6h window).', 0.7,
|
||||
@@ -608,7 +608,7 @@ const RESEARCH_TARGETS = [
|
||||
'NASA Exoplanet Archive', 'https://exoplanetarchive.ipac.caltech.edu/overview/HD%20189733',
|
||||
{ filters_recommended: ['B', 'V', 'R'], exposure_per_filter_s: 30 }],
|
||||
|
||||
// Transient events — supernovae, tidal disruption events, kilonovae.
|
||||
// Transient events - supernovae, tidal disruption events, kilonovae.
|
||||
// Sourced from TNS (Transient Name Server) + Open Astronomy Catalog.
|
||||
// These have the shortest fuse: brightness fades over days–weeks, so
|
||||
// urgency is intrinsic. The Workshop tab's "Pull recent transients"
|
||||
@@ -626,7 +626,7 @@ const RESEARCH_TARGETS = [
|
||||
'Open Astronomy Catalog', 'https://api.astrocats.space/AT2023clx',
|
||||
{ filters_recommended: ['g', 'r', 'i'], exposure_per_filter_s: 180 }],
|
||||
|
||||
// Variable stars — AAVSO alert list. Real designations; reality-check
|
||||
// Variable stars - AAVSO alert list. Real designations; reality-check
|
||||
// priorities loosely from current AAVSO bulletin patterns.
|
||||
['variable_star', 'V404 Cyg', 'Recurrent X-ray nova', 306.02, 33.87, 12.5, 'urgent',
|
||||
'Activity reported by Swift/MAXI. Photometry every 30 min requested.', 0.3,
|
||||
@@ -684,7 +684,7 @@ for (const [owner, name, descr, pub, targets] of PLANS) {
|
||||
// ------------------------------------------------------------------
|
||||
// site reviews, comments, bookmarks
|
||||
// ------------------------------------------------------------------
|
||||
// Ratings only — the numbers drive the site-profile aggregate. The prose
|
||||
// Ratings only - the numbers drive the site-profile aggregate. The prose
|
||||
// bodies were invented testimonials ("Atacama is unreal", "Bortle 2 truly
|
||||
// delivers") and read exactly like generated review filler; a star rating
|
||||
// with no write-up is the common real case anyway.
|
||||
@@ -732,14 +732,14 @@ async function thread(a, b, msgs) {
|
||||
// a coherent fixture instead of a manufactured group chat.
|
||||
await thread('admin', 'observer', [
|
||||
['observer', 'Can I get operator on MPO for the M101 run?'],
|
||||
['admin', 'Done — you are operator on MPO.'],
|
||||
['admin', 'Done - you are operator on MPO.'],
|
||||
]);
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// notifications (mix of read/unread for admin + observer)
|
||||
// ------------------------------------------------------------------
|
||||
// Notifications are system-generated, so each one must correspond to a fact
|
||||
// the seed actually established — otherwise the Inbox contradicts every
|
||||
// the seed actually established - otherwise the Inbox contradicts every
|
||||
// other page. The dropped rows were fiction: a "booking_confirmed" for an
|
||||
// M101 run that is seeded PENDING with no booking at all, a frame_comment
|
||||
// from a comment that no longer exists, and a frame_like citing a fixed
|
||||
@@ -781,7 +781,7 @@ const trust = await db.all(`
|
||||
log.info('\nSite trust ladder (vetted-good / total, experimental until 10):');
|
||||
for (const t of trust) {
|
||||
const flag = t.experimental ? ' [TESTING]' : ' [GRADUATED]';
|
||||
log.info(` ${t.code.padEnd(4)} ${(t.name).padEnd(28)} ${t.successful_observations}/${t.total_observations} = ${t.success_pct ?? '—'}%${flag}`);
|
||||
log.info(` ${t.code.padEnd(4)} ${(t.name).padEnd(28)} ${t.successful_observations}/${t.total_observations} = ${t.success_pct ?? '-'}%${flag}`);
|
||||
}
|
||||
log.info('\nSpaceDB: import the JPL catalog into MYSQL_SPACEDB_DATABASE separately.');
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Alpaca camera translator.
|
||||
//
|
||||
// Implements the methods Nox programs call most: cooldown, expose, and
|
||||
// shutter. Image data isn't streamed back to the client — the camera writes
|
||||
// shutter. Image data isn't streamed back to the client - the camera writes
|
||||
// to local storage on the host running the Alpaca server, and Caelum's
|
||||
// archive ingest path picks it up. The Nox runtime gets an Image{filter}
|
||||
// handle so downstream operations (stack, dither, etc.) can reference it.
|
||||
@@ -40,7 +40,7 @@ export async function alpacaCooldown(row, targetDegC, { timeoutMs = 600_000, tol
|
||||
}
|
||||
|
||||
// Trigger an exposure and wait for it to complete. Duration is in seconds.
|
||||
// We don't download image bytes here — that's an archive-ingest concern.
|
||||
// We don't download image bytes here - that's an archive-ingest concern.
|
||||
export async function alpacaExpose(row, durationS, { isLight = true, timeoutPadMs = 30_000 } = {}) {
|
||||
const d = dev(row);
|
||||
await ensureConnected(d);
|
||||
|
||||
@@ -67,7 +67,7 @@ export async function alpacaWaitUntilSettled(row, timeoutMs = 60_000) {
|
||||
let slewing = true;
|
||||
try {
|
||||
slewing = await alpacaGet(d.host, d.port, 'telescope', d.n, 'slewing');
|
||||
} catch { /* transient — try again */ }
|
||||
} catch { /* transient - try again */ }
|
||||
if (!slewing) {
|
||||
// Capture final position before we declare done.
|
||||
try {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Archive ingest pipeline — single platform thread that runs on every
|
||||
// Archive ingest pipeline - single platform thread that runs on every
|
||||
// frame the moment it lands, regardless of who put it there (web upload,
|
||||
// session capture, or observatory daemon PUT).
|
||||
//
|
||||
@@ -7,7 +7,7 @@
|
||||
//
|
||||
// Tomorrow: plate-solve via astrometry.net, source extract via sep,
|
||||
// photometry via Synphot/photutils. Each external piece slots in here
|
||||
// behind the same one-call interface — the caller never grows a new
|
||||
// behind the same one-call interface - the caller never grows a new
|
||||
// dependency.
|
||||
|
||||
import db from '../config/database.js';
|
||||
@@ -30,7 +30,7 @@ export async function ingestFrame(frameId) {
|
||||
stages: [],
|
||||
};
|
||||
|
||||
// Stage 1: plate-solving. Stub today — we don't actually solve, we
|
||||
// Stage 1: plate-solving. Stub today - we don't actually solve, we
|
||||
// just mark the frame as needing it. When astrometry.net is wired in,
|
||||
// this is the one place that changes.
|
||||
if (!frame.wcs_solved) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Claude analysis — server-side wrapper around the Anthropic Messages API
|
||||
// Claude analysis - server-side wrapper around the Anthropic Messages API
|
||||
// for the /research Caelum Lab tool.
|
||||
//
|
||||
// Why server-side: the user pastes their own Anthropic key into account
|
||||
@@ -23,7 +23,7 @@ const ANALYSIS_TIMEOUT_MS = 90000;
|
||||
const SYSTEM_PROMPT = `You are an observational-astronomy research assistant inside Caelum, a federated
|
||||
observatory network.
|
||||
|
||||
# CRITICAL — Nox program output rule
|
||||
# CRITICAL - Nox program output rule
|
||||
|
||||
Any observation you recommend MUST be emitted as a Caelum Nox program
|
||||
inside a triple-backtick fenced block tagged \`nox\`. The platform parses
|
||||
@@ -31,7 +31,7 @@ these blocks and shows a one-click "Schedule" button next to each;
|
||||
pseudo-syntax or natural-language plans CANNOT be scheduled, so the
|
||||
observer cannot act on them.
|
||||
|
||||
✅ CORRECT — emit this:
|
||||
✅ CORRECT - emit this:
|
||||
|
||||
\`\`\`nox
|
||||
use telescope T = "<TELESCOPE>"
|
||||
@@ -42,7 +42,7 @@ T.expose(600s, filter: "Ha")
|
||||
|
||||
Hard rules (the typechecker rejects everything else):
|
||||
- The telescope variable is ALWAYS named \`T\`. Never invent another name
|
||||
(no \`R\`, \`S\`, \`Scope\`, etc.) — the runtime resource binding is on \`T\`.
|
||||
(no \`R\`, \`S\`, \`Scope\`, etc.) - the runtime resource binding is on \`T\`.
|
||||
- The right-hand side of \`use telescope T = "..."\` is ALWAYS a quoted
|
||||
string. Use \`"<TELESCOPE>"\` literally if the observer hasn't picked one.
|
||||
- Filter goes in \`expose\` as a NAMED argument with a STRING value:
|
||||
@@ -54,7 +54,7 @@ Hard rules (the typechecker rejects everything else):
|
||||
- Exposure-time literals use duration suffixes: \`60s\`, \`5min\`, \`1h\`.
|
||||
- Use \`repeat N { ... }\` for repeated exposures rather than copy-paste.
|
||||
|
||||
❌ WRONG — these formats are rejected by the platform:
|
||||
❌ WRONG - these formats are rejected by the platform:
|
||||
|
||||
\`\`\`
|
||||
program: m31_followup
|
||||
@@ -62,13 +62,13 @@ program: m31_followup
|
||||
visit 2: Ha × 1 @ 600s
|
||||
\`\`\`
|
||||
|
||||
❌ WRONG — also rejected by the typechecker:
|
||||
❌ WRONG - also rejected by the typechecker:
|
||||
|
||||
\`\`\`nox
|
||||
use telescope R = "CDK14" // must be T, not R
|
||||
T.filter("L") // no such method
|
||||
T.expose(60s, L) // L is undeclared — use filter: "L"
|
||||
T.slew(Geographos) // unknown identifier — quote it
|
||||
T.expose(60s, L) // L is undeclared - use filter: "L"
|
||||
T.slew(Geographos) // unknown identifier - quote it
|
||||
\`\`\`
|
||||
|
||||
Or natural language like "5 luminance frames at 60s, then 3 H-alpha at 600s".
|
||||
@@ -79,7 +79,7 @@ independently. Multiple visits = multiple blocks.
|
||||
You may add natural-language explanation BEFORE OR AFTER each block, but
|
||||
the actionable program must be in a real \`\`\`nox block.
|
||||
|
||||
# Optional — mention related targets
|
||||
# Optional - mention related targets
|
||||
|
||||
If your analysis references OTHER objects the observer might also want to
|
||||
schedule (companions, comp stars, comparison galaxies, related transients),
|
||||
@@ -93,7 +93,7 @@ NGC 224
|
||||
\`\`\`
|
||||
|
||||
Only include this block when the related targets are genuinely useful for
|
||||
the observer's task — not as filler.
|
||||
the observer's task - not as filler.
|
||||
|
||||
# Context
|
||||
|
||||
@@ -123,7 +123,7 @@ const TEMPLATES = {
|
||||
'integration-time': "Given the frames captured so far, estimate how much more integration is needed to reach a useful SNR for the science goal. Quote concrete numbers (frame count, total minutes) for each filter.",
|
||||
'filter-strategy': "For this target type (NEO / exoplanet transit / variable star / transient / satellite / DSO), recommend the optimal filter sequence and per-filter exposure ratio. Justify the choice in terms of science yield vs. observing time.",
|
||||
'diagnose-failures': "Inspect the FITS headers and metadata for signs of failure (saturation, trailing, defocus, tracking error, clouds, cosmic-ray hits, vignetting). For each suspect frame, name the likely cause and whether it's recoverable.",
|
||||
'science-writeup': "Write a concise observational note in the style of an AAVSO observation report or MPC astrometry submission — appropriate for the target type. Include observer, instrument, date/time, conditions, derived measurements, and uncertainty estimates.",
|
||||
'science-writeup': "Write a concise observational note in the style of an AAVSO observation report or MPC astrometry submission - appropriate for the target type. Include observer, instrument, date/time, conditions, derived measurements, and uncertainty estimates.",
|
||||
'transit-analysis': "For this exoplanet transit, estimate the midpoint timing and transit depth from what's captured. Compare to the catalog prediction (O-C). Flag whether photometric precision is sufficient to detect TTVs or atmospheric features.",
|
||||
'target-prioritization': "Treat this target as one of several candidates for tonight. Rank it against typical alternatives in its category by: observability now, scientific urgency, and likelihood of useful data given current conditions. Recommend whether to schedule it tonight or defer.",
|
||||
};
|
||||
@@ -137,10 +137,10 @@ function buildPrompt({ target, frames, spacedbMatches, question, template }) {
|
||||
sections.push(`# Target
|
||||
|
||||
- **Designation:** ${target.designation}
|
||||
- **Display name:** ${target.display_name || '—'}
|
||||
- **Display name:** ${target.display_name || '-'}
|
||||
- **Category:** ${target.category}
|
||||
- **Coords (J2000):** RA ${target.ra ?? '—'}°, Dec ${target.dec_deg ?? '—'}°
|
||||
- **Magnitude:** ${target.magnitude ?? '—'}
|
||||
- **Coords (J2000):** RA ${target.ra ?? '-'}°, Dec ${target.dec_deg ?? '-'}°
|
||||
- **Magnitude:** ${target.magnitude ?? '-'}
|
||||
- **Priority:** ${target.priority}
|
||||
- **Source:** ${target.source_label} (${target.source_url})
|
||||
- **Latest urgency note:** ${target.urgency_note || '(none)'}
|
||||
@@ -158,12 +158,12 @@ ${spacedbMatches.map((m, i) => `${i + 1}. ${m.name || m.full_name || m.designati
|
||||
|
||||
${frames.map((f, i) => {
|
||||
const hdr = f.fits_headers || {};
|
||||
const tele = hdr.TELESCOP || f.telescope_name || '—';
|
||||
const inst = hdr.INSTRUME || '—';
|
||||
const tele = hdr.TELESCOP || f.telescope_name || '-';
|
||||
const inst = hdr.INSTRUME || '-';
|
||||
const wcs = f.wcs_solved ? 'WCS-solved' : 'no WCS yet';
|
||||
return `${i + 1}. **${f.filename}** — ${f.frame_type || 'EXPOSE'}${f.filter ? `, filter ${f.filter}` : ''}${f.exposure_time != null ? `, ${f.exposure_time}s` : ''}${f.date_obs ? `, ${f.date_obs}` : ''}
|
||||
- Telescope: ${tele}${inst !== '—' ? `, instrument ${inst}` : ''}
|
||||
- Pointing: RA ${f.ra ?? '—'}°, Dec ${f.dec_coord ?? '—'}°${f.airmass != null ? `, airmass ${f.airmass}` : ''}${f.fwhm_arcsec != null ? `, FWHM ${f.fwhm_arcsec}"` : ''}, ${wcs}
|
||||
return `${i + 1}. **${f.filename}** - ${f.frame_type || 'EXPOSE'}${f.filter ? `, filter ${f.filter}` : ''}${f.exposure_time != null ? `, ${f.exposure_time}s` : ''}${f.date_obs ? `, ${f.date_obs}` : ''}
|
||||
- Telescope: ${tele}${inst !== '-' ? `, instrument ${inst}` : ''}
|
||||
- Pointing: RA ${f.ra ?? '-'}°, Dec ${f.dec_coord ?? '-'}°${f.airmass != null ? `, airmass ${f.airmass}` : ''}${f.fwhm_arcsec != null ? `, FWHM ${f.fwhm_arcsec}"` : ''}, ${wcs}
|
||||
${hdr.CCD_TEMP || hdr['CCD-TEMP'] ? `- CCD temp: ${hdr.CCD_TEMP || hdr['CCD-TEMP']}°C` : ''}${hdr.GAIN ? `, gain ${hdr.GAIN}` : ''}${hdr.XBINNING ? `, ${hdr.XBINNING}x${hdr.YBINNING || hdr.XBINNING} binning` : ''}`;
|
||||
}).join('\n\n')}`);
|
||||
}
|
||||
@@ -174,7 +174,7 @@ ${frames.map((f, i) => {
|
||||
|
||||
const userQ = question?.trim()
|
||||
? `# Observer's question\n\n${question.trim()}`
|
||||
: '# Observer\'s question\n\n(no specific question — run the template analysis)';
|
||||
: '# Observer\'s question\n\n(no specific question - run the template analysis)';
|
||||
|
||||
return [
|
||||
sections.join('\n\n'),
|
||||
@@ -202,7 +202,7 @@ export async function analyze({ apiKey, target, frames, spacedbMatches, question
|
||||
// The analysis call reaches api.anthropic.com. A deploy with no outbound
|
||||
// network (or a blocked host) otherwise surfaces a bare "fetch failed";
|
||||
// classifyFetchError turns that into an actionable message, matching the
|
||||
// research tools. Generous timeout — a full analysis can take 30-60s.
|
||||
// research tools. Generous timeout - a full analysis can take 30-60s.
|
||||
const ctrl = new AbortController();
|
||||
const timer = setTimeout(() => ctrl.abort(), ANALYSIS_TIMEOUT_MS);
|
||||
let res;
|
||||
|
||||
@@ -5,8 +5,8 @@ function nextTxn() { return ++_txn; }
|
||||
|
||||
// SSRF guard. Operators legitimately point drivers at LAN/loopback hosts
|
||||
// (ASCOM Alpaca runs on 192.168.x / 127.0.0.1), so we do NOT block private
|
||||
// ranges. We DO block the link-local 169.254.0.0/16 block — that's never a
|
||||
// telescope and is the cloud metadata service (169.254.169.254) — plus any
|
||||
// ranges. We DO block the link-local 169.254.0.0/16 block - that's never a
|
||||
// telescope and is the cloud metadata service (169.254.169.254) - plus any
|
||||
// non-http(s) scheme. host may be a bare hostname or come from a URL.
|
||||
function assertAllowedHost(host) {
|
||||
const h = String(host || '').toLowerCase().replace(/^\[|\]$/g, '');
|
||||
@@ -213,7 +213,7 @@ export function startWeatherStationPolling(io) {
|
||||
async function pollAll() {
|
||||
// "Due to poll?" filter happens in JS so the query is portable across
|
||||
// MySQL and SQLite (MySQL has DATE_ADD/INTERVAL, SQLite doesn't share
|
||||
// the same syntax). N is small — at most one row per configured station.
|
||||
// the same syntax). N is small - at most one row per configured station.
|
||||
const all = await db.all('SELECT * FROM weather_stations WHERE enabled = 1');
|
||||
const now = Date.now();
|
||||
const stations = all.filter(s => {
|
||||
|
||||
@@ -119,8 +119,8 @@ export async function readTelescopeState(profile) {
|
||||
if (profile.driver_type !== 'alpaca') return null;
|
||||
const args = { host: profile.driver_host, port: profile.driver_port, deviceType: 'telescope', deviceNumber: profile.driver_device_number ?? 0 };
|
||||
// Capture the first probe failure so an unreachable mount reports WHY,
|
||||
// instead of silently returning all-null (which consumers — the Hardware
|
||||
// dashboard and the Nox resource strip — mis-read as "ok / reachable").
|
||||
// instead of silently returning all-null (which consumers - the Hardware
|
||||
// dashboard and the Nox resource strip - mis-read as "ok / reachable").
|
||||
let firstErr = null;
|
||||
const probe = (action) => alpacaCall('GET', { ...args, action })
|
||||
.catch(e => { if (!firstErr) firstErr = e.message || String(e); return null; });
|
||||
@@ -129,7 +129,7 @@ export async function readTelescopeState(profile) {
|
||||
probe('tracking'), probe('name'),
|
||||
]);
|
||||
// A live Alpaca mount answers at least name + slewing. If every probe
|
||||
// failed, the server is unreachable — say so explicitly.
|
||||
// failed, the server is unreachable - say so explicitly.
|
||||
const reachable = [ra, dec, slewing, tracking, name].some(v => v !== null);
|
||||
if (!reachable) return { reachable: false, error: firstErr || 'unreachable' };
|
||||
return { reachable: true, ra, dec, slewing, tracking, name };
|
||||
|
||||
@@ -18,7 +18,7 @@ async function tick() {
|
||||
const status = appDb === 'up' ? 'ok' : 'degraded';
|
||||
// status/app_db/spacedb are VARCHAR(16). probeDb returns "down: <code>"
|
||||
// on failure (e.g. "down: ECONNREFUSED" = 18 chars) which overflows the
|
||||
// column and aborts the insert. Clamp to fit — the spark-bar keys off the
|
||||
// column and aborts the insert. Clamp to fit - the spark-bar keys off the
|
||||
// up/down prefix and only shows the rest as a tooltip detail.
|
||||
const fit = v => (v == null ? v : String(v).slice(0, 16));
|
||||
await db.run(
|
||||
@@ -35,7 +35,7 @@ async function tick() {
|
||||
export function startHealthHistory() {
|
||||
// First tick once the schema is ready so the spark-bar has at least one
|
||||
// cell on cold start. Gating on dbReady avoids racing the boot-time
|
||||
// initDb() that creates health_history — an un-gated immediate tick logged
|
||||
// initDb() that creates health_history - an un-gated immediate tick logged
|
||||
// a spurious "table doesn't exist" warning on every cold start (Sentry
|
||||
// CAELUMNETWORK-10). By the time the 60s interval fires the DDL is ready.
|
||||
dbReady.then(tick);
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
import { log } from './log.js';
|
||||
|
||||
let _fetch = (...a) => globalThis.fetch(...a);
|
||||
// Test seam — inject a fake fetch. Pass null to restore the real one.
|
||||
// Test seam - inject a fake fetch. Pass null to restore the real one.
|
||||
export function __setFetchForTest(fn) { _fetch = fn || ((...a) => globalThis.fetch(...a)); }
|
||||
|
||||
function crmCfg() { return { url: (process.env.CRM_API_URL || '').replace(/\/$/, ''), key: process.env.CRM_API_KEY || '' }; }
|
||||
@@ -111,7 +111,7 @@ export async function syncOrder(order, items) {
|
||||
partial.books_invoice_id = inv?.invoice?.id || null;
|
||||
}
|
||||
|
||||
// Payment — marks the invoice paid. Remote dedups by reference, so this is
|
||||
// Payment - marks the invoice paid. Remote dedups by reference, so this is
|
||||
// safe to re-run.
|
||||
if (partial.books_invoice_id) {
|
||||
await apiCall(cfg, `/api/books/invoices/${partial.books_invoice_id}/payments`, 'POST', {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// User-limit enforcement. Source code defaults to UNLIMITED — limits
|
||||
// User-limit enforcement. Source code defaults to UNLIMITED - limits
|
||||
// only apply when LIMITS_CONFIG is set in the environment. Forks that
|
||||
// run this codebase without LIMITS_CONFIG get the no-caps experience
|
||||
// the source reads as.
|
||||
@@ -7,7 +7,7 @@
|
||||
// - a JSON file path (e.g. /etc/caelum/limits.json)
|
||||
// - an inline JSON string (e.g. '{"default":{"archive.frames_per_user":200}}')
|
||||
//
|
||||
// Schema (all keys are optional — a missing key means UNLIMITED):
|
||||
// Schema (all keys are optional - a missing key means UNLIMITED):
|
||||
// {
|
||||
// "default": { "<key>": <number>, ... },
|
||||
// "byRole": { "<role>": { "<key>": <number>, ... } }
|
||||
@@ -44,7 +44,7 @@ function loadConfig() {
|
||||
try { parsed = JSON.parse(readFileSync(raw, 'utf8')); }
|
||||
catch (e) { log.error(`[limits] failed to read ${raw}:`, e.message); return; }
|
||||
} else {
|
||||
log.warn(`[limits] LIMITS_CONFIG=${raw} is neither inline JSON nor an existing file — running unlimited`);
|
||||
log.warn(`[limits] LIMITS_CONFIG=${raw} is neither inline JSON nor an existing file - running unlimited`);
|
||||
return;
|
||||
}
|
||||
config = {
|
||||
@@ -52,7 +52,7 @@ function loadConfig() {
|
||||
byRole: parsed?.byRole || {},
|
||||
};
|
||||
active = true;
|
||||
log.info(`[limits] enforced — ${Object.keys(config.default).length} default key(s), ` +
|
||||
log.info(`[limits] enforced - ${Object.keys(config.default).length} default key(s), ` +
|
||||
`${Object.keys(config.byRole).length} role override(s)`);
|
||||
}
|
||||
loadConfig();
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// Same surface as client/src/utils/log.js so call sites read identically on
|
||||
// both sides. Delegates to console.* so existing test capture (which stubs
|
||||
// console.warn / console.log) still works — and so log routing (Docker
|
||||
// console.warn / console.log) still works - and so log routing (Docker
|
||||
// drivers, journalctl) follows whatever console maps to
|
||||
// in that runtime.
|
||||
//
|
||||
@@ -11,7 +11,7 @@
|
||||
// still provide context on a real error without each routine log line
|
||||
// ("[db] connected", "User connected", "[lifecycle] …") becoming its own
|
||||
// dashboard issue. Lazy-required so this file imports in test envs that
|
||||
// don't init Sentry — Sentry.init() is called by index.js at boot, gated
|
||||
// don't init Sentry - Sentry.init() is called by index.js at boot, gated
|
||||
// by ENABLE_SENTRY + NODE_ENV.
|
||||
|
||||
import { getSentry } from './sentry.js';
|
||||
@@ -33,7 +33,7 @@ function toSentry(level, args) {
|
||||
const msg = args.filter(a => !(a instanceof Error))
|
||||
.map(a => typeof a === 'string' ? a : safeStringify(a)).join(' ');
|
||||
const severity = sentrySeverity(level);
|
||||
// debug/info are not actionable on their own — attach them as breadcrumbs
|
||||
// debug/info are not actionable on their own - attach them as breadcrumbs
|
||||
// so they show up as context on the next real event, not as standalone
|
||||
// dashboard issues.
|
||||
if (level === 'debug' || level === 'info') {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
export const EXTERNAL_TIMEOUT_MS = 12000;
|
||||
|
||||
// Turn a raw fetch failure into a message a user can act on. The prod OVH box
|
||||
// has no reliable outbound network, so these tools abort or DNS-fail — that's
|
||||
// has no reliable outbound network, so these tools abort or DNS-fail - that's
|
||||
// not a Caelum bug and shouldn't read like a stack trace. Real upstream HTTP
|
||||
// errors (e.g. "upstream 500") are passed through unchanged.
|
||||
export function classifyFetchError(e) {
|
||||
@@ -18,7 +18,7 @@ export function classifyFetchError(e) {
|
||||
const isAbort = e?.name === 'AbortError' || /aborted/i.test(msg);
|
||||
const isConn = /fetch failed/i.test(msg) ||
|
||||
['ENOTFOUND', 'EAI_AGAIN', 'ECONNREFUSED', 'ECONNRESET', 'ETIMEDOUT', 'ENETUNREACH'].includes(code);
|
||||
if (isConn) return new Error('No outbound network from this server — this tool needs internet.');
|
||||
if (isAbort) return new Error('Upstream timed out (or no outbound network) — this tool needs internet.');
|
||||
if (isConn) return new Error('No outbound network from this server - this tool needs internet.');
|
||||
if (isAbort) return new Error('Upstream timed out (or no outbound network) - this tool needs internet.');
|
||||
return e instanceof Error ? e : new Error(msg);
|
||||
}
|
||||
|
||||
@@ -20,11 +20,11 @@ import {
|
||||
alpacaCooldown, alpacaExpose,
|
||||
} from './alpaca-camera.js';
|
||||
// Imported as `logger` because createRealDriver({ log, ... }) destructures
|
||||
// `log` as the per-run op-log array — that parameter shadows the module
|
||||
// `log` as the per-run op-log array - that parameter shadows the module
|
||||
// logger inside every method on the driver.
|
||||
import { log as logger } from './log.js';
|
||||
|
||||
// Tracks rows we've already fetched + warned about — keeps the op log
|
||||
// Tracks rows we've already fetched + warned about - keeps the op log
|
||||
// noise down when a program rapid-fires ops against an offline driver.
|
||||
const _missingResourceWarned = new Set();
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import { dbReady } from '../config/db-ready.js';
|
||||
import { log } from './log.js';
|
||||
|
||||
const POLL_MS = 15000;
|
||||
const KEEP_RECENT_MS = 6 * 60 * 60 * 1000; // 6h — dedupe window
|
||||
const KEEP_RECENT_MS = 6 * 60 * 60 * 1000; // 6h - dedupe window
|
||||
|
||||
// Set of `${kind}:${id}` seen within the dedupe window. Expired entries
|
||||
// are flushed each tick so memory stays bounded.
|
||||
@@ -26,7 +26,7 @@ function remember(key) {
|
||||
function isFresh(key, atIso) {
|
||||
if (seen.has(key)) return false;
|
||||
// Only emit if the row's `at` is newer than (now - keep window). On
|
||||
// first start every existing row is "fresh" — we silence those by
|
||||
// first start every existing row is "fresh" - we silence those by
|
||||
// priming the dedupe map below before the first emit.
|
||||
return atIso && (Date.now() - new Date(atIso).getTime()) < KEEP_RECENT_MS;
|
||||
}
|
||||
@@ -120,7 +120,7 @@ export function startPublicFeed(io) {
|
||||
timer = setInterval(tick, POLL_MS);
|
||||
// First tick once the schema is ready, so the prime pass completes and
|
||||
// subsequent ticks only emit genuinely-new rows. Gating on dbReady avoids
|
||||
// racing the boot-time initDb() that creates archive_frames — an
|
||||
// racing the boot-time initDb() that creates archive_frames - an
|
||||
// un-gated immediate tick logged a spurious "table doesn't exist" warning
|
||||
// on every cold start (Sentry CAELUMNETWORK-Y).
|
||||
dbReady.then(tick);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Workshop tools — server-side fetchers for the /research Workshop tab.
|
||||
// Workshop tools - server-side fetchers for the /research Workshop tab.
|
||||
// Each one calls a real, public, no-auth API and returns rows ready to
|
||||
// insert into research_targets (or, for one-shot lookups, a structured
|
||||
// result). The /api/research/tools/* routes glue these into the table.
|
||||
@@ -82,7 +82,7 @@ export async function pullUpcomingCloseApproaches({ daysAhead = 14, maxDist = 0.
|
||||
}
|
||||
|
||||
// ---------- Tool 2: recent transients (Rochester Astronomy) ------------
|
||||
// David Bishop's "Latest Supernovae" page is the canonical aggregator —
|
||||
// David Bishop's "Latest Supernovae" page is the canonical aggregator -
|
||||
// daily-updated, parseable table, no auth, no rate limits. OAC's REST
|
||||
// API and ALeRCE both turned out to be flaky or auth-walled when we
|
||||
// tried them; Rochester is the source that the community has relied on
|
||||
@@ -194,7 +194,7 @@ export async function resolveName(name) {
|
||||
// Asterank ranks small bodies by a composite "score" combining
|
||||
// accessibility (delta-v), size, and observational value. We filter to
|
||||
// known NEOs and pull the top N. Distinct from CNEOS CAD (which orders
|
||||
// by upcoming close approach date) — same category, different lens.
|
||||
// by upcoming close approach date) - same category, different lens.
|
||||
export async function pullTopAccessibleNeos({ limit = 10 } = {}) {
|
||||
// Asterank's MongoDB-style query selects neo=Y; sort by -score puts
|
||||
// the most rewarding targets first.
|
||||
@@ -242,7 +242,7 @@ export async function pullTopAccessibleNeos({ limit = 10 } = {}) {
|
||||
|
||||
// ---------- Tool 7: SIMBAD field crossmatch ----------------------------
|
||||
// What named objects lie within radius_arcmin of (ra, dec)? Uses SIMBAD's
|
||||
// TAP service with an ADQL cone-search against the basic table — clean
|
||||
// TAP service with an ADQL cone-search against the basic table - clean
|
||||
// JSON output, no auth, ~1s response. Returns rows as the worker
|
||||
// consumes them (no per-tool normalization).
|
||||
export async function fieldCrossmatch({ ra, dec, radiusArcmin = 6, limit = 30 }) {
|
||||
@@ -303,7 +303,7 @@ export async function pullActiveSatellites({ group = 'stations', limit = 25 } =
|
||||
|
||||
// ---------- Tool 6: DSS sky preview URL --------------------------------
|
||||
// STScI's Digitized Sky Survey serves a GIF for any RA/Dec/field-of-view.
|
||||
// We don't need a server-side fetch — the URL is stable and the client
|
||||
// We don't need a server-side fetch - the URL is stable and the client
|
||||
// can <img src=...> it directly. We expose a builder here so the client
|
||||
// route and the seam stay in one place if we ever swap to PanSTARRS or
|
||||
// HiPS tiles later.
|
||||
@@ -326,7 +326,7 @@ export function dssPreviewUrl({ ra, dec, fovArcmin = 15, format = 'gif' }) {
|
||||
// One-shot lookup; doesn't write to the table. Returns a parsed RA/Dec
|
||||
// + range + altitude (if observer specified) for the given designation
|
||||
// at the given time. Horizons returns plain text inside a JSON `result`
|
||||
// field — we parse the $$SOE...$$EOE block.
|
||||
// field - we parse the $$SOE...$$EOE block.
|
||||
export async function ephemerisLookup({ designation, when }) {
|
||||
const start = (when ? new Date(when) : new Date()).toISOString().slice(0, 16).replace('T', ' ');
|
||||
const stop = new Date(new Date(start).getTime() + 60_000).toISOString().slice(0, 16).replace('T', ' ');
|
||||
@@ -347,7 +347,7 @@ export async function ephemerisLookup({ designation, when }) {
|
||||
const text = data.result;
|
||||
const m = text.match(/\$\$SOE\s*([\s\S]*?)\s*\$\$EOE/);
|
||||
if (!m) {
|
||||
// Probably "Unknown body name" — surface that to the user.
|
||||
// Probably "Unknown body name" - surface that to the user.
|
||||
const errLine = text.split('\n').find(l => /no matches|Cannot find/i.test(l));
|
||||
throw new Error(errLine?.trim() || 'Horizons did not return an ephemeris block');
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Background-tick helper. Wraps a tick function with three guarantees:
|
||||
//
|
||||
// 1. Errors are caught — never crashes the parent process.
|
||||
// 1. Errors are caught - never crashes the parent process.
|
||||
// 2. Repeated failures from the same root cause are logged once per
|
||||
// backoff window (default 60s) so a 5s tick + a downed DB doesn't
|
||||
// drown the log in 720 identical lines per hour.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// Mirrors the client toggle exactly: ENABLE_SENTRY=true|false overrides;
|
||||
// default is on in production (NODE_ENV=production), off otherwise so
|
||||
// local dev doesn't spam the dashboard. DSN: SENTRY_DSN override, falls
|
||||
// back to the public client key (same project, same DSN — Sentry routes
|
||||
// back to the public client key (same project, same DSN - Sentry routes
|
||||
// by SDK identifier).
|
||||
|
||||
// @sentry/node is loaded lazily so importing this file in a test process
|
||||
@@ -34,8 +34,8 @@ export async function initSentry({ version = '0.0.0' } = {}) {
|
||||
environment: process.env.NODE_ENV || 'development',
|
||||
release: `caelum@${version}`,
|
||||
tracesSampleRate: 0,
|
||||
// PII off: with it on, Sentry attaches request headers — including
|
||||
// `Authorization: Bearer <jwt>` and `cae_…` API tokens — to every event,
|
||||
// PII off: with it on, Sentry attaches request headers - including
|
||||
// `Authorization: Bearer <jwt>` and `cae_…` API tokens - to every event,
|
||||
// exfiltrating live credentials. beforeSend additionally strips auth/cookie
|
||||
// headers and redacts any bearer/api-token strings that slip into payloads.
|
||||
sendDefaultPii: false,
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
// The SDK is lazy-imported (mirrors services/sentry.js) so a test process or
|
||||
// a deploy that never touches the shop doesn't pull `stripe` in. Fail-closed:
|
||||
// when STRIPE_SECRET_KEY is unset the shop is disabled and routes return 503.
|
||||
// Test vs live mode is whichever key is in the env — there is no code branch.
|
||||
// Test vs live mode is whichever key is in the env - there is no code branch.
|
||||
|
||||
let _stripe = null;
|
||||
let _loaded = false;
|
||||
let _override = null; // test seam — see __setStripeForTest
|
||||
let _override = null; // test seam - see __setStripeForTest
|
||||
|
||||
export function isShopEnabled() {
|
||||
return !!_override || !!process.env.STRIPE_SECRET_KEY;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user