aboutsummaryrefslogtreecommitdiff
path: root/main.js
diff options
context:
space:
mode:
authorStarscouts <starscouts@equestria.dev>2024-07-14 14:28:01 +0200
committerStarscouts <starscouts@equestria.dev>2024-07-14 14:28:01 +0200
commit361fe53a7e8a48e42ac8d7f4c07f33bf4ed178e2 (patch)
treef559784cd9a076c27fa6cd904641176efec89a6a /main.js
parent1bbe60d3a237cfe99dc6d1a3aa14de542668dc6f (diff)
downloadfaunerie-mane.tar.gz
faunerie-mane.tar.bz2
faunerie-mane.zip
Fixes for WindowsHEADmane
Diffstat (limited to 'main.js')
-rw-r--r--[-rwxr-xr-x]main.js18
1 files changed, 12 insertions, 6 deletions
diff --git a/main.js b/main.js
index 329ebd8..9220a09 100755..100644
--- a/main.js
+++ b/main.js
@@ -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();