mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-16 06:18:42 +02:00
BUGFIX: Attach hostname to script links in ls command (#1062)
fixes #1051 * Add hostname to script editor page options * Add hostname option to script editor page * Attach hostname to script links in ls * Fix script editor page option type
This commit is contained in:
@@ -136,8 +136,9 @@ export function ls(args: (string | number | boolean)[], server: BaseServer): voi
|
||||
function onClick() {
|
||||
const code = server.scripts.get(fullPath)?.content ?? "";
|
||||
const files = new Map<ContentFilePath, string>();
|
||||
const options = { hostname: server.hostname };
|
||||
files.set(fullPath, code);
|
||||
Router.toPage(Page.ScriptEditor, { files });
|
||||
Router.toPage(Page.ScriptEditor, { files, options });
|
||||
}
|
||||
return (
|
||||
<span>
|
||||
|
||||
@@ -246,7 +246,7 @@ export function GameRoot(): React.ReactElement {
|
||||
mainPage = (
|
||||
<ScriptEditorRoot
|
||||
files={pageWithContext.files ?? new Map()}
|
||||
hostname={Player.getCurrentServer().hostname}
|
||||
hostname={pageWithContext.options?.hostname ?? Player.getCurrentServer().hostname}
|
||||
vim={!!pageWithContext.options?.vim}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -88,7 +88,8 @@ export type PageWithContext =
|
||||
| { page: SimplePage };
|
||||
|
||||
export interface ScriptEditorRouteOptions {
|
||||
vim: boolean;
|
||||
vim?: boolean;
|
||||
hostname?: string;
|
||||
}
|
||||
|
||||
/** The router keeps track of player navigation/routing within the game. */
|
||||
|
||||
Reference in New Issue
Block a user