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:
LJ 2024-02-15 06:39:50 -07:00 committed by GitHub
parent b79df29ef4
commit dc7c9bb065
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 3 deletions

@ -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. */