diff --git a/app/Http/Controllers/Api/Client/Servers/StartupController.php b/app/Http/Controllers/Api/Client/Servers/StartupController.php index 6eb1df0a..92961e1c 100644 --- a/app/Http/Controllers/Api/Client/Servers/StartupController.php +++ b/app/Http/Controllers/Api/Client/Servers/StartupController.php @@ -55,9 +55,13 @@ class StartupController extends ClientApiController /** @var \Pterodactyl\Models\EggVariable $variable */ $variable = $server->variables()->where('env_variable', $request->input('key'))->first(); - if (is_null($variable) || !$variable->user_viewable || !$variable->user_editable) { + if (is_null($variable) || !$variable->user_viewable) { throw new BadRequestHttpException( - "The environment variable you are trying to edit [\"{$request->input('key')}\"] does not exist." + "The environment variable you are trying to edit does not exist." + ); + } else if (! $variable->user_editable) { + throw new BadRequestHttpException( + "The environment variable you are trying to edit is read-only." ); } diff --git a/resources/scripts/components/server/startup/VariableBox.tsx b/resources/scripts/components/server/startup/VariableBox.tsx index e9e7b58f..ffc58932 100644 --- a/resources/scripts/components/server/startup/VariableBox.tsx +++ b/resources/scripts/components/server/startup/VariableBox.tsx @@ -43,12 +43,25 @@ const VariableBox = ({ variable }: Props) => { }, 500); return ( - + + {!variable.isEditable && + Read Only + } + {variable.name} +

+ } + > setVariableValue(e.currentTarget.value)} - readOnly={!canEdit} + onKeyUp={e => { + if (canEdit && variable.isEditable) { + setVariableValue(e.currentTarget.value); + } + }} + readOnly={!canEdit || !variable.isEditable} name={variable.envVariable} defaultValue={variable.serverValue} placeholder={variable.defaultValue}