Skip to content

Commit

Permalink
Merge pull request #5 from Lukewh/upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukewh authored May 23, 2022
2 parents 3335036 + ba38c0a commit bde59c9
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 64 deletions.
43 changes: 0 additions & 43 deletions index.html

This file was deleted.

44 changes: 25 additions & 19 deletions main.js
Original file line number Diff line number Diff line change
@@ -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;
});
Expand All @@ -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());
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}

0 comments on commit bde59c9

Please sign in to comment.