From 344c1a988535a94d69a4bd3098c6dd069c55c274 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Fri, 6 Oct 2017 21:22:32 -0500 Subject: [PATCH] First push before :egg: --- app/Models/Service.php | 6 -- app/Models/ServiceOption.php | 11 --- .../Sharing/ServiceOptionExporterService.php | 2 - database/factories/ModelFactory.php | 7 +- ...22_RemoveDaemonSecretFromSubusersTable.php | 6 +- ...angeServicesToUseAMoreUniqueIdentifier.php | 4 + ...ngeToABetterUniqueServiceConfiguration.php | 9 +-- .../admin/services/functions.blade.php | 73 ------------------- .../pterodactyl/admin/services/new.blade.php | 15 +--- .../pterodactyl/admin/services/view.blade.php | 59 ++++++--------- routes/admin.php | 2 - 11 files changed, 36 insertions(+), 158 deletions(-) delete mode 100644 resources/themes/pterodactyl/admin/services/functions.blade.php diff --git a/app/Models/Service.php b/app/Models/Service.php index 0a17f7e42..e6c69bede 100644 --- a/app/Models/Service.php +++ b/app/Models/Service.php @@ -34,8 +34,6 @@ class Service extends Model implements CleansAttributes, ValidableContract protected $fillable = [ 'name', 'description', - 'startup', - 'index_file', ]; /** @@ -45,8 +43,6 @@ class Service extends Model implements CleansAttributes, ValidableContract 'author' => 'required', 'name' => 'required', 'description' => 'sometimes', - 'startup' => 'sometimes', - 'index_file' => 'required', ]; /** @@ -56,8 +52,6 @@ class Service extends Model implements CleansAttributes, ValidableContract 'author' => 'email', 'name' => 'string|max:255', 'description' => 'nullable|string', - 'startup' => 'nullable|string', - 'index_file' => 'string', ]; /** diff --git a/app/Models/ServiceOption.php b/app/Models/ServiceOption.php index f4bc72eaa..e424227fc 100644 --- a/app/Models/ServiceOption.php +++ b/app/Models/ServiceOption.php @@ -107,17 +107,6 @@ class ServiceOption extends Model implements CleansAttributes, ValidableContract 'docker_image' => null, ]; - /** - * Returns the display startup string for the option and will use the parent - * service one if the option does not have one defined. - * - * @return string - */ - public function getDisplayStartupAttribute() - { - return (is_null($this->startup)) ? $this->service->startup : $this->startup; - } - /** * Returns the install script for the option; if option is copying from another * it will return the copied script. diff --git a/app/Services/Services/Sharing/ServiceOptionExporterService.php b/app/Services/Services/Sharing/ServiceOptionExporterService.php index 744d298a4..8f2d1ebf5 100644 --- a/app/Services/Services/Sharing/ServiceOptionExporterService.php +++ b/app/Services/Services/Sharing/ServiceOptionExporterService.php @@ -58,10 +58,8 @@ class ServiceOptionExporterService 'exported_at' => $this->carbon->now()->toIso8601String(), 'name' => $option->name, 'author' => array_get(explode(':', $option->tag), 0), - 'tag' => $option->tag, 'description' => $option->description, 'image' => $option->docker_image, - 'startup' => $option->display_startup, 'config' => [ 'files' => $option->inherit_config_files, 'startup' => $option->inherit_config_startup, diff --git a/database/factories/ModelFactory.php b/database/factories/ModelFactory.php index d8d14526b..46895d70d 100644 --- a/database/factories/ModelFactory.php +++ b/database/factories/ModelFactory.php @@ -91,12 +91,10 @@ $factory->define(Pterodactyl\Models\Node::class, function (Faker\Generator $fake $factory->define(Pterodactyl\Models\Service::class, function (Faker\Generator $faker) { return [ 'id' => $faker->unique()->randomNumber(), - 'author' => $faker->unique()->uuid, + 'uuid' => $faker->unique()->uuid, + 'author' => 'testauthor@example.com', 'name' => $faker->word, 'description' => null, - 'folder' => strtolower($faker->unique()->word), - 'startup' => 'java -jar test.jar', - 'index_file' => 'indexjs', ]; }); @@ -108,7 +106,6 @@ $factory->define(Pterodactyl\Models\ServiceOption::class, function (Faker\Genera 'name' => $faker->name, 'description' => implode(' ', $faker->sentences(3)), 'startup' => 'java -jar test.jar', - 'tag' => 'test@testfactory.com:' . $faker->unique()->randomNumber(8), ]; }); diff --git a/database/migrations/2017_09_23_185022_RemoveDaemonSecretFromSubusersTable.php b/database/migrations/2017_09_23_185022_RemoveDaemonSecretFromSubusersTable.php index a0c5e6d10..d4d2dd695 100644 --- a/database/migrations/2017_09_23_185022_RemoveDaemonSecretFromSubusersTable.php +++ b/database/migrations/2017_09_23_185022_RemoveDaemonSecretFromSubusersTable.php @@ -42,12 +42,16 @@ class RemoveDaemonSecretFromSubusersTable extends Migration public function down() { Schema::table('subusers', function (Blueprint $table) { - $table->char('daemonSecret', 36)->after('server_id')->unique(); + $table->char('daemonSecret', 36)->after('server_id'); }); $subusers = DB::table('subusers')->get(); $subusers->each(function ($subuser) { DB::table('daemon_keys')->where('user_id', $subuser->user_id)->where('server_id', $subuser->server_id)->delete(); }); + + Schema::table('subusers', function (Blueprint $table) { + $table->unique('daemonSecret'); + }); } } diff --git a/database/migrations/2017_10_02_202000_ChangeServicesToUseAMoreUniqueIdentifier.php b/database/migrations/2017_10_02_202000_ChangeServicesToUseAMoreUniqueIdentifier.php index d7e9caa86..6bb36813d 100644 --- a/database/migrations/2017_10_02_202000_ChangeServicesToUseAMoreUniqueIdentifier.php +++ b/database/migrations/2017_10_02_202000_ChangeServicesToUseAMoreUniqueIdentifier.php @@ -20,6 +20,8 @@ class ChangeServicesToUseAMoreUniqueIdentifier extends Migration $table->string('author')->change(); $table->char('uuid', 36)->after('id'); $table->dropColumn('folder'); + $table->dropColumn('startup'); + $table->dropColumn('index_file'); }); DB::table('services')->get(['id', 'author', 'uuid'])->each(function ($service) { @@ -42,6 +44,8 @@ class ChangeServicesToUseAMoreUniqueIdentifier extends Migration Schema::table('services', function (Blueprint $table) { $table->dropColumn('uuid'); $table->string('folder')->nullable(); + $table->text('startup')->nullable(); + $table->text('index_file'); $table->string('author', 36)->change(); $table->unique('name'); diff --git a/database/migrations/2017_10_02_202007_ChangeToABetterUniqueServiceConfiguration.php b/database/migrations/2017_10_02_202007_ChangeToABetterUniqueServiceConfiguration.php index 96a968144..7ce854c56 100644 --- a/database/migrations/2017_10_02_202007_ChangeToABetterUniqueServiceConfiguration.php +++ b/database/migrations/2017_10_02_202007_ChangeToABetterUniqueServiceConfiguration.php @@ -15,19 +15,16 @@ class ChangeToABetterUniqueServiceConfiguration extends Migration { Schema::table('service_options', function (Blueprint $table) { $table->char('uuid', 36)->after('id'); - - $table->index(['service_id', 'tag']); + $table->dropColumn('tag'); }); DB::transaction(function () { DB::table('service_options')->select([ 'service_options.id', 'service_options.uuid', - 'service_options.tag', 'services.author AS service_author', ])->join('services', 'services.id', '=', 'service_options.service_id')->get()->each(function ($option) { DB::table('service_options')->where('id', $option->id)->update([ - 'tag' => $option->service_author . ':' . $option->tag, 'uuid' => Uuid::uuid4()->toString(), ]); }); @@ -45,13 +42,13 @@ class ChangeToABetterUniqueServiceConfiguration extends Migration { Schema::table('service_options', function (Blueprint $table) { $table->dropColumn('uuid'); - $table->dropIndex(['service_id', 'tag']); + $table->string('tag'); }); DB::transaction(function () { DB::table('service_options')->select(['id', 'tag'])->get()->each(function ($option) { DB::table('service_options')->where('id', $option->id)->update([ - 'tag' => array_get(explode(':', $option->tag), 1), + 'tag' => str_random(10), ]); }); }); diff --git a/resources/themes/pterodactyl/admin/services/functions.blade.php b/resources/themes/pterodactyl/admin/services/functions.blade.php deleted file mode 100644 index 12ba8af3a..000000000 --- a/resources/themes/pterodactyl/admin/services/functions.blade.php +++ /dev/null @@ -1,73 +0,0 @@ -{{-- Pterodactyl - Panel --}} -{{-- Copyright (c) 2015 - 2017 Dane Everitt --}} - -{{-- This software is licensed under the terms of the MIT license. --}} -{{-- https://opensource.org/licenses/MIT --}} -@extends('layouts.admin') - -@section('title') - Service → {{ $service->name }} → Functions -@endsection - -@section('content-header') -

{{ $service->name }}Extend the default daemon functions using this service file.

- -@endsection - -@section('content') -
-
- -
-
-
-
-
-
-

Functions Control

-
-
-
-
{{ $service->index_file }}
- -
- -
-
-
-
-@endsection - -@section('footer-scripts') - @parent - {!! Theme::js('vendor/ace/ace.js') !!} - {!! Theme::js('vendor/ace/ext-modelist.js') !!} - -@endsection diff --git a/resources/themes/pterodactyl/admin/services/new.blade.php b/resources/themes/pterodactyl/admin/services/new.blade.php index c63bec43b..cb48991ec 100644 --- a/resources/themes/pterodactyl/admin/services/new.blade.php +++ b/resources/themes/pterodactyl/admin/services/new.blade.php @@ -21,7 +21,7 @@ @section('content')
-
+

New Service

@@ -41,19 +41,6 @@
-
-
-
-
-
-
- -
- -

The default start command to use when running options under this service. This command can be modified per-option and should include the executable to be called in the container.

-
-
-