Skip to content

Add device links API and sync workflow#94

Merged
thebentern merged 2 commits into
masterfrom
api-links-overhaul
Jun 10, 2026
Merged

Add device links API and sync workflow#94
thebentern merged 2 commits into
masterfrom
api-links-overhaul

Conversation

@thebentern

Copy link
Copy Markdown
Contributor

Add device links catalog and API support plus a GitHub Action to keep it synced. Introduces data/deviceLinks.json (pulled from msh.to), new lib and route files (src/lib/deviceLinks.ts, src/routes/deviceLinks.ts), and integrates them via changes to src/index.ts and src/routes/index.ts. The workflow (.github/workflows/sync-device-links.yml) fetches https://msh.to/api/urls, validates the payload with jq, pretty-prints to data/deviceLinks.json, and commits changes as github-actions[bot] on an hourly schedule (at :17) so the catalog is reviewable in-repo and no runtime dependency on msh.to is required.

Add device links catalog and API support plus a GitHub Action to keep it synced. Introduces data/deviceLinks.json (pulled from msh.to), new lib and route files (src/lib/deviceLinks.ts, src/routes/deviceLinks.ts), and integrates them via changes to src/index.ts and src/routes/index.ts. The workflow (.github/workflows/sync-device-links.yml) fetches https://msh.to/api/urls, validates the payload with jq, pretty-prints to data/deviceLinks.json, and commits changes as github-actions[bot] on an hourly schedule (at :17) so the catalog is reviewable in-repo and no runtime dependency on msh.to is required.
@thebentern thebentern requested review from garthvh and jamesarich June 5, 2026 16:58
@jamesarich

Copy link
Copy Markdown

shape's right, directly consumable. two things before merge:

  1. quality is red — data/deviceLinks.json fails biome's format check (the sync writes it with jq, biome wants its own style, so it'll keep failing on every sync). simplest fix is to stop linting generated data: !data/** in files.includes.
  2. drop the dead originalUrl in lib/deviceLinks.ts — it's declared and mapped, but /api/urls strips it so it's always undefined, and the schema forbids it anyway. leaving it in just risks someone "fixing" the type and re-leaking the destination url.

good to go once those land.

- biome.json: ignore data/** so the jq-formatted, Action-synced
  data/deviceLinks.json is not subject to biome's formatter (it would
  fail on every hourly sync otherwise). Fixes the red 'quality' check.
- Drop originalUrl end-to-end (lib + synced catalog): msh.to's public
  /api/urls no longer exposes the redirect destination (review feedback),
  so /resource/deviceLinks doesn't surface it either.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@thebentern thebentern merged commit 13df354 into master Jun 10, 2026
3 checks passed
@thebentern thebentern deleted the api-links-overhaul branch June 10, 2026 01:51
jamesarich added a commit to meshtastic/Meshtastic-Android that referenced this pull request Jun 10, 2026
…cher

Replace the bundled urls.json + marketplaces.json and the client-side DeviceLinkMatcher heuristic with a fetch of the now-live /resource/deviceLinks endpoint, which returns fully-resolved links (type, targets, regions). The client seeds from a bundled snapshot, refreshes from the network, and filters the cache - mirroring the DeviceHardware repository pattern.

- core/model: NetworkDeviceLink DTOs; DeviceLink drops originalUrl, adds targets
- core/network: ApiService.getDeviceLinks() + DeviceLinksRemoteDataSource
- core/database: device_link drops original_url, adds targets; DB v42 -> v43
- core/data: rewrite DeviceLinkRepositoryImpl (seed -> single-flight refresh); delete DeviceLinkMatcher + the MshTo datasource/model
- assets: replace urls.json + marketplaces.json with a device_links.json snapshot

Internal links are excluded from the directory per the API contract ("clients exclude 'internal' from purchase UI"). F-Droid and desktop fall back to the bundled snapshot when the API is unavailable, as they do for device hardware.

Follow-up to #5714; depends on meshtastic/api#94 and meshtastic/msh.to#3 (both merged).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

2 participants