Skip to content

Allow tenant browser origins on /v1/me - #6

Merged
anshg1214 merged 2 commits into
mainfrom
feat/me-cors
Nov 14, 2026
Merged

anshg1214 merged 2 commits into
mainfrom
feat/me-cors

Conversation

@anshg1214

Copy link
Copy Markdown
Member

Lets a tenant's page call /v1/me/* from the browser, so ListenBrainz can show the inbox without proxying through its backend.

  • CORS is one rs/cors middleware, chained ahead of OAuth for both /v1/me and the streams. Responses are readable by an allowed page, 401 and 403 included, and the preflight is answered without a token.
  • Origins come from each tenant's stream_origins. Routes without a tenant in the path (e.g. /v1/me/channels) allow any tenant's origins.
  • The tenant is read from the decoded path, so listen%62rainz can't fall back to every tenant's origins.
  • The streams drop their own CORS code and OPTIONS routes.

Tests: e2e/me_cors_test.go; stream preflight test updated for rs/cors echoing the requested method and headers.

The preflight is answered by the middleware, so the streams no longer
need OPTIONS routes or a CORS step per route.
A tenant's page can call its /v1/me routes directly and read every
response, 401 and 403 included. Routes without a tenant in the path
allow any tenant's origins.
@anshg1214
anshg1214 merged commit ae4bce7 into main Nov 14, 2026
1 check passed
@anshg1214
anshg1214 deleted the feat/me-cors branch November 14, 2026 19:10
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