try to fix the game hanging

This commit is contained in:
Olivier Gagnon 2022-01-09 14:02:11 -05:00
parent 74504a68f8
commit ab15481cd6
4 changed files with 35 additions and 30 deletions

36
dist/vendor.bundle.js vendored

File diff suppressed because one or more lines are too long

@ -5,11 +5,12 @@ const utils = require("./utils");
const achievements = require("./achievements");
const menu = require("./menu");
const api = require("./api-server");
const cp = require("child_process");
const debug = process.argv.includes("--debug");
async function createWindow(killall) {
const setStopProcessHandler = global.app_handlers.stopProcess
const setStopProcessHandler = global.app_handlers.stopProcess;
const window = new BrowserWindow({
show: false,
backgroundThrottling: false,
@ -24,14 +25,18 @@ async function createWindow(killall) {
if (debug) window.webContents.openDevTools();
window.webContents.on("new-window", function (e, url) {
if (process.platform === "win32") {
cp.spawn("explorer", [url], { detached: true, stdio: "ignore" });
} else {
// make sure local urls stay in electron perimeter
if (url.substr(0, "file://".length) === "file://") {
return;
}
// and open every other protocols on the browser
e.preventDefault();
utils.openExternal(url);
}
e.preventDefault();
});
window.webContents.backgroundThrottling = false;
@ -43,7 +48,7 @@ async function createWindow(killall) {
await api.initialize(window);
} catch (error) {
log.error(error);
utils.showErrorBox('Error starting http server', error);
utils.showErrorBox("Error starting http server", error);
}
menu.refreshMenu(window);
@ -54,4 +59,4 @@ async function createWindow(killall) {
module.exports = {
createWindow,
}
};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long