mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-25 17:13:47 +01:00
Remove some unused electron code
Verified that steam exits the game even when a link has been opened, no need for utils.openExternal or tracking app_playerOpenedExternalLink. Also removed some unneeded eslint override comments
This commit is contained in:
parent
b9b5a62105
commit
93939431e9
@ -72,23 +72,6 @@ function setStopProcessHandler(app, window) {
|
|||||||
log.error(error);
|
log.error(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This may no longer be needed due to the return of action: deny in gameWindow.js setWindowOpenHandler.
|
|
||||||
// Nothing currently sets the app_playerOpenedExternalLink flag. See utils.js openExternal comment for more info.
|
|
||||||
// -------
|
|
||||||
// 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).then(() => (canRunJS = true));
|
window.webContents.executeJavaScript("window.stop(); document.close()", true).then(() => (canRunJS = true));
|
||||||
|
@ -58,12 +58,10 @@ async function prepareFolders(...folders) {
|
|||||||
for (const folder of folders) {
|
for (const folder of folders) {
|
||||||
try {
|
try {
|
||||||
// Making sure the folder exists
|
// Making sure the folder exists
|
||||||
// eslint-disable-next-line no-await-in-loop
|
|
||||||
await fs.stat(folder);
|
await fs.stat(folder);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error.code === "ENOENT") {
|
if (error.code === "ENOENT") {
|
||||||
log.warn(`'${folder}' not found, creating it...`);
|
log.warn(`'${folder}' not found, creating it...`);
|
||||||
// eslint-disable-next-line no-await-in-loop
|
|
||||||
await fs.mkdir(folder);
|
await fs.mkdir(folder);
|
||||||
} else {
|
} else {
|
||||||
log.error(error);
|
log.error(error);
|
||||||
@ -250,13 +248,11 @@ async function saveGameToDisk(window, saveData) {
|
|||||||
const fileToRemove = oldestFiles.shift();
|
const fileToRemove = oldestFiles.shift();
|
||||||
log.debug(`Over Quota -> Removing "${fileToRemove}"`);
|
log.debug(`Over Quota -> Removing "${fileToRemove}"`);
|
||||||
try {
|
try {
|
||||||
// eslint-disable-next-line no-await-in-loop
|
|
||||||
await fs.unlink(fileToRemove);
|
await fs.unlink(fileToRemove);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
log.error(error);
|
log.error(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line no-await-in-loop
|
|
||||||
saveFolderSizeBytes = await getFolderSizeInBytes(currentFolder);
|
saveFolderSizeBytes = await getFolderSizeInBytes(currentFolder);
|
||||||
log.debug(`Save Folder: ${saveFolderSizeBytes} bytes`);
|
log.debug(`Save Folder: ${saveFolderSizeBytes} bytes`);
|
||||||
log.debug(
|
log.debug(
|
||||||
|
@ -87,14 +87,6 @@ async function writeToast(window, message, type = "info", duration = 2000) {
|
|||||||
await window.webContents.executeJavaScript(`window.appNotifier.toast("${message}", "${type}", ${duration});`, true);
|
await window.webContents.executeJavaScript(`window.appNotifier.toast("${message}", "${type}", ${duration});`, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This may no longer be needed due to the return of { action: "deny" } in gameWindow.js setWindowOpenHandler.
|
|
||||||
// Currently this is unused so that this can be tested. If the issue no longer exists, this util will be removed.
|
|
||||||
// Otherwise, its use will be reimplemented.
|
|
||||||
function openExternal(url) {
|
|
||||||
shell.openExternal(url);
|
|
||||||
global.app_playerOpenedExternalLink = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getZoomFactor() {
|
function getZoomFactor() {
|
||||||
const configZoom = config.get("zoom", 1);
|
const configZoom = config.get("zoom", 1);
|
||||||
return configZoom;
|
return configZoom;
|
||||||
@ -115,7 +107,6 @@ module.exports = {
|
|||||||
exportSave,
|
exportSave,
|
||||||
attachUnresponsiveAppHandler,
|
attachUnresponsiveAppHandler,
|
||||||
detachUnresponsiveAppHandler,
|
detachUnresponsiveAppHandler,
|
||||||
openExternal,
|
|
||||||
writeTerminal,
|
writeTerminal,
|
||||||
writeToast,
|
writeToast,
|
||||||
getZoomFactor,
|
getZoomFactor,
|
||||||
|
Loading…
Reference in New Issue
Block a user