From c53af705cb4ac11ac4eb3e14ded60040e33ae88a Mon Sep 17 00:00:00 2001 From: Innei Date: Tue, 2 Jul 2024 17:00:35 +0800 Subject: [PATCH] fix: api url in main Signed-off-by: Innei --- src/main/index.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/index.ts b/src/main/index.ts index 409cedd67..1d1ada00f 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -58,14 +58,15 @@ app.whenReady().then(() => { const urlObj = new URL(url) if (urlObj.hostname === "auth") { const token = urlObj.searchParams.get("token") - if (token && process.env["VITE_API_URL"]) { + const apiURL = process.env["VITE_API_URL"] || import.meta.env.VITE_API_URL + if (token && apiURL) { mainWindow.webContents.session.cookies.set({ - url: process.env["VITE_API_URL"], + url: apiURL, name: "authjs.session-token", value: token, secure: true, httpOnly: true, - domain: new URL(process.env["VITE_API_URL"]).hostname, + domain: new URL(apiURL).hostname, sameSite: "no_restriction", }) mainWindow.reload()