From 94f95865921a57f4ce4518fb5237bcd10dc67baa Mon Sep 17 00:00:00 2001 From: Jesse Wierzbinski Date: Mon, 15 Apr 2024 20:09:38 -1000 Subject: [PATCH] fix(frontend): :art: Make the glitch-soc session cookie last a week instead of for the session --- server/api/api/auth/mastodon-login/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/api/api/auth/mastodon-login/index.ts b/server/api/api/auth/mastodon-login/index.ts index 5fede64a..890af817 100644 --- a/server/api/api/auth/mastodon-login/index.ts +++ b/server/api/api/auth/mastodon-login/index.ts @@ -63,13 +63,16 @@ export default apiRoute( userId: user.id, }); + // One week from now + const maxAge = String(60 * 60 * 24 * 7); + // Redirect to home return new Response(null, { headers: { Location: "/", "Set-Cookie": `_session_id=${accessToken}; Domain=${ new URL(config.http.base_url).hostname - }; SameSite=Lax; Path=/; HttpOnly`, + }; SameSite=Lax; Path=/; HttpOnly; Max-Age=${maxAge}`, }, status: 303, });