mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-17 13:13:49 +01:00
Add warning on game close if user launched browser
This commit is contained in:
parent
bf1a2b56ba
commit
b402cc7f6e
@ -32,6 +32,8 @@ async function createWindow(killall) {
|
|||||||
// and open every other protocols on the browser
|
// and open every other protocols on the browser
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
shell.openExternal(url);
|
shell.openExternal(url);
|
||||||
|
|
||||||
|
global.app_playerOpenedExternalLink = true;
|
||||||
});
|
});
|
||||||
window.webContents.backgroundThrottling = false;
|
window.webContents.backgroundThrottling = false;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* eslint-disable no-process-exit */
|
/* eslint-disable no-process-exit */
|
||||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||||
const { app } = require("electron");
|
const { app, dialog } = require("electron");
|
||||||
const log = require("electron-log");
|
const log = require("electron-log");
|
||||||
const greenworks = require("./greenworks");
|
const greenworks = require("./greenworks");
|
||||||
const api = require("./api-server");
|
const api = require("./api-server");
|
||||||
@ -32,6 +32,18 @@ function setStopProcessHandler(app, window, enabled) {
|
|||||||
// Shutdown the http server
|
// Shutdown the http server
|
||||||
api.disable();
|
api.disable();
|
||||||
|
|
||||||
|
// Because of a steam limitation, if the player has launched an external browser,
|
||||||
|
// steam will keep displaying the game as "Running" in their UI as long as the browser is up.
|
||||||
|
// So we'll alert the player to close their browser.
|
||||||
|
if (global.app_playerOpenedExternalLink) {
|
||||||
|
await dialog.showMessageBox({
|
||||||
|
title: 'Bitburner',
|
||||||
|
message: 'You may have to close your browser to properly exit the game.',
|
||||||
|
detail: 'Steam will keep tracking Bitburner as "Running" if any process started within the game is still running.' +
|
||||||
|
' This includes launching an external link, which opens up your browser.',
|
||||||
|
type: 'warning', buttons: ['OK']
|
||||||
|
});
|
||||||
|
}
|
||||||
// We'll try to execute javascript on the page to see if we're stuck
|
// We'll try to execute javascript on the page to see if we're stuck
|
||||||
let canRunJS = false;
|
let canRunJS = false;
|
||||||
window.webContents.executeJavaScript('window.stop(); document.close()', true)
|
window.webContents.executeJavaScript('window.stop(); document.close()', true)
|
||||||
|
Loading…
Reference in New Issue
Block a user