cinny-desktop/main.js
2022-05-12 23:13:00 -04:00

44 lines
911 B
JavaScript

const { app, BrowserWindow, shell } = require("electron");
let win;
(async function() {
if (process.platform == "linux") {
await app.inital
}
await app.whenReady();
win = new BrowserWindow({
width: 800,
height: 600
});
win.setMenu(null);
win.loadURL(`https://app.cinny.in/`);
win.webContents.addListener("will-navigate", function(event, url) {
let u = new URL(url);
if (u.protocol == "blob:") return;
if (u.hostname !== "app.cinny.in") {
event.preventDefault();
shell.openExternal(url);
}
});
win.webContents.addListener("new-window", function(event, url) {
let u = new URL(url);
if (u.protocol == "blob:") return;
if (u.hostname !== "app.cinny.in" ) {
event.preventDefault();
shell.openExternal(url);
}
});
})();
app.on("window-all-closed", () => {
if (process.platform !== "darwin") {
app.quit();
}
});