Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .changeset/drop-u-prefix-host-fallback.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"sideshow": patch
---

Drop the dead `/u/`-prefix URL fallback from the default viewer host. The
embeddable engine's `createDefaultHost()` now derives its base path solely from
`window.__SIDESHOW_BASE_PATH__` (empty at root) instead of also sniffing a
`/u/:account` prefix out of `location.pathname`. That fallback was specific to an
old hosted-wrapper URL shape; self-hosted sideshow already runs at the root or
sets the global explicitly, so behavior is unchanged for every supported host.
2 changes: 1 addition & 1 deletion viewer/embed.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export interface HostRouter {
}

export interface SideshowHost {
/** Link/base prefix the engine prepends to every path, e.g. "/u/alice" (""). */
/** Link/base prefix the engine prepends to every path, e.g. "/alice" (""). */
basePath: string;
router: HostRouter;
/** The caller's own identity, when the host knows it. */
Expand Down
11 changes: 5 additions & 6 deletions viewer/src/host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export interface HostRouter {
}

export interface SideshowHost {
// Link/base prefix the engine prepends to every path, e.g. "/u/alice" ("" at
// Link/base prefix the engine prepends to every path, e.g. "/alice" ("" at
// root). API calls are `${basePath}/api/...`.
basePath: string;
router: HostRouter;
Expand Down Expand Up @@ -157,12 +157,11 @@ export function host(): SideshowHost {
return (defaultHostCache ??= createDefaultHost());
}

// Self-hosted default host: base path from the hosted-wrapper global / URL
// prefix (as the pre-engine viewer read it), routing over the History API with
// URL shapes identical to before (/session/:id and /session/:id/s/:sid).
// Self-hosted default host: base path from the hosted-wrapper global (set by any
// wrapper before the engine loads; empty at root), routing over the History API
// with URL shapes identical to before (/session/:id and /session/:id/s/:sid).
export function createDefaultHost(): SideshowHost {
const basePath =
window.__SIDESHOW_BASE_PATH__ ?? location.pathname.match(/^\/u\/[^/]+/)?.[0] ?? "";
const basePath = window.__SIDESHOW_BASE_PATH__ ?? "";
const subs = new Set<(r: Route) => void>();

const get = (): Route => {
Expand Down
Loading