fix: api url in main

Signed-off-by: Innei <i@innei.in>
This commit is contained in:
Innei
2024-07-02 17:00:35 +08:00
parent 36ee8d5950
commit c53af705cb
+4 -3
View File
@@ -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()