From 5d60a6e5692ca0350fa5326887ef8efe6dc913ae Mon Sep 17 00:00:00 2001 From: Jordan Date: Sun, 18 Jun 2023 13:08:45 -0400 Subject: [PATCH] Fix .tgs.yml scripts setup --- src/components/views/Instance/Create.tsx | 15 ++++++++------- src/utils/ITGSYml.ts | 4 ++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/components/views/Instance/Create.tsx b/src/components/views/Instance/Create.tsx index 1e8fc554..f1a9714f 100644 --- a/src/components/views/Instance/Create.tsx +++ b/src/components/views/Instance/Create.tsx @@ -445,24 +445,25 @@ class InstanceCreate extends React.Component { } const isWindows = this.context.serverInfo.windowsHost; - const scripts = - (isWindows ? yml.windows_scripts : yml.linux_scripts) ?? new Map(); + const scripts = (isWindows ? yml.windows_scripts : yml.linux_scripts) ?? {}; const secLevel = getTGSYmlSecurity(yml) ?? DreamDaemonSecurity.Safe; try { const scriptData = new Map(); - if (scripts.size > 0) { - for (const scriptKvp of scripts) { + const scriptKeys = Object.keys(scripts); + if (scriptKeys.length > 0) { + for (const scriptName of scriptKeys) { + const scriptPath = scripts[scriptName]; this.pushStage( ); const scriptResponse = await GithubClient.getFile( this.state.repoOwner, this.state.repoName, - scriptKvp[1] + scriptPath ); if (scriptResponse.code === StatusCode.ERROR) { @@ -473,7 +474,7 @@ class InstanceCreate extends React.Component { return; } - scriptData.set(scriptKvp[0], scriptResponse.payload); + scriptData.set(scriptName, scriptResponse.payload); } } diff --git a/src/utils/ITGSYml.ts b/src/utils/ITGSYml.ts index 8381d8c7..539110a4 100644 --- a/src/utils/ITGSYml.ts +++ b/src/utils/ITGSYml.ts @@ -22,7 +22,7 @@ export default interface ITGSYml { version: number; byond?: string; static_files?: IStaticFile[]; - linux_scripts?: Map; - windows_scripts?: Map; + linux_scripts?: { [index: string]: string }; + windows_scripts?: { [index: string]: string }; security?: string; }