diff --git a/electron/gameWindow.js b/electron/gameWindow.js index 39fdaea0e..f105340f8 100644 --- a/electron/gameWindow.js +++ b/electron/gameWindow.js @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/no-var-requires */ -const { app, BrowserWindow, shell } = require("electron"); +const { app, BrowserWindow } = require("electron"); const log = require("electron-log"); const utils = require("./utils"); const achievements = require("./achievements"); @@ -31,9 +31,7 @@ async function createWindow(killall) { // and open every other protocols on the browser e.preventDefault(); - shell.openExternal(url); - - global.app_playerOpenedExternalLink = true; + utils.openExternal(url); }); window.webContents.backgroundThrottling = false; diff --git a/electron/menu.js b/electron/menu.js index 9b73b984c..ac00af758 100644 --- a/electron/menu.js +++ b/electron/menu.js @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/no-var-requires */ -const { Menu, clipboard } = require("electron"); +const { Menu, clipboard, dialog } = require("electron"); const log = require("electron-log"); const api = require("./api-server"); const utils = require("./utils"); @@ -78,6 +78,30 @@ function getMenu(window) { 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'); + } + }); + } + } ] }, { diff --git a/electron/utils.js b/electron/utils.js index 8e45eba3e..ed88a01f9 100644 --- a/electron/utils.js +++ b/electron/utils.js @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/no-var-requires */ -const { app, dialog } = require("electron"); +const { app, dialog, shell } = require("electron"); const log = require("electron-log"); const achievements = require("./achievements"); @@ -93,7 +93,13 @@ async function exportSave(window) { .executeJavaScript(`${exportSaveFromIndexedDb.toString()}; exportSaveFromIndexedDb();`, true); } +function openExternal(url) { + shell.openExternal(url); + global.app_playerOpenedExternalLink = true; +} + module.exports = { reloadAndKill, showErrorBox, exportSave, attachUnresponsiveAppHandler, detachUnresponsiveAppHandler, + openExternal, }