fix: thread API calls 404 on subdomain routing (jeff.rspace.online)

basePath was always returning /{space}/rsocials/ which works for path-based
routing (rspace.online/jeff/rsocials/) but double-prefixes on subdomain
routing (jeff.rspace.online/jeff/rsocials/ → rewritten to /jeff/jeff/rsocials/).

Now detects subdomain hosts (*.rspace.online, *.rsocials.online) and returns
/rsocials/ without the space prefix, since the space is the subdomain.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jeff Emmett 2026-03-05 16:47:41 -08:00
parent 0abfce2991
commit f4edf3b7ae
1 changed files with 6 additions and 0 deletions

View File

@ -80,6 +80,12 @@ export class FolkThreadBuilder extends HTMLElement {
}
private get basePath() {
// On subdomain routing (e.g. jeff.rspace.online), the space is the subdomain
// and paths should be /rsocials/... not /jeff/rsocials/...
const host = window.location.hostname;
if (host.endsWith('.rspace.online') || host.endsWith('.rsocials.online')) {
return '/rsocials/';
}
return `/${this._space}/rsocials/`;
}