From 46257205881b1cd30129049a0330d40f5546a09e Mon Sep 17 00:00:00 2001 From: ae Date: Fri, 9 May 2025 15:12:47 +0300 Subject: [PATCH] fix: dropped unnecessary .env vars (frontend) --- .env.template | 6 ++---- web/src/lib/logic/client.ts | 4 +--- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/.env.template b/.env.template index f9b112b..2d17a04 100644 --- a/.env.template +++ b/.env.template @@ -13,11 +13,9 @@ ADMIN_PASSWORD="" ACCOUNT_CREATION_ENABLED="0" LOG_LEVEL="info" APP_ENV="production" -DOMAIN="" -FRONTEND_URL="" +DOMAIN="localhost" +FRONTEND_URL="http://localhost:3000" # Frontend (build-stage) VITE_ACCOUNT_CREATION_ENABLED="$ACCOUNT_CREATION_ENABLED" -VITE_VIEW_COOKIE_PATH="/" -VITE_COOKIE_SAME_SITE="strict" VITE_VIEW_COOKIE_DOMAIN="$DOMAIN" \ No newline at end of file diff --git a/web/src/lib/logic/client.ts b/web/src/lib/logic/client.ts index 2348b2c..3e878dd 100644 --- a/web/src/lib/logic/client.ts +++ b/web/src/lib/logic/client.ts @@ -23,9 +23,7 @@ const CSRF_EXP_MS = 12 * 60 * 60 * 1000 // 12 h. const REFRESH_BUF = 30 * 1000 // 30 s. // view cookie configuration (holds UNIX timestamp value of the actual refresh token cookie's expiration date) -const VIEW_COOKIE_PATH = import.meta.env.VITE_VIEW_COOKIE_PATH || "/" const VIEW_COOKIE_DOMAIN = import.meta.env.VITE_VIEW_COOKIE_DOMAIN || "localhost" -const COOKIE_SAME_SITE = import.meta.env.VITE_COOKIE_SAME_SITE || "strict" const COOKIE_SECURE = import.meta.env.PROD ? true : false // some of these could just be local variables as not all of them are being used globally @@ -250,7 +248,7 @@ class ApiClient { } // overwrite the view cookie with details that match with the real cookie - document.cookie = `${this.viewCookieName}=;path=${VIEW_COOKIE_PATH};domain=${VIEW_COOKIE_DOMAIN};expires=Thu, 01 Jan 1970 00:00:00 GMT;${COOKIE_SECURE ? "secure;" : ""}sameSite=${COOKIE_SAME_SITE}` + document.cookie = `${this.viewCookieName}=;path=/;domain=${VIEW_COOKIE_DOMAIN};expires=Thu, 01 Jan 1970 00:00:00 GMT;${COOKIE_SECURE ? "secure;" : ""}sameSite=strict` } private getCookieValue(cookieName: string): string | null {