feat(frontend): migrate REST/audio/SW to /api/v1#41
Merged
Conversation
The frontend has been carrying legacy /api/* deprecation traffic since
the native v1 surface landed. Move every client-side caller over to v1
so production logs stop showing self-inflicted hits in the legacy-usage
report:
- RTK Query base URL flips to /api/v1
- /api/v1/listener/tg-selection (was /api/auth/tg-selection)
- /api/v1/admin/radioreference/preview (was /admin/radioreference/preview/csv)
- /api/v1/admin/legacy-usage (was /v1/admin/legacy-usage relative to /api)
- raw fetch() in main.tsx auth-recovery and ToolsPanel Swagger session
- audio download URLs in player.ts, BookmarksPanel, SearchPanel
- service worker passthrough regex accepts both /api/v1/{calls,shared}
and the legacy variants during the transition window
- vite dev proxy forwards /api/v1/ws WebSocket upgrades
Legacy /api/* routes remain available with deprecation headers for
external consumers; this only moves the embedded frontend.
All 201 vitest specs pass. tsc clean. Backend unchanged.
The directive was on the const declaration; ESLint reports it unused because the actual regex literal sits on the next line. Move the comment onto the .replace() call that owns the control-class regex.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The legacy-usage report on production is showing the embedded frontend itself as the top consumer of
/api/*deprecation traffic:Every one of those is the embedded SPA. The native
/api/v1/*surface has shipped and the WS clients already use/api/v1/ws/{listener,admin}, but the REST + audio paths were left on the legacy URLs.What
baseUrl→/api/v1tg-selectionslice →/listener/tg-selection(matches the v1 rename)/admin/radioreference/preview/csv→/admin/radioreference/preview(v1 dropped the/csvsuffix)/v1/admin/legacy-usage(relative-to-/apihack) →/admin/legacy-usagefetch()inmain.tsxaudio-recovery andToolsPanelSwagger session bootstrap →/api/v1/...player.ts,BookmarksPanel,SearchPanel→/api/v1/calls/:id/audio/api/v1/{calls,shared}and the legacy variants (so an old SW cached on a client doesn't break audio during the transition)/api/v1/wsWebSocket upgradesLegacy
/api/*routes remain available with deprecation headers — this only changes what the embedded frontend asks for.Validation
npx tsc --noEmit— cleanpnpm test— 201/201 passingpnpm build— succeedsgo vet ./... && go build ./...— cleandownloadFilename.tsis ondevand unrelated to this PROut of scope
External callers (TR uploaders, SDRTrunk shim, third-party clients) still hit
/api/*and will continue to surface in the legacy-usage report — that's the whole point of that report. After this PR lands the only entries should be from real third-party clients.