From d9453d7dec3c0b48b999661c34eb8e2f85bd878f Mon Sep 17 00:00:00 2001 From: "Yasmin Seidel (JasminDreasond)" Date: Mon, 14 Aug 2023 01:20:17 -0300 Subject: [PATCH] url value fix --- electron/main/index.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/electron/main/index.ts b/electron/main/index.ts index 24f31631a..a3569af4c 100644 --- a/electron/main/index.ts +++ b/electron/main/index.ts @@ -38,7 +38,7 @@ if (!app.requestSingleInstanceLock()) { let win: BrowserWindow | null = null; // Here, you can also use other preload const preload = join(__dirname, '../preload/index.js'); -const url = process.env.VITE_DEV_SERVER_URL; +const tinyUrl = process.env.VITE_DEV_SERVER_URL; const indexHtml = join(process.env.DIST, 'index.html'); async function createWindow() { @@ -55,9 +55,9 @@ async function createWindow() { }, }); - if (url) { + if (tinyUrl) { // electron-vite-vue#298 - win.loadURL(url); + win.loadURL(tinyUrl); // Open devTool if the app is not packaged win.webContents.openDevTools(); } else { @@ -70,8 +70,8 @@ async function createWindow() { }); // Make all links open with the browser, not with the application - win.webContents.setWindowOpenHandler(({ webUrl }) => { - if (webUrl.startsWith('https:')) shell.openExternal(webUrl); + win.webContents.setWindowOpenHandler(({ url }) => { + if (url.startsWith('https:')) shell.openExternal(url); return { action: 'deny' }; }); @@ -114,7 +114,7 @@ ipcMain.handle('open-win', (_, arg) => { }); if (process.env.VITE_DEV_SERVER_URL) { - childWindow.loadURL(`${url}#${arg}`); + childWindow.loadURL(`${tinyUrl}#${arg}`); } else { childWindow.loadFile(indexHtml, { hash: arg }); }