import { app, BrowserWindow, session } from "electron"; import { get_setting } from "./src/setting"; import { create_server, start_server } from "./src/server"; import { getAdminAccessTokenValue,getAdminRefreshTokenValue, accessTokenName, refreshTokenName } from "./src/login"; const setting = get_setting(); if (!setting.cli) { let wnd: BrowserWindow | null = null; const createWindow = async () => { wnd = new BrowserWindow({ width: 800, height: 600, center: true, useContentSize: true, }); //await window.loadURL(`data:text/html;base64,`+Buffer.from(get_loading_html()).toString('base64')); await wnd.loadFile('../loading.html'); await session.defaultSession.cookies.set({ url:`http://localhost:${setting.port}`, name:accessTokenName, value:getAdminAccessTokenValue(), httpOnly: true, secure: false, sameSite:"strict" }); await session.defaultSession.cookies.set({ url:`http://localhost:${setting.port}`, name:refreshTokenName, value:getAdminRefreshTokenValue(), httpOnly: true, secure: false, sameSite:"strict" }); try{ const server = await create_server(); start_server(server); await wnd.loadURL(`http://localhost:${setting.port}`); } catch(e){ if(e instanceof Error){ await wnd.webContents.executeJavaScript(`document.querySelector("body").innerHTML="