From 3fe5d162f5a374541ee744c3db236dc745a05fb0 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Thu, 20 Apr 2017 17:57:40 -0400 Subject: [PATCH] Add skip scripting option --- app/Http/Controllers/Daemon/OptionController.php | 3 +-- app/Repositories/ServerRepository.php | 2 ++ resources/themes/pterodactyl/admin/servers/new.blade.php | 7 +++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Daemon/OptionController.php b/app/Http/Controllers/Daemon/OptionController.php index 0a171852..087b1f50 100644 --- a/app/Http/Controllers/Daemon/OptionController.php +++ b/app/Http/Controllers/Daemon/OptionController.php @@ -41,8 +41,7 @@ class OptionController extends Controller return response()->json([ 'scripts' => [ - 'install' => str_replace(["\r\n", "\n", "\r"], "\n", $server->option->script_install), - // 'upgrade' => str_replace(["\r\n", "\n", "\r"], "\n", $server->option->script_upgrade), + 'install' => (! $server->option->script_install) ? null : str_replace(["\r\n", "\n", "\r"], "\n", $server->option->script_install), 'privileged' => $server->option->script_is_privileged, ], 'env' => $environment->merge([ diff --git a/app/Repositories/ServerRepository.php b/app/Repositories/ServerRepository.php index 674afa67..e782c938 100644 --- a/app/Repositories/ServerRepository.php +++ b/app/Repositories/ServerRepository.php @@ -103,6 +103,7 @@ class ServerRepository 'startup' => 'string', 'auto_deploy' => 'sometimes|required|accepted', 'custom_id' => 'sometimes|required|numeric|unique:servers,id', + 'skip_scripting' => 'sometimes|required|boolean', ]); $validator->sometimes('node_id', 'required|numeric|min:1|exists:nodes,id', function ($input) { @@ -326,6 +327,7 @@ class ServerRepository 'type' => $service->folder, 'option' => $option->tag, 'pack' => (isset($pack)) ? $pack->uuid : null, + 'skip_scripting' => isset($data['skip_scripting']), ], 'keys' => [ (string) $server->daemonSecret => $this->daemonPermissions, diff --git a/resources/themes/pterodactyl/admin/servers/new.blade.php b/resources/themes/pterodactyl/admin/servers/new.blade.php index e2071d37..eaf20445 100644 --- a/resources/themes/pterodactyl/admin/servers/new.blade.php +++ b/resources/themes/pterodactyl/admin/servers/new.blade.php @@ -212,6 +212,13 @@

Select a service pack to be automatically installed on this server when first created.

+
+
+ + +
+

If the selected Option has an install script attached to it, the script will run during install after the pack is installed. If you would like to skip this step, check this box.

+