diff options
author | Starscouts <starscouts@equestria.dev> | 2024-07-14 14:28:01 +0200 |
---|---|---|
committer | Starscouts <starscouts@equestria.dev> | 2024-07-14 14:28:01 +0200 |
commit | 361fe53a7e8a48e42ac8d7f4c07f33bf4ed178e2 (patch) | |
tree | f559784cd9a076c27fa6cd904641176efec89a6a /main.js | |
parent | 1bbe60d3a237cfe99dc6d1a3aa14de542668dc6f (diff) | |
download | faunerie-361fe53a7e8a48e42ac8d7f4c07f33bf4ed178e2.tar.gz faunerie-361fe53a7e8a48e42ac8d7f4c07f33bf4ed178e2.tar.bz2 faunerie-361fe53a7e8a48e42ac8d7f4c07f33bf4ed178e2.zip |
Diffstat (limited to 'main.js')
-rw-r--r--[-rwxr-xr-x] | main.js | 18 |
1 files changed, 12 insertions, 6 deletions
@@ -25,7 +25,7 @@ function open() { }, titleBarStyle: "hidden", titleBarOverlay: { - color: "transparent", + color: "#00000000", symbolColor: "#ffffff", height: 43 }, @@ -39,9 +39,10 @@ function open() { remote.enable(win.webContents); win.on('close', async (e) => { - if (await win.webContents.executeJavaScript("instance?.dataStore.unloaded;")) e.preventDefault(); - await win.webContents.executeJavaScript("instance?.safeClose();"); - }) + e.preventDefault(); + if (await win.webContents.executeJavaScript("instance?.dataStore.unloaded;")) win.destroy(); + await win.webContents.executeJavaScript("instance?.safeUnload().then(() => { require('electron').ipcRenderer.send('destroy'); });"); + }); win.loadFile("./dom/index.html"); win.on('ready-to-show', () => { @@ -68,6 +69,10 @@ function open() { properties: ["openFile", "treatPackageAsDirectory", "dontAddToRecent"] }); }); + + ipcMain.on('destroy', () => { + win.destroy(); + }); } if (app.getName() !== "Electron") { @@ -80,9 +85,11 @@ if (app.getName() !== "Electron") { app.whenReady().then(() => { protocol.handle('pbip', async (req) => { - const { pathname, searchParams } = new URL(req.url); + let { pathname, searchParams } = new URL(req.url); let mime = searchParams.get("mime") ?? "application/octet-stream"; + if (process.platform === "win32") pathname = pathname.substring(1); + const inflateRawSync = util.promisify(zlib.inflateRaw); try { @@ -101,7 +108,6 @@ app.whenReady().then(() => { headers: { 'content-type': 'text/plain' } }); } - }); open(); |