Add API server information menu item

This commit is contained in:
Martin Fournier 2022-01-03 10:29:56 -05:00
parent d0214c1fed
commit bdef14b029
3 changed files with 34 additions and 6 deletions

@ -1,5 +1,5 @@
/* eslint-disable @typescript-eslint/no-var-requires */ /* eslint-disable @typescript-eslint/no-var-requires */
const { app, BrowserWindow, shell } = require("electron"); const { app, BrowserWindow } = require("electron");
const log = require("electron-log"); const log = require("electron-log");
const utils = require("./utils"); const utils = require("./utils");
const achievements = require("./achievements"); const achievements = require("./achievements");
@ -31,9 +31,7 @@ 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); utils.openExternal(url);
global.app_playerOpenedExternalLink = true;
}); });
window.webContents.backgroundThrottling = false; window.webContents.backgroundThrottling = false;

@ -1,5 +1,5 @@
/* eslint-disable @typescript-eslint/no-var-requires */ /* eslint-disable @typescript-eslint/no-var-requires */
const { Menu, clipboard } = require("electron"); const { Menu, clipboard, dialog } = require("electron");
const log = require("electron-log"); const log = require("electron-log");
const api = require("./api-server"); const api = require("./api-server");
const utils = require("./utils"); const utils = require("./utils");
@ -78,6 +78,30 @@ function getMenu(window) {
clipboard.writeText(token); clipboard.writeText(token);
}) })
}, },
{
type: 'separator',
},
{
label: 'Information',
click: () => {
dialog.showMessageBox({
type: 'info',
title: 'Bitburner > API Server Information',
message: 'The API Server is used to write script files to your in-game home.',
detail: 'There is an official Visual Studio Code extension that makes use of that feature.\n\n' +
'It allows you to write your script file in an external IDE and have them pushed over to the game automatically.\n' +
'If you want more information, head over to: https://github.com/bitburner-official/bitburner-vscode.',
buttons: ['Dismiss', 'Open Extension Link (GitHub)'],
defaultId: 0,
cancelId: 0,
noLink: true,
}).then(({response}) => {
if (response === 1) {
utils.openExternal('https://github.com/bitburner-official/bitburner-vscode');
}
});
}
}
] ]
}, },
{ {

@ -1,5 +1,5 @@
/* eslint-disable @typescript-eslint/no-var-requires */ /* eslint-disable @typescript-eslint/no-var-requires */
const { app, dialog } = require("electron"); const { app, dialog, shell } = require("electron");
const log = require("electron-log"); const log = require("electron-log");
const achievements = require("./achievements"); const achievements = require("./achievements");
@ -93,7 +93,13 @@ async function exportSave(window) {
.executeJavaScript(`${exportSaveFromIndexedDb.toString()}; exportSaveFromIndexedDb();`, true); .executeJavaScript(`${exportSaveFromIndexedDb.toString()}; exportSaveFromIndexedDb();`, true);
} }
function openExternal(url) {
shell.openExternal(url);
global.app_playerOpenedExternalLink = true;
}
module.exports = { module.exports = {
reloadAndKill, showErrorBox, exportSave, reloadAndKill, showErrorBox, exportSave,
attachUnresponsiveAppHandler, detachUnresponsiveAppHandler, attachUnresponsiveAppHandler, detachUnresponsiveAppHandler,
openExternal,
} }