From af5b7a12d6a19059eda31cb46e5c6436aaf786d0 Mon Sep 17 00:00:00 2001 From: Daniel Vainio Date: Thu, 27 Nov 2025 12:03:45 +0200 Subject: [PATCH 1/2] Implement buildLogoutUrl Implement helper function to build the logout URL. Add a ?next parameter to the logout URL which returns the user to the Nimbus index page. This should override the Django logout function to redirect to Nimbus instead of legacy page index page upon logout. Refs. TS-2779 --- .../cyberstorm/utils/ThunderstoreAuth.tsx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/apps/cyberstorm-remix/cyberstorm/utils/ThunderstoreAuth.tsx b/apps/cyberstorm-remix/cyberstorm/utils/ThunderstoreAuth.tsx index 3e47bdfe1..0343352ca 100644 --- a/apps/cyberstorm-remix/cyberstorm/utils/ThunderstoreAuth.tsx +++ b/apps/cyberstorm-remix/cyberstorm/utils/ThunderstoreAuth.tsx @@ -1,14 +1,23 @@ -interface Props { +import { getPublicEnvVariables } from "cyberstorm/security/publicEnvVariables"; + +interface LoginProps { type: "discord" | "github" | "overwolf"; authBaseDomain: string; authReturnDomain: string; nextUrl?: string; } -export function buildAuthLoginUrl(props: Props) { +export function buildAuthLoginUrl(props: LoginProps) { return `${props.authBaseDomain}/auth/login/${props.type}/${ props.nextUrl ? `?next=${encodeURIComponent(props.nextUrl)}` : `?next=${encodeURIComponent(`${props.authReturnDomain}/communities/`)}` }`; } + +export function buildLogoutUrl(domain?: string) { + const publicEnvVariables = getPublicEnvVariables(["VITE_AUTH_RETURN_URL"]); + const returnURL = publicEnvVariables.VITE_AUTH_RETURN_URL || ""; + const logoutURL = domain ? `${domain}/logout/` : "/logout"; + return `${logoutURL}?next=${encodeURIComponent(returnURL)}`; +} From 86a84a92b23522a7c4d723251d57702bd76a33dc Mon Sep 17 00:00:00 2001 From: Daniel Vainio Date: Thu, 27 Nov 2025 12:05:53 +0200 Subject: [PATCH 2/2] Use buildLogoutUrl in Navigation component Replace the static URL with buildLogoutUrl in the navigation links. TS-2779 --- .../app/commonComponents/Navigation/Navigation.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/cyberstorm-remix/app/commonComponents/Navigation/Navigation.tsx b/apps/cyberstorm-remix/app/commonComponents/Navigation/Navigation.tsx index 4d274cf0e..a2f82ee0f 100644 --- a/apps/cyberstorm-remix/app/commonComponents/Navigation/Navigation.tsx +++ b/apps/cyberstorm-remix/app/commonComponents/Navigation/Navigation.tsx @@ -35,7 +35,10 @@ import { import { faDiscord, faGithub } from "@fortawesome/free-brands-svg-icons"; import { classnames } from "@thunderstore/cyberstorm/src/utils/utils"; -import { buildAuthLoginUrl } from "cyberstorm/utils/ThunderstoreAuth"; +import { + buildAuthLoginUrl, + buildLogoutUrl, +} from "cyberstorm/utils/ThunderstoreAuth"; import { faArrowUpRight } from "@fortawesome/pro-solid-svg-icons"; import { getPublicEnvVariables } from "cyberstorm/security/publicEnvVariables"; @@ -404,7 +407,7 @@ export function DesktopUserDropdown(props: { @@ -566,7 +569,7 @@ export function MobileUserPopoverContent(props: {