Skip to content

Selectable URL shortener for !path and !topo - #44

Merged
sg merged 3 commits into
mainfrom
feat/pluggable-url-shortener
Jul 30, 2026
Merged

Selectable URL shortener for !path and !topo#44
sg merged 3 commits into
mainfrom
feat/pluggable-url-shortener

Conversation

@sg

@sg sg commented Jul 30, 2026

Copy link
Copy Markdown
Owner

What changed

  • New shortener.py replaces the duplicated _shorten_sync in commands/path.py and commands/topo.py.
  • [bot] url_shortener selects dagd (default, unchanged behaviour), sink (self-hosted, with sink_api_base + SINK_API_TOKEN from [env]), or none.
  • Sink links are created via POST /api/link/upsert under a slug hashed from the target URL, so a repeated route re-uses one link rather than adding a row per invocation, and expire after sink_link_ttl_days (default 30).
  • sink falls back to da.gd on outage, misconfiguration, or rejection.

Why

Sink caps target URLs at 2048 characters; a geojson.io map for a route past ~8 hops exceeds that, so the fallback is what stops long routes from silently losing their map link. The API token can't live in a git-tracked command script, hence [env].

Breaking changes

None. Default stays da.gd.

Verified end-to-end against a live Sink instance: create, upsert dedup, 30-day expiry, 302 fragment preservation, and the over-length fallback. 127 tests pass.

@sg
sg merged commit aa4766a into main Jul 30, 2026
1 check passed
@sg
sg deleted the feat/pluggable-url-shortener branch July 30, 2026 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant