From c577d8b2b6e7040a7e5bdc2e1cf903d9b8535efe Mon Sep 17 00:00:00 2001 From: KingKDot Date: Wed, 15 Jul 2026 10:14:42 -0500 Subject: [PATCH] fix onboarding cache and remove the stupid renovate stuff --- .github/renovate.json | 60 ------------------- Overlord-Server/public/assets/nav.js | 5 +- Overlord-Server/public/assets/onboarding.js | 1 + Overlord-Server/src/auth.test.ts | 10 ++++ .../src/server/routes/auth-routes.ts | 21 ++++++- 5 files changed, 34 insertions(+), 63 deletions(-) delete mode 100644 .github/renovate.json diff --git a/.github/renovate.json b/.github/renovate.json deleted file mode 100644 index 0033935..0000000 --- a/.github/renovate.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "$schema": "https://docs.renovatebot.com/renovate-schema.json", - "extends": [ - "config:recommended" - ], - "schedule": ["before 6am on Monday"], - "timezone": "UTC", - "pinDigests": true, - "labels": ["dependencies"], - "packageRules": [ - { - "description": "Group Overlord-Server minor and patch npm updates", - "matchManagers": ["npm"], - "matchPaths": ["Overlord-Server/package.json"], - "matchUpdateTypes": ["minor", "patch"], - "groupName": "Overlord-Server dependencies (minor + patch)", - "automerge": false - }, - { - "description": "Group Overlord-Desktop minor and patch npm updates", - "matchManagers": ["npm"], - "matchPaths": ["Overlord-Desktop/package.json"], - "matchUpdateTypes": ["minor", "patch"], - "groupName": "Overlord-Desktop dependencies (minor + patch)", - "automerge": false - }, - { - "description": "Group Go module minor and patch updates", - "matchManagers": ["gomod"], - "matchUpdateTypes": ["minor", "patch"], - "groupName": "Go modules (minor + patch)", - "automerge": false - }, - { - "description": "Group GitHub Actions minor and patch updates", - "matchManagers": ["github-actions"], - "matchUpdateTypes": ["minor", "patch"], - "groupName": "GitHub Actions (minor + patch)", - "automerge": false - }, - { - "description": "Group Docker base image minor and patch updates", - "matchManagers": ["dockerfile", "docker-compose"], - "matchUpdateTypes": ["minor", "patch"], - "groupName": "Docker base images (minor + patch)", - "automerge": false - }, - { - "description": "Individual PRs for all major updates", - "matchUpdateTypes": ["major"], - "groupName": null, - "automerge": false - } - ], - "ignoreDeps": [], - "vulnerabilityAlerts": { - "enabled": true, - "labels": ["dependencies", "security"] - } -} diff --git a/Overlord-Server/public/assets/nav.js b/Overlord-Server/public/assets/nav.js index 40dc8e6..8264ebd 100644 --- a/Overlord-Server/public/assets/nav.js +++ b/Overlord-Server/public/assets/nav.js @@ -159,7 +159,10 @@ if (host) { async function loadCurrentUser() { try { - const res = await fetch("/api/auth/me", { credentials: "include" }); + const res = await fetch("/api/auth/me", { + credentials: "include", + cache: "no-store", + }); if (!res.ok) { return; } diff --git a/Overlord-Server/public/assets/onboarding.js b/Overlord-Server/public/assets/onboarding.js index be5d66a..15774dc 100644 --- a/Overlord-Server/public/assets/onboarding.js +++ b/Overlord-Server/public/assets/onboarding.js @@ -119,6 +119,7 @@ export function showOnboardingIfNeeded(user) { const response = await fetch("/api/auth/onboarding/complete", { method: "POST", credentials: "include", + cache: "no-store", }); if (!response.ok) throw new Error("Could not save your onboarding status."); overlay.remove(); diff --git a/Overlord-Server/src/auth.test.ts b/Overlord-Server/src/auth.test.ts index e8f4898..1e9cf0d 100644 --- a/Overlord-Server/src/auth.test.ts +++ b/Overlord-Server/src/auth.test.ts @@ -61,6 +61,7 @@ describe("account onboarding", () => { const meUrl = new URL("https://localhost/api/auth/me"); const before = await handleAuthRoutes(new Request(meUrl, { headers }), meUrl, mockServer); expect(before?.status).toBe(200); + expect(before?.headers.get("cache-control")).toContain("no-store"); expect((await before!.json()).needsOnboarding).toBe(true); const completeUrl = new URL("https://localhost/api/auth/onboarding/complete"); @@ -70,10 +71,19 @@ describe("account onboarding", () => { mockServer, ); expect(completed?.status).toBe(200); + expect(completed?.headers.get("cache-control")).toContain("no-store"); const after = await handleAuthRoutes(new Request(meUrl, { headers }), meUrl, mockServer); expect(after?.status).toBe(200); expect((await after!.json()).needsOnboarding).toBe(false); + + const repeated = await handleAuthRoutes( + new Request(completeUrl, { method: "POST", headers }), + completeUrl, + mockServer, + ); + expect(repeated?.status).toBe(200); + expect((await repeated!.json()).needsOnboarding).toBe(false); } finally { deleteUser(created.userId!); } diff --git a/Overlord-Server/src/server/routes/auth-routes.ts b/Overlord-Server/src/server/routes/auth-routes.ts index 3c15386..8a9b34c 100644 --- a/Overlord-Server/src/server/routes/auth-routes.ts +++ b/Overlord-Server/src/server/routes/auth-routes.ts @@ -514,7 +514,10 @@ export async function handleAuthRoutes( permissions, }), { - headers: { "Content-Type": "application/json" }, + headers: { + "Content-Type": "application/json", + "Cache-Control": "no-store, private", + }, }, ); } @@ -526,7 +529,21 @@ export async function handleAuthRoutes( } completeUserOnboarding(user.userId); - return Response.json({ ok: true, needsOnboarding: false }); + const dbUser = getUserById(user.userId); + if (!dbUser || dbUser.onboarding_completed_at === null) { + return Response.json( + { error: "Could not save onboarding status" }, + { + status: 500, + headers: { "Cache-Control": "no-store, private" }, + }, + ); + } + + return Response.json( + { ok: true, needsOnboarding: false }, + { headers: { "Cache-Control": "no-store, private" } }, + ); } return null;