Vite SPA for reviewing OpenStreetMap changesets against the live
osmcha.org API (https://osmcha.org/api/v1). It is a
restyle of osmcha-frontend;
it is not the production osmcha.org UI.
Live preview: tordans.github.io/osmcha2.
Development
- Install Bun ≥ 1.3.14 (see
.tool-versions). bun installbun run dev— http://127.0.0.1:5287bun run checkbefore a commit; CI runsbun run check-cithenbun run build. Push runsbun run check-pre-pushvia Husky.
OAuth sign-in works on localhost / 127.0.0.1 against production Django (Origin redirect). Other public hosts (including GitHub Pages) use token import: reuse the API token from osmcha.org. The production API requires a token for list and changeset requests.
A request to let this app sign in directly is open upstream: OSMCha/osmcha-frontend#931 (an extra redirect URI, or accepting an OSM identity token). Until that is answered, token import stays the only way on GitHub Pages.
Token import (GitHub Pages and custom hosts)
On the Sign in screen you can:
- Paste the API key. osmcha.org/user shows
"API key" with a copy button; it copies
Token …, which the paste field takes as it is. This works on phones too. - Bookmarklet (computer only). Drag "OSMCha2 sign-in" onto your bookmarks
bar. On osmcha.org while signed in, click the
bookmark. It uses
postMessagefrom osmcha.org only; the token never goes in the URL (avoid?token=. It leaks via history, Pages logs, and referrers).
Caveats: Chrome often blocks clicking javascript: links on the page.
Drag to the bookmarks bar (or use Copy code). osmcha.org CSP may block some
bookmarklets; then use paste. Only install the bookmarklets from this app's
Sign in screen, and only run them on osmcha.org.
Preview the GitHub Pages login UI locally
Localhost normally shows OSM Sign in, so you cannot see the token-paste
screen without a flag. In bun run dev:
- Sign out if you are already signed in.
- Click the pink token UI chip next to the breakpoint helper (bottom center).
- The Sign in screen and menu switch to token paste, the same flow as tordans.github.io/osmcha2.
The chip is a sessionStorage flag (osmcha-preview-token-import). It is
only honored in the Vite dev server; production builds ignore it. Click
again to return to OSM OAuth. A bookmarklet built while previewing is baked
to the current origin (http://127.0.0.1:5287/); use the Pages deploy’s
Sign in screen for a Pages-targeted bookmarklet.
API hosts, page size, and date defaults live in src/config/constants.ts. There is no .env file.
How routes and APIs are cached: docs/caching.md.
GitHub Pages
Static hosting at tordans.github.io/osmcha2.
The Vite base comes from VITE_BASE (GitHub Actions sets it from
actions/configure-pages). Deep links work because the production build
copies index.html → 404.html.
Pages source: GitHub Actions via
Deploy GitHub Pages on push to main.
The app talks to https://osmcha.org/api/v1 (see src/config/constants.ts).
Preview a project-pages build locally:
VITE_BASE=/osmcha2/ bun run build
bun run preview
RSS feeds
The RSS links of saved filters are rewritten by a small service hosted by TILDA, so feed entries open in OSMCha2. This is the easy way to follow changesets on a phone: subscribe in any RSS reader and tap an entry.
https://tilda-geo.de/api/osmcha2-rss-rewrite?url=<URL-encoded source feed>
Accepted source feeds:
- OSMCha saved filter:
https://osmcha.org/api/v1/aoi/<id>/changesets/feed/ - WhoDidIt area feed:
https://simon04.dev.openstreetmap.org/whodidit/scripts/rss.php?bbox=<left,bottom,right,top>
Each entry links to the changeset in OSMCha2 and lists what the source feed
provides (comment, user, editor, change counts) plus the links of the "Open
in" menu (OSMCha, OpenStreetMap, Achavi, WhoDidIt, ResultMaps, OSM Revert,
Level0, JOSM, iD, Rapid, Spyglass) and of the user (profile, HDYC). The
entry IDs (guid) are taken over unchanged, so a reader that already knows
the source feed does not show entries twice. Nothing is stored; the source
feed is fetched and converted on each request.
Its URL is RSS_REWRITE_URL in
src/config/constants.ts; its code is
app/src/routes/api/osmcha2-rss-rewrite.ts
in tilda-geo.
Related
osmcha-django— production APImaplibre-adiff-viewer— changeset maposmcha-frontend— production frontend this restyles