From dc7c9bb06509c362e99f9def63a0dfcc06468d65 Mon Sep 17 00:00:00 2001 From: LJ <23249107+LJNeon@users.noreply.github.com> Date: Thu, 15 Feb 2024 06:39:50 -0700 Subject: [PATCH] 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 --- src/Terminal/commands/ls.tsx | 3 ++- src/ui/GameRoot.tsx | 2 +- src/ui/Router.ts | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Terminal/commands/ls.tsx b/src/Terminal/commands/ls.tsx index 202882605..b94faa997 100644 --- a/src/Terminal/commands/ls.tsx +++ b/src/Terminal/commands/ls.tsx @@ -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(); + const options = { hostname: server.hostname }; files.set(fullPath, code); - Router.toPage(Page.ScriptEditor, { files }); + Router.toPage(Page.ScriptEditor, { files, options }); } return ( diff --git a/src/ui/GameRoot.tsx b/src/ui/GameRoot.tsx index 4066512db..1d690b70c 100644 --- a/src/ui/GameRoot.tsx +++ b/src/ui/GameRoot.tsx @@ -246,7 +246,7 @@ export function GameRoot(): React.ReactElement { mainPage = ( ); diff --git a/src/ui/Router.ts b/src/ui/Router.ts index a6a6524cb..83d052afb 100644 --- a/src/ui/Router.ts +++ b/src/ui/Router.ts @@ -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. */