Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
"classnames": "2.2.5",
"codemirror": "~5.49.2",
"csv-stringify": "2.0.1",
"electron-is-dev": "1.1.0",
"electron-log": "3.0.9",
"electron-updater": "4.2.0",
"electron-is-dev": "2.0.0",
"electron-log": "4.3.0",
"electron-updater": "4.3.8",
"fs-extra": "5.0.0",
"immup": "3.0.0",
"js-yaml": "3.10.0",
Expand Down Expand Up @@ -67,13 +67,12 @@
"@types/react-select": "~3.0.13",
"@types/react-splitter-layout": "3.0.0",
"@types/sqlite3": "3.1.6",
"@types/webdriverio": "4.13.3",
"@typescript-eslint/eslint-plugin": "3.4.0",
"@typescript-eslint/parser": "3.4.0",
"clean-webpack-plugin": "0.1.19",
"copy-webpack-plugin": "4.5.1",
"css-loader": "0.28.8",
"electron": "7.1.12",
"electron": "11.4.2",
"electron-builder": "22.10.5",
"electron-mocha": "~8.2.1",
"electron-notarize": "0.3.0",
Expand All @@ -86,7 +85,7 @@
"file-loader": "~4.3.0",
"mini-css-extract-plugin": "~0.8.0",
"prettier": "~1.19.1",
"spectron": "9.0.0",
"spectron": "13.0.0",
"ts-loader": "~7.0.5",
"ts-node": "5.0.1",
"typescript": "^3.9.5",
Expand Down
20 changes: 4 additions & 16 deletions src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,14 @@ app.on("window-all-closed", () => {
}
});

app.on("ready", async () => {
// https://github.com/electron/electron/issues/13008#issuecomment-569363295
electron.session.defaultSession.webRequest.onBeforeRequest((details, callback) => {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to be unnecessarily.

const redirectURL = details.url.replace(
/^devtools:\/\/devtools\/remote\/serve_file\/@[0-9a-f]{40}\//,
"https://chrome-devtools-frontend.appspot.com/serve_file/@675968a8c657a3bd9c1c2c20c5d2935577bbc5e6/"
);
if (redirectURL !== details.url) {
callback({ redirectURL });
} else {
callback({});
}
});
createWindow();
app.whenReady().then(async () => {
await createWindow();
initMenu();
await updater.watch();
});

app.on("activate", () => {
app.on("activate", async () => {
if (windows.length === 0) {
createWindow();
await createWindow();
}
});
9 changes: 5 additions & 4 deletions src/main/window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ export async function createWindow(): Promise<void> {
titleBarStyle: process.platform === "darwin" ? "hidden" : undefined,
icon: path.join(__dirname, "..", "icon.png"),
webPreferences: {
nodeIntegration: true
nodeIntegration: true,
enableRemoteModule: true
}
});

win.loadURL(`file://${__dirname}/../index.html`);
await win.loadURL(`file://${__dirname}/../index.html`);
win.once("closed", () => {
const idx = windows.findIndex(w => w === win);
windows.splice(idx, 1);
Expand All @@ -27,9 +28,9 @@ export async function createWindow(): Promise<void> {
dialog.showErrorBox("Bdash is crashed", "Unrecoverable error");
});

win.webContents.on("will-navigate", (e, url) => {
win.webContents.on("will-navigate", async (e, url) => {
e.preventDefault();
shell.openExternal(url);
await shell.openExternal(url);
});

windows.push(win);
Expand Down
Loading