Skip to content

ohm-geocontext/geocontext-app

Repository files navigation

GeoContext Editor

A small Tauri v2 + SvelteKit desktop app for authoring and updating GeoContext repositories per FORMAT.md.

Every command runs inside Docker so the host doesn't need Rust / Node / webkit2gtk-4.1 installed.

What it does

  • Open / clone / new — open a local folder, clone a GitHub repo, or seed a fresh geocontext.json + datasets/. Recent repositories are remembered between sessions (workspace registry).
  • Forms for the top-level fields, datasources (geojson / csv, inline or HTTP), and layers (features / markers / raster-tiled / vector-tiles / raster-dem) with the style.options shorthand and a raw style.maplibre escape hatch.
  • detail.title + detail.media[] editor, including the csv-row media kind (join an external CSV to features by id).
  • Backgrounds — single basemap or a backgrounds[] selector with background-color and image-overlay (georeferenced raster) types.
  • Import local GeoJSON, or a Shapefile reprojected to WGS84 (proj4rs, EPSG auto-detected from the .prj).
  • Content tab — manage chcx-static.json static pages (markdown / HTML) and edit README.md / CITATION.cff.
  • Assets tab — repo file inventory with referenced/orphan analysis, plus one-click Frictionless datapackage.json generation (CSV schemas inferred, hand-authored metadata preserved).
  • GitHub — sign in (OAuth device flow or PAT), pull, sync (commit + push), and publish a new repo.
  • Live MapLibre preview that re-renders as you edit, using the §9 asset-path rewrite when you supply user / project / ref coords.
  • Inline validation against the FORMAT.md required fields, and a raw JSON tab for advanced edits.

Quick start

make build        # build the docker image (one-time, ~2 GB)
make install      # npm install inside the container
make check        # cargo check the Rust side (slow first time)
make dev          # SvelteKit dev server only — open http://localhost:1420
make tauri-dev    # full Tauri shell (needs a DISPLAY / X server)

make tauri-dev only opens a window when an X server is reachable. On a headless host you can use the dev target to exercise the UI in a browser, then build the binary on a desktop machine with make tauri-build.

Layout

src/                   SvelteKit frontend (routes/, lib/)
  lib/types.ts         GeoContext TS types
  lib/validate.ts      validator → flat issue list keyed by path
  lib/assetPath.ts     §9 path rewrite (jsDelivr)
  lib/tauri.ts         thin wrapper around Tauri commands
  lib/components/      TopLevelForm, DatasourcesEditor, LayersEditor,
                       MapPreview, JsonView
src-tauri/             Rust crate (load_geocontext, save_geocontext,
                       create_geocontext_repo, list_assets)
Dockerfile             Ubuntu 24.04 + Rust stable + Node 20 +
                       webkit2gtk-4.1-dev
docker-compose.yml     mounts the project; persistent volumes for
                       node_modules + cargo target
Makefile               convenience targets, all routed through Docker

Notes

  • The Tauri commands do plain filesystem I/O on a folder path the user picks via the dialog, so there are no scoped fs: ACL entries to maintain.
  • The application icon set in src-tauri/icons/ is generated from assets/logo.png (a square PNG, ≥ 512 px) with make icons (tauri icon). Re-run it after changing the logo.
  • GitHub sign-in has three tiers, picked automatically by what's configured at build time:
    • Seamless browser flow (recommended) — the loopback Authorization Code flow: the app opens your browser, you approve, and you're bounced straight back, no code to copy. GitHub OAuth Apps don't support PKCE, so this needs both GEOCONTEXT_OAUTH_CLIENT_ID and GEOCONTEXT_OAUTH_CLIENT_SECRET at build time. GitHub matches the callback URL exactly (host and port), so the redirect is a fixed loopback URL, not an ephemeral port: register http://127.0.0.1:8765/callback as the OAuth App's Authorization callback URL. To use a different port/path, set GEOCONTEXT_OAUTH_REDIRECT at build time to the exact URL you registered (the app binds the port parsed from it). If that port is busy at sign-in time the app reports it and you can retry. Note the embedded secret is not truly confidential in a desktop binary — the blast radius is limited to consent-screen phishing, which is the accepted trade-off for this flow on native apps.
    • Device flow — set only GEOCONTEXT_OAUTH_CLIENT_ID; the app shows a short code to type on GitHub's device page. No secret.
    • Personal access token — always available as a manual fallback. Set the build env in release.yml (and locally before make tauri-build) to bake the credentials in.
  • CSV preview isn't parsed into points inside the embedded preview — the GeoContext front-end is the source of truth there. The editor treats CSV datasources as schema-only.

About

Tauri v2 + SvelteKit editor for GeoContext repositories (openhistorymap/geocontext-front FORMAT.md).

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors