From 8fb06c71d370a27697628077474a261596b567e0 Mon Sep 17 00:00:00 2001 From: Blake Matthes Date: Mon, 17 Mar 2025 16:16:06 -0500 Subject: [PATCH] feat(auth): remove all old localstorage if no session --- .gitignore | 1 + frontend/src/hooks/useSession.ts | 10 +++++++ package-lock.json | 46 +++++++++++++++++++++----------- package.json | 3 ++- 4 files changed, 44 insertions(+), 16 deletions(-) diff --git a/.gitignore b/.gitignore index 0f3d4b2..7bda080 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ builds nssm.exe backend-0.1.2-217.zip backend-0.1.2-218.zip +backend-0.1.2.zip postgresql-17.2-3-windows-x64.exe diff --git a/frontend/src/hooks/useSession.ts b/frontend/src/hooks/useSession.ts index 1c810be..f564432 100644 --- a/frontend/src/hooks/useSession.ts +++ b/frontend/src/hooks/useSession.ts @@ -17,6 +17,16 @@ const fetchSession = async () => { }); // console.log(res); if (!res.ok) { + localStorage.removeItem("auth_token"); + // remove these for a while if no session just until fully to 2.0 and clearly no one has ran lstv1 in a long time + localStorage.removeItem("ally-supports-cache"); + localStorage.removeItem("auth-storage"); + localStorage.removeItem("nextauth.message"); + localStorage.removeItem("prod"); + localStorage.removeItem("cards"); + localStorage.removeItem("rememberMe"); + localStorage.removeItem("username"); + throw new Error("Session not found"); } diff --git a/package-lock.json b/package-lock.json index bc85b9b..49a5222 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,11 +23,11 @@ "drizzle-kit": "^0.30.4", "drizzle-orm": "^0.39.3", "drizzle-zod": "^0.7.0", + "fast-xml-parser": "^5.0.9", "jsonwebtoken": "^9.0.2", "mssql": "^11.0.1", "nodemailer": "^6.10.0", "nodemailer-express-handlebars": "^7.0.0", - "npm-check-updates": "^17.1.15", "pg": "^8.13.3", "pino": "^9.6.0", "pino-abstract-transport": "^2.0.0", @@ -5360,6 +5360,24 @@ ], "license": "BSD-3-Clause" }, + "node_modules/fast-xml-parser": { + "version": "5.0.9", + "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-5.0.9.tgz", + "integrity": "sha512-2mBwCiuW3ycKQQ6SOesSB8WeF+fIGb6I/GG5vU5/XEptwFFhp9PE8b9O7fbs2dpq9fXn4ULR3UsfydNUCntf5A==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/NaturalIntelligence" + } + ], + "license": "MIT", + "dependencies": { + "strnum": "^2.0.5" + }, + "bin": { + "fxparser": "src/cli/cli.js" + } + }, "node_modules/fdir": { "version": "6.4.3", "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.3.tgz", @@ -8784,20 +8802,6 @@ "node": ">=10" } }, - "node_modules/npm-check-updates": { - "version": "17.1.15", - "resolved": "https://registry.npmjs.org/npm-check-updates/-/npm-check-updates-17.1.15.tgz", - "integrity": "sha512-miATvKu5rjec/1wxc5TGDjpsucgtCHwRVZorZpDkS6NzdWXfnUWlN4abZddWb7XSijAuBNzzYglIdTm9SbgMVg==", - "license": "Apache-2.0", - "bin": { - "ncu": "build/cli.js", - "npm-check-updates": "build/cli.js" - }, - "engines": { - "node": "^18.18.0 || >=20.0.0", - "npm": ">=8.12.1" - } - }, "node_modules/npm-run-path": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", @@ -10645,6 +10649,18 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/strnum": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/strnum/-/strnum-2.0.5.tgz", + "integrity": "sha512-YAT3K/sgpCUxhxNMrrdhtod3jckkpYwH6JAuwmUdXZsmzH1wUyzTMrrK2wYCEEqlKwrWDd35NeuUkbBy/1iK+Q==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/NaturalIntelligence" + } + ], + "license": "MIT" + }, "node_modules/style-mod": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/style-mod/-/style-mod-4.1.2.tgz", diff --git a/package.json b/package.json index 1a4a72b..bc4d84b 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,7 @@ "drizzle-kit": "^0.30.4", "drizzle-orm": "^0.39.3", "drizzle-zod": "^0.7.0", + "fast-xml-parser": "^5.0.9", "jsonwebtoken": "^9.0.2", "mssql": "^11.0.1", "nodemailer": "^6.10.0", @@ -75,4 +76,4 @@ "build": 26, "oldBuild": "backend-0.1.2.zip" } -} \ No newline at end of file +}