Skip to content
jeamyPublic

About

Star map in the browser: a test development from FORUM (phi-space)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

forumsky

The starry sky for a chosen place and time: a static browser PWA without a server. The style follows asciisky.jpg: green on almost black, in monospace.

forumsky is a test development from FORUM, part of phi-spaces: several AI models worked out its plan together in a FORUM room, and the app was then built from that plan.

The plan is docs/plan.md. It is the document the FORUM room sternhimmel wrote (table B, version 44, accepted by its owner), unchanged. Its paths start with project/, which was the task's workspace there; in this repository project/ is the repository root. So project/src/astronomy.ts is src/astronomy.ts.

Docker

Command What it does
docker compose up -d --build Builds and starts the release behind nginx: http://localhost:4400
docker compose logs -f web, docker compose down Its log; stop it
docker compose --profile dev up --build dev Vite with src/, public/ and index.html of the checkout mounted: http://localhost:4401

The image is only built when the typecheck, the build and the unit tests pass in it; nothing has to be installed on the host. docker/nginx.conf lets the browser ask anew for everything but the hashed files in assets/, so an update of the service worker arrives. material/, secrets and raw/ are not in the build context (.dockerignore). Both ports are bound to this machine only (FORUMSKY_PORT, FORUMSKY_DEV_PORT change them). The build switches below are passed on from the environment, e.g. FORUMSKY_CONSTELLATIONS=0 docker compose up -d --build. Under another name than localhost the browser allows offline use and the device location only over https, so a proxy with a certificate belongs in front there. The browser tests run on the host.

Time

The bar « ‹ time › » ⟳ moves the map back and forward by a day or an hour; ⟳ returns to the present. The keys are { [ ] } and t, outside the input fields. The time in the bar is UTC, and a click on it leads to the time field. Any time but the present is marked SIM. The time runs on, a simulated one too: the map follows once a minute, not while the tab is in the background, and not while input is being edited or is invalid. A step starts at an edited time if there is one. A step beyond the years 2000 to 2035 or with an invalid place changes nothing. Nothing is stored: a reload starts at the present.

Constellations

✦ Sternbilder switches the lines and German names of all 88 constellations on and off; they start on. src/constellations.ts draws each line as the great circle between its stars, cuts it at the horizon and splits it at north, the map's edge. Names stand by the middle of the visible stars, and lines and names are drawn behind the stars. The data is src/data/constellations.json. HIP 33165 (Canis Major, 6.65 mag) is fainter than the catalog's limit, so its position is kept there for its two lines only. The lines come from Stellarium's team, licensed under CC BY-SA 4.0; source, license and changes are in src/data/LICENSE.md.

Commands

Command What it does
npm install The dev dependencies of the plan (TypeScript, tsx, Vite, Vitest, Playwright)
npm run dev Development server
npm run build tsc --noEmit, then the static build in dist/
npm test The unit tests (tests/*.test.ts, Vitest), run after npm run build
npm run generate:catalog -- <hip_main.dat> Writes src/data/stars.json from a local Hipparcos main catalogue (CDS I/239); also $HIP_MAIN or raw/hip_main.dat
npm run generate:constellations -- <constellationship.fab> [hip_main.dat] Writes src/data/constellations.json from a local copy of the figures of Stellarium's sky culture Modern, formerly Western (exact version in src/data/LICENSE.md); hip_main.dat as above
npm run test:e2e The browser tests (tests/*.spec.ts, Playwright) against dist/

The check of every phase is npm run build && npm test (from phase 3 on also npm run test:e2e). Playwright downloads no browser: it starts this machine's Chromium (/usr/bin/chromium-browser, or PLAYWRIGHT_CHROMIUM); install with PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm install.

Computation and its reference (phase 2)

src/astronomy.ts uses UTC for UT1, the mean sidereal time and the catalog's ICRS directions without precession, nutation, aberration, proper motion or refraction. It accepts the UTC years 2000 to 2035. The target angles in tests/fixtures/sky-reference.json come from Astropy/ERFA (python3 scripts/reference-sky.py; the versions are in the file): 60 cases, Polaris, Sirius and Regulus at four places with both signs of longitude, from 2000 to the end of 2035. The largest angle between computed and target direction is 0.507° (Regulus, end of 2035, mostly the precession since J2000); the threshold is 0.75°.

Reference star of the pixel test (phase 3): Sirius (HIP 32349), Vienna 48.2082° N 16.3738° E, 2026-01-15T22:00:00Z, target azimuth 180.16°, altitude 25.05°; computed minus target: azimuth +0.313°, altitude +0.027°. The pixel tolerance is the 0.75° direction threshold plus the drawn dot's radius. Since Sirius stands on the meridian, where a mirrored azimuth looks the same, the test also checks Regulus (HIP 49669) at the same place and time (target azimuth 113.25°, altitude 34.47°). The test computes the projection itself (azimuth linear from left to right, altitude from the horizon up), not with the renderer's own function.

Exclusion check (phase 4)

The app shows no photo and no overlay; asciisky.jpg is only the style reference. tests/material-exclusion.test.ts checks the fresh dist/ with tests/support/exclusion.ts: no file named after a task picture or secrets, nothing from material/, no raster image but the declared icons, no reference to them in any text asset, and with a counter-probe that the same function reports what is smuggled into a copy. The comparison by bytes with the task's photo runs only where a copy is at material/IMG_20150703_172002.jpg (ignored by git) or $MATERIAL_PHOTO; otherwise the test run lists it as skipped, with the reason.

Device location and offline use (phase 5)

  • Device location: the button „Geräte-Standort verwenden“ asks the browser only when clicked; the coordinates go into the fields and through the same check as typed input, the time stays. Nothing is stored or sent.
  • Offline: npm run build ends with scripts/build-service-worker.ts, which writes dist/sw.js. Its cache version is a hash over all release files. It installs only when every file loaded; an update waits until no tab of the old version is open; on activation it deletes only older forumsky-… caches. The page says „Offline bereit“ once the worker controls it and has every file.
  • Way back: a build with FORUMSKY_OFFLINE=0 registers no worker, and its sw.js is the clean-up worker. It deletes the app's own caches, unregisters itself and reloads the open pages. For an earlier offline version, ship its complete build again; it gets a new cache version by its contents.
  • Build switches (src/features.ts): FORUMSKY_GEOLOCATION=0, FORUMSKY_OFFLINE=0 and FORUMSKY_CONSTELLATIONS=0 turn a function off; without the constellations their data is not in the build either. FORUMSKY_BUILD_LABEL names the build (shown at the bottom right). All three are on by default.
  • Icons: public/icons/ from npm run make:icons (scripts/make-icons.ts, PNG without an image library).

tests/pwa.spec.ts builds versions A, B, B without its CSS, the clean-up release and one without geolocation, and serves them from tests/support/static-server.ts. That server is stopped for "offline", so nothing answers, the service worker's fetches included.

Not done here

  • Acceptance on a phone (plan, "Abnahme"): start without an account or location permission, then „Offline bereit“, then a reload without network and a map for another place and time. Note the device, the browser and the time it took.

Catalog

src/data/stars.json is committed, so a build does not need the raw catalogue. Its source, the columns used and the license are in src/data/LICENSE.md: the Hipparcos catalogue, Credit: ESA, CC BY-NC 3.0 IGO, so non-commercial use only.

Licenses

The code is under the MIT License. It does not cover the data below, which keeps its own licenses; with the star catalog included, the project may be used for non-commercial purposes only.

Data licenses

Only this repository is published, not a running app or a build. Details and changes to the data: src/data/LICENSE.md.

Data Source License
src/data/stars.json, lineStars in src/data/constellations.json, and the star positions in tests/fixtures/sky-reference.json Credit: ESA, The Hipparcos and Tycho Catalogues, ESA SP-1200 (1997) CC BY-NC 3.0 IGO, non-commercial use only
The figures in src/data/constellations.json Stellarium's team, sky culture Modern CC BY-SA 4.0

About

Star map in the browser: a test development from FORUM (phi-space)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages