From aa335b086a74536403642baebce7c060360fe1b0 Mon Sep 17 00:00:00 2001 From: SauceyRed Date: Sat, 5 Jul 2025 02:38:23 +0200 Subject: [PATCH 1/2] feat: use logout endpoint for logout and move old logic to revoke in auth --- composables/auth.ts | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/composables/auth.ts b/composables/auth.ts index 0ac2e8b..b23a67b 100644 --- a/composables/auth.ts +++ b/composables/auth.ts @@ -37,13 +37,19 @@ export const useAuth = () => { //await fetchUser(); } - async function logout(password: string) { - console.log("password:", password); + async function logout() { console.log("access:", accessToken.value); - const hashedPass = await hashPassword(password); - console.log("hashed"); - const res = await fetchWithApi("/auth/revoke", { + await fetchWithApi("/auth/logout", { method: "GET", credentials: "include" }); + clearAuth(); + + return await navigateTo("/login"); + } + + async function revoke(password: string) { + const hashedPass = await hashPassword(password); + + await fetchWithApi("/auth/revoke", { method: "POST", body: { @@ -54,10 +60,6 @@ export const useAuth = () => { clearAuth(); } - async function revoke() { - clearAuth(); - } - async function refresh() { console.log("refreshing"); const res = await fetchWithApi("/auth/refresh", { From c1021b11922a423bb233fef5e18ed38a8e5d100f Mon Sep 17 00:00:00 2001 From: JustTemmie <47639983+JustTemmie@users.noreply.github.com> Date: Sat, 5 Jul 2025 15:24:09 +0200 Subject: [PATCH 2/2] fix: fix build time and version hash being evaluated at runtime --- app.config.ts | 5 ----- nuxt.config.ts | 4 +++- pages/settings.vue | 6 +++--- 3 files changed, 6 insertions(+), 9 deletions(-) delete mode 100644 app.config.ts diff --git a/app.config.ts b/app.config.ts deleted file mode 100644 index 11f7f7c..0000000 --- a/app.config.ts +++ /dev/null @@ -1,5 +0,0 @@ -export default defineAppConfig({ - title: "Gorb", - buildTimeString: new Date().toISOString(), - gitHash: process.env.GIT_SHORT_REV || "N/A" -}) diff --git a/nuxt.config.ts b/nuxt.config.ts index 63d9372..05a40fa 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -27,7 +27,9 @@ export default defineNuxtConfig({ runtimeConfig: { public: { apiVersion: 1, - messageGroupingMaxDifference: 300000 + messageGroupingMaxDifference: 300000, + buildTimeString: new Date().toISOString(), + gitHash: process.env.GIT_SHORT_REV || "N/A", } }, /* nitro: { diff --git a/pages/settings.vue b/pages/settings.vue index cc694a9..bd1a484 100644 --- a/pages/settings.vue +++ b/pages/settings.vue @@ -24,9 +24,9 @@

- Version Hash: {{ appConfig.gitHash }} + Version Hash: {{ appConfig.public.gitHash }}
- Build Time: {{ appConfig.buildTimeString }} + Build Time: {{ appConfig.public.buildTimeString }}

@@ -44,7 +44,7 @@ import Button from '~/components/Button.vue'; const { logout } = useAuth() -const appConfig = useAppConfig() +const appConfig = useRuntimeConfig() interface Page { displayName: string;