8565942392
Serve the whole stack behind one host: site at /, game UI at /game/, gateway REST at /api + /healthz, Connect at /rpc (prefix stripped by the edge Caddy). The built artifact is domain-agnostic — the UI talks to the gateway same-origin via relative URLs, so the same bundle runs under any host with no rebuild and with CORS disabled. - Rename the Connect proto service galaxy.gateway.v1.EdgeGateway -> edge.v1.Gateway; regenerate Go + TS; public path /rpc/edge.v1.Gateway. - Move the game UI under base path /game (env BASE_PATH); make the manifest, service-worker scope, WASM loader, and all navigation base-aware via a withBase helper. - Relative API + /rpc Connect prefix; Vite dev proxy mirrors the strip. - Rewrite the edge Caddy (dev + prod) for path-based routing; empty CORS allow-lists (same-origin); single host. - New VitePress project site (site/): i18n en/ru with switcher, LaTeX math, minimal monospace theme; built and served at /. - dev-deploy compose/Makefile + CI (dev-deploy, prod-build, new site-build) build and seed the site; probes hit /, /game/, /healthz. - Sync docs (ARCHITECTURE, gateway README/openapi, dev-deploy & local-dev READMEs, CLAUDE.md, ui/PLAN). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
26 lines
1.1 KiB
TypeScript
26 lines
1.1 KiB
TypeScript
// Base-path helpers for the single-origin deployment. The game UI is
|
|
// served under `kit.paths.base` — empty at the root for local dev,
|
|
// vitest, and Playwright, and `/game` in the deployed single-origin
|
|
// build. SvelteKit does not auto-prefix `goto`, `<a href>`, raw asset
|
|
// fetches, or the service-worker scope, so every app-internal absolute
|
|
// path is routed through `withBase`.
|
|
//
|
|
// `base` from `$app/paths` is the low-level primitive that `resolve()`
|
|
// builds on. We use it directly here (rather than `resolve()`) because
|
|
// the client navigates to and fetches dynamic, runtime-built paths
|
|
// (command routes, `core.wasm`, the service worker) that `resolve()`'s
|
|
// statically-typed route-id surface cannot express.
|
|
import { base } from "$app/paths";
|
|
|
|
/** appBase is the configured base path (empty string at the root). */
|
|
export const appBase = base;
|
|
|
|
/**
|
|
* withBase prefixes an app-internal absolute path (leading slash) with
|
|
* the configured base path. At the root it returns the path unchanged;
|
|
* under the single-origin deployment it yields e.g. `/game/lobby`.
|
|
*/
|
|
export function withBase(path: string): string {
|
|
return `${base}${path}`;
|
|
}
|