From dcfd3df713976d2869083e90aca2a77f753bb5bf Mon Sep 17 00:00:00 2001 From: grngxd <36968271+grngxd@users.noreply.github.com> Date: Wed, 30 Jul 2025 11:18:02 +0100 Subject: [PATCH 1/2] companion commit to state branch on backend --- src/components/landing/CallToAction.tsx | 3 +-- src/components/landing/Hero.tsx | 3 +-- src/lib/constants.ts | 2 +- src/routes/dashboard/index.tsx | 3 +-- src/routes/index.tsx | 2 +- 5 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/components/landing/CallToAction.tsx b/src/components/landing/CallToAction.tsx index 1b4fc31..cbdb4f1 100644 --- a/src/components/landing/CallToAction.tsx +++ b/src/components/landing/CallToAction.tsx @@ -1,5 +1,4 @@ import { component$ } from "@builder.io/qwik"; -import { OAUTH_LINK } from "~/lib/constants"; export default component$(() => (
( join over 100k other people hosting their files with stereo!

get started diff --git a/src/components/landing/Hero.tsx b/src/components/landing/Hero.tsx index 298c35b..c7b30b5 100644 --- a/src/components/landing/Hero.tsx +++ b/src/components/landing/Hero.tsx @@ -1,6 +1,5 @@ import { component$, useSignal } from "@builder.io/qwik"; import { useRelativeMouse } from "~/hooks/mouse"; -import { OAUTH_LINK } from "~/lib/constants"; import GradientBorder from "../misc/GradientBorder"; export default component$(() => { @@ -22,7 +21,7 @@ export default component$(() => {

get started diff --git a/src/lib/constants.ts b/src/lib/constants.ts index 60a2ab9..c55705b 100644 --- a/src/lib/constants.ts +++ b/src/lib/constants.ts @@ -1 +1 @@ -export const OAUTH_LINK = "https://discord.com/oauth2/authorize?client_id=1368939221678817382&response_type=code&redirect_uri=http%3A%2F%2Flocalhost%3A8081%2Fapi%2Fauth%2Fcallback&scope=identify+email" \ No newline at end of file +//export const OAUTH_LINK = "https://discord.com/oauth2/authorize?client_id=1368939221678817382&response_type=code&redirect_uri=http%3A%2F%2Flocalhost%3A8081%2Fapi%2Fauth%2Fcallback&scope=identify+email" \ No newline at end of file diff --git a/src/routes/dashboard/index.tsx b/src/routes/dashboard/index.tsx index 16911f1..ac4466c 100644 --- a/src/routes/dashboard/index.tsx +++ b/src/routes/dashboard/index.tsx @@ -6,14 +6,13 @@ import Titlebar from "~/components/dashboard/Titlebar"; // import Dropzone from "~/components/Dropzone"; import { useNanostore$ } from "~/hooks/nanostores"; import { api } from "~/lib/api"; -import { OAUTH_LINK } from "~/lib/constants"; import { areFilesLoaded, dashboardFiles } from "~/lib/stores"; import { StereoFile } from "~/lib/types"; export const useAuthCheck = routeLoader$(({ cookie, redirect: r }) => { const jwt = cookie.get("jwt"); if (jwt) return {}; - throw r(302, OAUTH_LINK); + throw r(302, "/api/auth/login"); }); export default component$(() => { diff --git a/src/routes/index.tsx b/src/routes/index.tsx index b1dc77d..4fca559 100644 --- a/src/routes/index.tsx +++ b/src/routes/index.tsx @@ -13,7 +13,7 @@ export const useAuthCheck = routeLoader$(({ cookie, redirect: r, query }) => { const set = Boolean(query.get("jwt_set")); if (jwt && set) { - throw r(302, "/dashboard"); + throw r(302, "/api/auth/login"); } return {}; }); From 60cc3e958cee1ecb12ea93135c66f0c66cb07c43 Mon Sep 17 00:00:00 2001 From: grngxd <36968271+grngxd@users.noreply.github.com> Date: Thu, 31 Jul 2025 10:57:45 +0100 Subject: [PATCH 2/2] logging out --- src/components/dashboard/Settings.tsx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/components/dashboard/Settings.tsx b/src/components/dashboard/Settings.tsx index 104d316..818322a 100644 --- a/src/components/dashboard/Settings.tsx +++ b/src/components/dashboard/Settings.tsx @@ -3,7 +3,8 @@ // import { isSettingsOpen, userInfo } from "~/lib/stores"; // import { StereoUser } from "~/lib/types"; -import { component$, useComputed$, useSignal, useTask$ } from "@builder.io/qwik"; +import { $, component$, useComputed$, useSignal, useTask$ } from "@builder.io/qwik"; +import ky from "ky"; import { useNanostore$ } from "~/hooks/nanostores"; import { isSettingsOpen } from "~/lib/stores"; @@ -34,9 +35,22 @@ const PrivacyAndSecurity = component$(() => { }); const DangerZone = component$(() => { + const handleLogout = $(() => { + ky.get("/api/auth/logout", { credentials: "include" }) + .then(() => { + window.location.href = "/"; + }); + }); + return (

delete your account and data here

+
); });