mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-17 14:59:16 +02:00
MISC: Remove API server (#2084)
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
const { app, Menu, clipboard, dialog, shell } = require("electron");
|
||||
const { app, Menu, dialog, shell } = require("electron");
|
||||
const log = require("electron-log");
|
||||
const Store = require("electron-store");
|
||||
const api = require("./api-server");
|
||||
const utils = require("./utils");
|
||||
const storage = require("./storage");
|
||||
const store = new Store();
|
||||
@@ -233,83 +232,6 @@ function getMenu(window) {
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
label: "API Server",
|
||||
submenu: [
|
||||
{
|
||||
label: api.isListening() ? "Disable Server" : "Enable Server",
|
||||
click: async () => {
|
||||
let success = false;
|
||||
try {
|
||||
await api.toggleServer();
|
||||
success = true;
|
||||
} catch (error) {
|
||||
log.error(error);
|
||||
utils.showErrorBox("Error Toggling Server", error);
|
||||
}
|
||||
if (success && api.isListening()) {
|
||||
utils.writeToast(window, "Started API Server", "success");
|
||||
} else if (success && !api.isListening()) {
|
||||
utils.writeToast(window, "Stopped API Server", "success");
|
||||
} else {
|
||||
utils.writeToast(window, "Error Toggling Server", "error");
|
||||
}
|
||||
refreshMenu(window);
|
||||
},
|
||||
},
|
||||
{
|
||||
label: api.isAutostart() ? "Disable Autostart" : "Enable Autostart",
|
||||
click: async () => {
|
||||
api.toggleAutostart();
|
||||
if (api.isAutostart()) {
|
||||
utils.writeToast(window, "Enabled API Server Autostart", "success");
|
||||
} else {
|
||||
utils.writeToast(window, "Disabled API Server Autostart", "success");
|
||||
}
|
||||
refreshMenu(window);
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "Copy Auth Token",
|
||||
click: async () => {
|
||||
const token = api.getAuthenticationToken();
|
||||
log.log("Wrote authentication token to clipboard");
|
||||
clipboard.writeText(token);
|
||||
utils.writeToast(window, "Copied Authentication Token to Clipboard", "info");
|
||||
},
|
||||
},
|
||||
{
|
||||
type: "separator",
|
||||
},
|
||||
{
|
||||
label: "Information",
|
||||
click: () => {
|
||||
dialog
|
||||
.showMessageBox({
|
||||
type: "warning",
|
||||
title: "Bitburner > API Server Information",
|
||||
message: "The API Server is used to write script files to your in-game home.",
|
||||
detail:
|
||||
`WARNING: This feature is deprecated. It may be removed in future versions.\n\n` +
|
||||
`You should use external tools that support our Remote API feature. For details, please check the "Remote API" page in the in-game documentation. You can also check the "external-editors" channel in our Discord server for more information and support.\n\n` +
|
||||
"--------------------------------------------------------------------------------\n\n" +
|
||||
"There is an official Visual Studio Code extension that makes use of the API Server 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) {
|
||||
shell.openExternal("https://github.com/bitburner-official/bitburner-vscode");
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
label: "Zoom",
|
||||
submenu: [
|
||||
|
||||
Reference in New Issue
Block a user