diff --git a/index.html b/index.html deleted file mode 100644 index 29b958f..0000000 --- a/index.html +++ /dev/null @@ -1,43 +0,0 @@ - - - Miro - - - - - - diff --git a/main.js b/main.js index 3e0bb51..7cc01bc 100644 --- a/main.js +++ b/main.js @@ -1,30 +1,39 @@ -const { app, BrowserWindow, session } = require("electron"); +const { app, BrowserWindow, shell } = require("electron"); let mainWindow; -const loadPlaceholder = () => { - mainWindow.loadURL(`file://${__dirname}/index.html`).then(() => { - mainWindow.webContents.session.setPermissionRequestHandler((webContents, permission, callback, details) => { - console.log(webContents, permission, callback, details); - }); - }).catch((e) => { console.error(e); }); -}; - const createWindow = () => { mainWindow = new BrowserWindow({ height: 768, width: 1024, icon: `${__dirname}/miro.png`, - webPreferences: { - webviewTag: true, - nodeIntegration: true - } + logo: `${__dirname}/miro.png`, + show: false, + backgroundColor: "rgb(255, 208, 47)", }); mainWindow.removeMenu(); - loadPlaceholder(); - + mainWindow.loadURL("https://miro.com/app", { + httpReferrer: { + url: "https://miro.com/", + policy: "same-origin", + }, + userAgent: + "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.67 Safari/537.36", + }); + //loadPlaceholder(); + + // mainWindow.webContents.openDevTools(); + + mainWindow.once("ready-to-show", () => { + mainWindow.show(); + mainWindow.webContents.setWindowOpenHandler(({ url }) => { + shell.openExternal(url); + return { action: "deny" }; + }); + }); + mainWindow.on("closed", () => { mainWindow = null; }); @@ -34,7 +43,4 @@ app.on("ready", createWindow); app.on("activate", () => mainWindow === null && createWindow()); -app.on( - "window-all-closed", - () => process.platform !== "darwin" && app.quit() -); +app.on("window-all-closed", () => process.platform !== "darwin" && app.quit()); diff --git a/package.json b/package.json index 8581a55..b026403 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "dist": "electron-builder --linux snap" }, "devDependencies": { - "electron": "8.2.3", - "electron-builder": "22.5.1" + "electron": "18.2.4", + "electron-builder": "23.0.3" } }