Skip to content

Commit 344c1a9

Browse files
committed
First push before 🥚
1 parent 0b3c0f6 commit 344c1a9

File tree

11 files changed

+36
-158
lines changed

11 files changed

+36
-158
lines changed

app/Models/Service.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ class Service extends Model implements CleansAttributes, ValidableContract
3434
protected $fillable = [
3535
'name',
3636
'description',
37-
'startup',
38-
'index_file',
3937
];
4038

4139
/**
@@ -45,8 +43,6 @@ class Service extends Model implements CleansAttributes, ValidableContract
4543
'author' => 'required',
4644
'name' => 'required',
4745
'description' => 'sometimes',
48-
'startup' => 'sometimes',
49-
'index_file' => 'required',
5046
];
5147

5248
/**
@@ -56,8 +52,6 @@ class Service extends Model implements CleansAttributes, ValidableContract
5652
'author' => 'email',
5753
'name' => 'string|max:255',
5854
'description' => 'nullable|string',
59-
'startup' => 'nullable|string',
60-
'index_file' => 'string',
6155
];
6256

6357
/**

app/Models/ServiceOption.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -107,17 +107,6 @@ class ServiceOption extends Model implements CleansAttributes, ValidableContract
107107
'docker_image' => null,
108108
];
109109

110-
/**
111-
* Returns the display startup string for the option and will use the parent
112-
* service one if the option does not have one defined.
113-
*
114-
* @return string
115-
*/
116-
public function getDisplayStartupAttribute()
117-
{
118-
return (is_null($this->startup)) ? $this->service->startup : $this->startup;
119-
}
120-
121110
/**
122111
* Returns the install script for the option; if option is copying from another
123112
* it will return the copied script.

app/Services/Services/Sharing/ServiceOptionExporterService.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,8 @@ public function handle(int $option): string
5858
'exported_at' => $this->carbon->now()->toIso8601String(),
5959
'name' => $option->name,
6060
'author' => array_get(explode(':', $option->tag), 0),
61-
'tag' => $option->tag,
6261
'description' => $option->description,
6362
'image' => $option->docker_image,
64-
'startup' => $option->display_startup,
6563
'config' => [
6664
'files' => $option->inherit_config_files,
6765
'startup' => $option->inherit_config_startup,

database/factories/ModelFactory.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,10 @@
9191
$factory->define(Pterodactyl\Models\Service::class, function (Faker\Generator $faker) {
9292
return [
9393
'id' => $faker->unique()->randomNumber(),
94-
'author' => $faker->unique()->uuid,
94+
'uuid' => $faker->unique()->uuid,
95+
'author' => 'testauthor@example.com',
9596
'name' => $faker->word,
9697
'description' => null,
97-
'folder' => strtolower($faker->unique()->word),
98-
'startup' => 'java -jar test.jar',
99-
'index_file' => 'indexjs',
10098
];
10199
});
102100

@@ -108,7 +106,6 @@
108106
'name' => $faker->name,
109107
'description' => implode(' ', $faker->sentences(3)),
110108
'startup' => 'java -jar test.jar',
111-
'tag' => 'test@testfactory.com:' . $faker->unique()->randomNumber(8),
112109
];
113110
});
114111

database/migrations/2017_09_23_185022_RemoveDaemonSecretFromSubusersTable.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,16 @@ public function up()
4242
public function down()
4343
{
4444
Schema::table('subusers', function (Blueprint $table) {
45-
$table->char('daemonSecret', 36)->after('server_id')->unique();
45+
$table->char('daemonSecret', 36)->after('server_id');
4646
});
4747

4848
$subusers = DB::table('subusers')->get();
4949
$subusers->each(function ($subuser) {
5050
DB::table('daemon_keys')->where('user_id', $subuser->user_id)->where('server_id', $subuser->server_id)->delete();
5151
});
52+
53+
Schema::table('subusers', function (Blueprint $table) {
54+
$table->unique('daemonSecret');
55+
});
5256
}
5357
}

database/migrations/2017_10_02_202000_ChangeServicesToUseAMoreUniqueIdentifier.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ public function up()
2020
$table->string('author')->change();
2121
$table->char('uuid', 36)->after('id');
2222
$table->dropColumn('folder');
23+
$table->dropColumn('startup');
24+
$table->dropColumn('index_file');
2325
});
2426

2527
DB::table('services')->get(['id', 'author', 'uuid'])->each(function ($service) {
@@ -42,6 +44,8 @@ public function down()
4244
Schema::table('services', function (Blueprint $table) {
4345
$table->dropColumn('uuid');
4446
$table->string('folder')->nullable();
47+
$table->text('startup')->nullable();
48+
$table->text('index_file');
4549
$table->string('author', 36)->change();
4650

4751
$table->unique('name');

database/migrations/2017_10_02_202007_ChangeToABetterUniqueServiceConfiguration.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,16 @@ public function up()
1515
{
1616
Schema::table('service_options', function (Blueprint $table) {
1717
$table->char('uuid', 36)->after('id');
18-
19-
$table->index(['service_id', 'tag']);
18+
$table->dropColumn('tag');
2019
});
2120

2221
DB::transaction(function () {
2322
DB::table('service_options')->select([
2423
'service_options.id',
2524
'service_options.uuid',
26-
'service_options.tag',
2725
'services.author AS service_author',
2826
])->join('services', 'services.id', '=', 'service_options.service_id')->get()->each(function ($option) {
2927
DB::table('service_options')->where('id', $option->id)->update([
30-
'tag' => $option->service_author . ':' . $option->tag,
3128
'uuid' => Uuid::uuid4()->toString(),
3229
]);
3330
});
@@ -45,13 +42,13 @@ public function down()
4542
{
4643
Schema::table('service_options', function (Blueprint $table) {
4744
$table->dropColumn('uuid');
48-
$table->dropIndex(['service_id', 'tag']);
45+
$table->string('tag');
4946
});
5047

5148
DB::transaction(function () {
5249
DB::table('service_options')->select(['id', 'tag'])->get()->each(function ($option) {
5350
DB::table('service_options')->where('id', $option->id)->update([
54-
'tag' => array_get(explode(':', $option->tag), 1),
51+
'tag' => str_random(10),
5552
]);
5653
});
5754
});

resources/themes/pterodactyl/admin/services/functions.blade.php

Lines changed: 0 additions & 73 deletions
This file was deleted.

resources/themes/pterodactyl/admin/services/new.blade.php

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
@section('content')
2222
<form action="{{ route('admin.services.new') }}" method="POST">
2323
<div class="row">
24-
<div class="col-md-6">
24+
<div class="col-md-12">
2525
<div class="box">
2626
<div class="box-header with-border">
2727
<h3 class="box-title">New Service</h3>
@@ -41,19 +41,6 @@
4141
</div>
4242
</div>
4343
</div>
44-
</div>
45-
</div>
46-
<div class="col-md-6">
47-
<div class="box">
48-
<div class="box-body">
49-
<div class="form-group">
50-
<label class="control-label">Default Start Command</label>
51-
<div>
52-
<textarea name="startup" class="form-control" rows="2">{{ old('startup') }}</textarea>
53-
<p class="text-muted"><small>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.</small></p>
54-
</div>
55-
</div>
56-
</div>
5744
<div class="box-footer">
5845
{!! csrf_field() !!}
5946
<button type="input" class="btn btn-primary pull-right">Save Service</button>

resources/themes/pterodactyl/admin/services/view.blade.php

Lines changed: 21 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -20,70 +20,53 @@
2020

2121
@section('content')
2222
<div class="row">
23-
<div class="col-xs-12">
24-
<div class="nav-tabs-custom nav-tabs-floating">
25-
<ul class="nav nav-tabs">
26-
<li class="active"><a href="{{ route('admin.services.view', $service->id) }}">Overview</a></li>
27-
<li><a href="{{ route('admin.services.view.functions', $service->id) }}">Functions</a></li>
28-
</ul>
29-
</div>
30-
</div>
31-
</div>
32-
<form action="{{ route('admin.services.view', $service->id) }}" method="POST">
33-
<div class="row">
23+
<form action="{{ route('admin.services.view', $service->id) }}" method="POST">
3424
<div class="col-md-6">
3525
<div class="box">
3626
<div class="box-body">
3727
<div class="form-group">
38-
<label class="control-label">Name</label>
28+
<label class="control-label">Name <span class="field-required"></span></label>
3929
<div>
4030
<input type="text" name="name" class="form-control" value="{{ $service->name }}" />
4131
<p class="text-muted"><small>This should be a descriptive category name that emcompasses all of the options within the service.</small></p>
4232
</div>
4333
</div>
4434
<div class="form-group">
45-
<label class="control-label">Description</label>
35+
<label class="control-label">Description <span class="field-required"></span></label>
4636
<div>
4737
<textarea name="description" class="form-control" rows="7">{{ $service->description }}</textarea>
4838
</div>
4939
</div>
5040
</div>
5141
<div class="box-footer">
42+
{!! csrf_field() !!}
43+
<button type="submit" name="_method" value="PATCH" class="btn btn-primary btn-sm pull-right">Edit Option</button>
5244
<button id="deleteButton" type="submit" name="_method" value="DELETE" class="btn btn-sm btn-danger muted muted-hover"><i class="fa fa-trash-o"></i></button>
5345
</div>
5446
</div>
5547
</div>
56-
<div class="col-md-6">
57-
<div class="box">
58-
<div class="box-body">
59-
<div class="form-group">
60-
<label class="control-label">Default Start Command</label>
61-
<div>
62-
<textarea name="startup" class="form-control" rows="2">{{ $service->startup }}</textarea>
63-
<p class="text-muted"><small>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.</small></p>
64-
</div>
65-
</div>
66-
<div class="form-group">
67-
<label class="control-label">Author</label>
68-
<div>
69-
<input type="text" readonly class="form-control" value="{{ $service->author }}" />
70-
</div>
71-
</div>
72-
<div class="form-group">
73-
<label class="control-label">UUID</label>
74-
<div>
75-
<input type="text" readonly class="form-control" value="{{ $service->uuid }}" />
76-
</div>
48+
</form>
49+
<div class="col-md-6">
50+
<div class="box">
51+
<div class="box-body">
52+
<div class="form-group">
53+
<label class="control-label">Author</label>
54+
<div>
55+
<input type="text" readonly class="form-control" value="{{ $service->author }}" />
56+
<p class="text-muted small">The author of this service option. Please direct questions and issues to them unless this is an official option authored by <code>support@pterodactyl.io</code>.</p>
7757
</div>
7858
</div>
79-
<div class="box-footer">
80-
{!! csrf_field() !!}
81-
<button type="submit" name="_method" value="PATCH" class="btn btn-primary btn-sm pull-right">Edit Service</button>
59+
<div class="form-group">
60+
<label class="control-label">UUID</label>
61+
<div>
62+
<input type="text" readonly class="form-control" value="{{ $service->uuid }}" />
63+
<p class="text-muted small">A unique identifier that all servers using this option are assigned for identification purposes.</p>
64+
</div>
8265
</div>
8366
</div>
8467
</div>
8568
</div>
86-
</form>
69+
</div>
8770
<div class="row">
8871
<div class="col-xs-12">
8972
<div class="box box-primary">

0 commit comments

Comments
 (0)