diff --git a/site/public/service-worker.js b/site/public/service-worker.js new file mode 100644 index 0000000..75859d5 --- /dev/null +++ b/site/public/service-worker.js @@ -0,0 +1,24 @@ +// Tombstone service worker for the site origin's root scope (`/`). +// +// The game UI used to be served at this origin's root with a +// root-scoped service worker. It now lives under `/game/` (its own +// scoped worker), and the project site served at `/` ships no service +// worker of its own. This file exists only so any lingering old +// root-scoped worker, on its next update check, replaces itself with +// this one — which unregisters itself and reloads its controlled pages +// so they fall through to the live network (the site) instead of a +// stale cache. New visitors never register it; nothing here calls +// `register`. +self.addEventListener("install", () => self.skipWaiting()); + +self.addEventListener("activate", (event) => { + event.waitUntil( + (async () => { + await self.registration.unregister(); + const clients = await self.clients.matchAll({ type: "window" }); + for (const client of clients) { + client.navigate(client.url); + } + })(), + ); +}); diff --git a/ui/frontend/src/routes/+layout.svelte b/ui/frontend/src/routes/+layout.svelte index d9c83cf..8362e76 100644 --- a/ui/frontend/src/routes/+layout.svelte +++ b/ui/frontend/src/routes/+layout.svelte @@ -90,7 +90,10 @@ } if (session.status === "anonymous" && pathname !== "/login") { void goto(withBase("/login"), { replaceState: true }); - } else if (session.status === "authenticated" && pathname === "/login") { + } else if ( + session.status === "authenticated" && + (pathname === "/login" || pathname === "/") + ) { void goto(withBase("/lobby"), { replaceState: true }); } }); diff --git a/ui/frontend/src/routes/+page.svelte b/ui/frontend/src/routes/+page.svelte index bec7e60..0f0ce3c 100644 --- a/ui/frontend/src/routes/+page.svelte +++ b/ui/frontend/src/routes/+page.svelte @@ -1,22 +1,18 @@ -
-

Galaxy

-

Cross-platform UI client — workspace skeleton.

+
+

{i18n.t("common.loading")}

- - diff --git a/ui/frontend/tests/landing.test.ts b/ui/frontend/tests/landing.test.ts deleted file mode 100644 index 2e7ffe3..0000000 --- a/ui/frontend/tests/landing.test.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { render } from "@testing-library/svelte"; -import { describe, expect, it } from "vitest"; -import Page from "../src/routes/+page.svelte"; - -describe("landing page", () => { - it("renders a non-empty version string in the footer", () => { - const { getByTestId } = render(Page); - const footer = getByTestId("app-version"); - expect(footer).toBeInTheDocument(); - expect(footer.textContent?.trim()).not.toBe(""); - expect(footer.textContent).toMatch(/version\s+\S+/); - }); -});