From 9c5b033c0ab0f6bab5c4ab4f896f1e46334b9001 Mon Sep 17 00:00:00 2001 From: ddidderr Date: Sat, 29 Aug 2026 20:08:15 +0200 Subject: [PATCH] fix(web): use relative path for high-score API endpoint Change the high-score endpoint URL in storage.js from "/api/highscores" to "./api/highscores". When serving the web build from a subpath rather than the domain root, an absolute path sends fetch requests to the domain root instead of the nested application path. Using a relative URL ensures requests resolve relative to the active document path while still working when hosted at root. Test Plan: - `node --check tdkpin-rs/web/storage.js` -- passed - `npx prettier --check tdkpin-rs/web/storage.js` -- passed - `just test` -- passed (138 game tests, 3 highscore-server tests) - `just clippy` -- passed - `git diff --cached --check` -- passed --- tdkpin-rs/web/storage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tdkpin-rs/web/storage.js b/tdkpin-rs/web/storage.js index 016dfc7..2198613 100644 --- a/tdkpin-rs/web/storage.js +++ b/tdkpin-rs/web/storage.js @@ -4,7 +4,7 @@ const storageKey = "tdkpin.save.v1"; const encoder = new TextEncoder(); const decoder = new TextDecoder(); - const highScoreApi = "/api/highscores"; + const highScoreApi = "./api/highscores"; const highScoreRetryInitialDelayMs = 250; const highScoreRetryMaxDelayMs = 30_000; let lastRevision = 0;