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
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
const storageKey = "tdkpin.save.v1";
|
const storageKey = "tdkpin.save.v1";
|
||||||
const encoder = new TextEncoder();
|
const encoder = new TextEncoder();
|
||||||
const decoder = new TextDecoder();
|
const decoder = new TextDecoder();
|
||||||
const highScoreApi = "/api/highscores";
|
const highScoreApi = "./api/highscores";
|
||||||
const highScoreRetryInitialDelayMs = 250;
|
const highScoreRetryInitialDelayMs = 250;
|
||||||
const highScoreRetryMaxDelayMs = 30_000;
|
const highScoreRetryMaxDelayMs = 30_000;
|
||||||
let lastRevision = 0;
|
let lastRevision = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user