Skip to content

Commit 8d24e5f

Browse files
committed
Merge branch 'develop' into feature/option-scripts
# Conflicts: # app/Http/Routes/AdminRoutes.php # app/Http/Routes/DaemonRoutes.php # app/Models/ServiceOption.php
2 parents 03e0de2 + d695532 commit 8d24e5f

File tree

683 files changed

+8833
-12341
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

683 files changed

+8833
-12341
lines changed

.gitignore

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@
66
storage/framework/*
77

88
composer.lock
9-
10-
Homestead.yaml
11-
Vagrantfile
12-
Vagrantfile
13-
14-
node_modules
15-
yarn.lock
169
node_modules
1710

1811
_ide_helper_models.php
1912
_ide_helper.php
13+
14+
sami.phar
15+
/.sami
16+
17+
# For local development with docker
18+
# Remove if we ever put the Dockerfile in the repo
19+
.dockerignore
20+
Dockerfile
21+
# for image related files
22+
misc

.sami.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
use Sami\Sami;
4+
use Symfony\Component\Finder\Finder;
5+
6+
$iterator = Finder::create()
7+
->files()
8+
->name('*.php')
9+
->in($dir = __DIR__ . '/app');
10+
11+
return new Sami($iterator, array(
12+
'title' => 'Pterodactyl',
13+
'build_dir' => __DIR__ . '/.sami/build',
14+
'cache_dir' => __DIR__ . '/.sami/cache',
15+
'default_opened_level' => 2,
16+
));

CHANGELOG.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,80 @@ This file is a running track of new features and fixes to each version of the pa
33

44
This project follows [Semantic Versioning](http://semver.org) guidelines.
55

6+
## v0.6.0-beta.2.1 (Courageous Carniadactylus)
7+
### Fixed
8+
* `[beta.2]` — Suspended servers now show as suspended.
9+
* `[beta.2]` — Corrected the information when a task has not run yet.
10+
* `[beta.2]` — Fixes filemanager 404 when editing a file within a directory.
11+
* `[beta.2]` — Fixes exception in tasks when deleting a server.
12+
* `[beta.2]` — Fixes bug with Terarria and Voice servers reporting a `TypeError: Service is not a constructor` in the daemon due to a missing service configuration.
13+
* `[beta.2]` — Fixes password reset form throwing a MethodNotAllowed error when accessed.
14+
* `[beta.2]` — Fixes invalid password bug when attempting to change account email address.
15+
* `[beta.2]` — New attempt at fixing the issues when rendering files in the browser file editor on certain browsers.
16+
* `[beta.2]` — Fixes broken auto-deploy time checking causing no tokens to work.
17+
* `[beta.2]` — Fixes display of subusers after creation.
18+
* `[beta.2]` — Fixes bug throwing model not found exception when editing an existing subuser.
19+
20+
### Changed
21+
* Deleting a server safely now continues even if the daemon reports a `HTTP/404` missing server error (requires `Daemon@0.4.0-beta.2.1`)
22+
* Changed behavior when modifying server allocation information. You can now remove the default allocation assuming you assing a new allocation at the same time. Reduces the number of steps to change the default allocation for a server.
23+
24+
### Added
25+
* Server listing and view in Admin CP now shows the SFTP username/Docker container name.
26+
* Administrative server view includes link in navigation to go to server console/frontend management.
27+
28+
## v0.6.0-beta.2 (Courageous Carniadactylus)
29+
### Fixed
30+
* `[beta.1]` — Fixes task management ststem not running correctly.
31+
* `[beta.1]` — Fixes API endpoint for command sending missing the required class definition.
32+
* `[beta.1]` — Fixes panel looking for an old compiled classfile that is no longer used. This was causing errors relating to `missing class DingoAPI` when trying to upgrade the panel.
33+
* `[beta.1]` — Should fix render issues when trying to edit some files via the panel file editor.
34+
35+
### Added
36+
* Ability to launch the console in a new window as an individual unit. https://s3.kelp.in/IrTyE.png
37+
38+
## v0.6.0-beta.1 (Courageous Carniadactylus)
39+
### Fixed
40+
* `[pre.7]` — Fixes bug with subuser checkbox display.
41+
* `[pre.7]` — Fixes bug with injected JS that was causing `<!DOCTYPE html>` to be ignored in templates.
42+
* `[pre.7]` — Fixes exception thrown when trying to delete a node due to a misnamed model.
43+
* `[pre.7]` — Fixes username vanishing on failed login attempts.
44+
* `[pre.7]` — Terminal is now fixed to actually output all lines, rather than leaving one hanging in neverland until the browser is resized.
45+
46+
### Added
47+
* Login attempts and pasword reset requests are now protected by invisible ReCaptcha. This feature can be disabled with a `.env` variable.
48+
* Server listing for individual users is now searchable on the front-end.
49+
* Servers that a user is assocaited with as a subuser are now displayed in addition to owned servers when listing users in the Admin CP.
50+
51+
### Changed
52+
* Subuser permissions are now stored in `Permission::list()` to make views way cleaner and make adding to views significantly cleaner.
53+
* `[pre.7]` — Sidebar for file manager now is a single link rather than a dropdown.
54+
* Attempting to reset a password for an account that does not exist no longer returns an error, rather it displays a success message. Failed resets trigger a `Pterodactyl\Events\Auth\FailedPasswordReset` event that can be caught if needed to perform other actions.
55+
* Servers are no longer queued for deletion due to the general hassle and extra logic required.
56+
* Updated all panel components to run on Laravel v5.4 rather than 5.3 which is EOL.
57+
* Routes are now handled in the `routes/` folder, and use a significantly cleaner syntax. Controller names and methods have been updated as well to be clearer as well as avoid conflicts with PHP reserved keywords.
58+
* API has been completely overhauled to use new permissions system. **Any old API keys will immediately become invalid and fail to operate properly anymore. You will need to generate new keys.**
59+
* Cleaned up dynamic database connection setting to use a single function call from the host model.
60+
* `[pre.7]` — Corrected a config option for spigot servers to set a boolean value as boolean, and not as a string.
61+
62+
## v0.6.0-pre.7 (Courageous Carniadactylus)
63+
### Fixed
64+
* `[pre.6]` — Addresses misconfigured console queue that was still sending data way to quickly thus causing the console to explode on some devices when large amounts of data were sent.
65+
* `[pre.6]` — Fixes bug in allocation parsing for a node that prevented adding new allocations.
66+
* `[pre.6]` — Fixes typo in migrations that wouldn't save custom regex for non-required variables.
67+
* `[pre.6]` — Fixes auto-deploy checkbox on server creation causing validation error.
68+
69+
## v0.6.0-pre.6 (Courageous Carniadactylus)
70+
### Fixed
71+
* `[pre.5]` — Console based server rebuild tool now actually rebuilds the servers with the correct information.
72+
* `[pre.5]` — Fixes typo and wrong docker contaienr for certain applications.
73+
74+
### Changed
75+
* Removed all old theme JS and CSS folders to cleanup and avoid confusion in the future.
76+
77+
### Added
78+
* `[pre.5]` — Added foreign key to `pack_id` to ensure nothing eds up breaking there.
79+
680
## v0.6.0-pre.5 (Courageous Carniadactylus)
781
### Changed
882
* New theme applied to Admin CP. Many graphical changes were made, some data was moved around and some display data changed. Too much was changed to feasibly log it all in here. Major breaking changes or notable new features will be logged.
@@ -14,6 +88,7 @@ This project follows [Semantic Versioning](http://semver.org) guidelines.
1488
* Many structural changes to the database and `Pterodactyl\Models` classes that would flood this changelog if they were all included. All required migrations included to handle database changes.
1589
* `[pre.4]` — Service pack files are now stored in the database rather than on the host system to make updates easier.
1690
* Clarified details for database hosts to prevent users entering invalid account details, as well as renamed tables and columns relating to it to keep things clearer.
91+
* Updated all code to be Laravel compliant when using `env()` and moved to using `config()` throughout non `config/*.php` files.
1792

1893
### Fixed
1994
* Fixes potential bug with invalid CIDR notation (ex: `192.168.1.1/z`) when adding allocations that could cause over 4 million records to be created at once.
@@ -24,6 +99,7 @@ This project follows [Semantic Versioning](http://semver.org) guidelines.
2499
* Fixes bug where daemon was unable to register that certain games had fully booted and were ready to play on.
25100
* Fixes bug causing MySQL user accounts to be corrupted when resetting a password via the panel.
26101
* `[pre.4]` — Multiple clients refreshing the console no longer clears the console for all parties involved... sorry about that.
102+
* `[pre.4]` — Fixes bug in environment setting script that would not remeber defaults and try to re-assign values.
27103

28104
### Added
29105
* Ability to assign multiple allocations at once when creating a new server.

app/Console/Commands/AddNode.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function handle()
8383
$selectedLocation = $this->option('location');
8484
}
8585

86-
$this->data['location'] = $locations->where('short', $selectedLocation)->first()->id;
86+
$this->data['location_id'] = $locations->where('short', $selectedLocation)->first()->id;
8787

8888
if (is_null($this->option('fqdn'))) {
8989
$this->line('Please enter domain name (e.g node.example.com) to be used for connecting to the daemon. An IP address may only be used if you are not using SSL for this node.');

app/Console/Commands/ClearTasks.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function __construct()
6464
*/
6565
public function handle()
6666
{
67-
$entries = Models\TaskLog::where('run_time', '<=', Carbon::now()->subHours(env('APP_CLEAR_TASKLOG', 720))->toAtomString())->get();
67+
$entries = Models\TaskLog::where('run_time', '<=', Carbon::now()->subHours(config('pterodactyl.tasks.clear_log'))->toAtomString())->get();
6868

6969
$this->info(sprintf('Preparing to delete %d old task log entries.', count($entries)));
7070
$bar = $this->output->createProgressBar(count($entries));
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
<?php
2+
/**
3+
* Pterodactyl - Panel
4+
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
25+
namespace Pterodactyl\Console\Commands;
26+
27+
use Pterodactyl\Models\Node;
28+
use Pterodactyl\Models\Server;
29+
use Illuminate\Console\Command;
30+
31+
class RebuildServer extends Command
32+
{
33+
/**
34+
* The name and signature of the console command.
35+
*
36+
* @var string
37+
*/
38+
protected $signature = 'pterodactyl:rebuild
39+
{--all}
40+
{--node= : Id of node to rebuild all servers on.}
41+
{--server= : UUID of server to rebuild.}';
42+
43+
/**
44+
* The console command description.
45+
*
46+
* @var string
47+
*/
48+
protected $description = 'Rebuild docker containers for a server or multiple servers.';
49+
50+
/**
51+
* Create a new command instance.
52+
*
53+
* @return void
54+
*/
55+
public function __construct()
56+
{
57+
parent::__construct();
58+
}
59+
60+
/**
61+
* Execute the console command.
62+
*
63+
* @return mixed
64+
*/
65+
public function handle()
66+
{
67+
if ($this->option('all')) {
68+
$servers = Server::all();
69+
} elseif ($this->option('node')) {
70+
$servers = Server::where('node_id', $this->option('node'))->get();
71+
} elseif ($this->option('server')) {
72+
$servers = Server::where('id', $this->option('server'))->get();
73+
} else {
74+
$this->error('You must pass a flag to determine which server(s) to rebuild.');
75+
76+
return;
77+
}
78+
79+
$servers->load('node', 'service', 'option.variables', 'pack');
80+
81+
$this->line('Beginning processing, do not exit this script.');
82+
$bar = $this->output->createProgressBar(count($servers));
83+
$results = collect([]);
84+
foreach ($servers as $server) {
85+
try {
86+
$environment = $server->option->variables->map(function ($item, $key) use ($server) {
87+
$display = $server->variables->where('variable_id', $item->id)->pluck('variable_value')->first();
88+
89+
return [
90+
'variable' => $item->env_variable,
91+
'value' => (! is_null($display)) ? $display : $item->default_value,
92+
];
93+
});
94+
95+
$server->node->guzzleClient([
96+
'X-Access-Server' => $server->uuid,
97+
'X-Access-Token' => $server->node->daemonSecret,
98+
])->request('PATCH', '/server', [
99+
'json' => [
100+
'build' => [
101+
'image' => $server->image,
102+
'env|overwrite' => $environment->pluck('value', 'variable')->merge(['STARTUP' => $server->startup]),
103+
],
104+
'service' => [
105+
'type' => $server->service->folder,
106+
'option' => $server->option->tag,
107+
'pack' => ! is_null($server->pack) ? $server->pack->uuid : null,
108+
],
109+
],
110+
]);
111+
112+
$results = $results->merge([
113+
$server->uuid => [
114+
'status' => 'info',
115+
'messages' => [
116+
'[✓] Processed rebuild request for ' . $server->uuid,
117+
],
118+
],
119+
]);
120+
} catch (\Exception $ex) {
121+
$results = $results->merge([
122+
$server->uuid => [
123+
'status' => 'error',
124+
'messages' => [
125+
'[✗] Failed to process rebuild request for ' . $server->uuid,
126+
$ex->getMessage(),
127+
],
128+
],
129+
]);
130+
}
131+
132+
$bar->advance();
133+
}
134+
135+
$bar->finish();
136+
$console = $this;
137+
138+
$this->line("\n");
139+
$results->each(function ($item, $key) use ($console) {
140+
foreach ($item['messages'] as $line) {
141+
$console->{$item['status']}($line);
142+
}
143+
});
144+
$this->line("\nCompleted rebuild command processing.");
145+
}
146+
}

app/Console/Commands/RunTasks.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
namespace Pterodactyl\Console\Commands;
2626

2727
use Carbon;
28-
use Pterodactyl\Models;
28+
use Pterodactyl\Models\Task;
2929
use Illuminate\Console\Command;
3030
use Pterodactyl\Jobs\SendScheduledTask;
3131
use Illuminate\Foundation\Bus\DispatchesJobs;
@@ -65,14 +65,14 @@ public function __construct()
6565
*/
6666
public function handle()
6767
{
68-
$tasks = Models\Task::where('queued', 0)->where('active', 1)->where('next_run', '<=', Carbon::now()->toAtomString())->get();
68+
$tasks = Task::where('queued', false)->where('active', true)->where('next_run', '<=', Carbon::now()->toAtomString())->get();
6969

7070
$this->info(sprintf('Preparing to queue %d tasks.', count($tasks)));
7171
$bar = $this->output->createProgressBar(count($tasks));
7272

7373
foreach ($tasks as &$task) {
7474
$bar->advance();
75-
$this->dispatch((new SendScheduledTask(Models\Server::findOrFail($task->server), $task))->onQueue(env('QUEUE_LOW', 'low')));
75+
$this->dispatch((new SendScheduledTask($task))->onQueue(config('pterodactyl.queues.low')));
7676
}
7777

7878
$bar->finish();

app/Console/Commands/UpdateEmailSettings.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ public function handle()
100100
'Postmark Transactional Email Service',
101101
],
102102
]);
103+
103104
$variables['MAIL_DRIVER'] = is_null($this->option('driver')) ? $this->choice('Which email driver would you like to use?', [
104105
'smtp',
105106
'mail',
@@ -110,9 +111,9 @@ public function handle()
110111

111112
switch ($variables['MAIL_DRIVER']) {
112113
case 'smtp':
113-
$variables['MAIL_HOST'] = is_null($this->option('host')) ? $this->ask('SMTP Host (e.g smtp.google.com)') : $this->option('host');
114-
$variables['MAIL_PORT'] = is_null($this->option('port')) ? $this->anticipate('SMTP Host Port (e.g 587)', ['587']) : $this->option('port');
115-
$variables['MAIL_USERNAME'] = is_null($this->option('username')) ? $this->ask('SMTP Username') : $this->option('password');
114+
$variables['MAIL_HOST'] = is_null($this->option('host')) ? $this->ask('SMTP Host (e.g smtp.google.com)', config('mail.host')) : $this->option('host');
115+
$variables['MAIL_PORT'] = is_null($this->option('port')) ? $this->anticipate('SMTP Host Port (e.g 587)', ['587', config('mail.port')], config('mail.port')) : $this->option('port');
116+
$variables['MAIL_USERNAME'] = is_null($this->option('username')) ? $this->ask('SMTP Username', config('mail.username')) : $this->option('password');
116117
$variables['MAIL_PASSWORD'] = is_null($this->option('password')) ? $this->secret('SMTP Password') : $this->option('password');
117118
break;
118119
case 'mail':
@@ -128,7 +129,7 @@ public function handle()
128129
$variables['MAIL_DRIVER'] = 'smtp';
129130
$variables['MAIL_HOST'] = 'smtp.postmarkapp.com';
130131
$variables['MAIL_PORT'] = 587;
131-
$variables['MAIL_USERNAME'] = is_null($this->option('username')) ? $this->ask('Postmark API Token') : $this->option('username');
132+
$variables['MAIL_USERNAME'] = is_null($this->option('username')) ? $this->ask('Postmark API Token', config('mail.username')) : $this->option('username');
132133
$variables['MAIL_PASSWORD'] = $variables['MAIL_USERNAME'];
133134
break;
134135
default:
@@ -137,8 +138,9 @@ public function handle()
137138
break;
138139
}
139140

140-
$variables['MAIL_FROM'] = is_null($this->option('email')) ? $this->ask('Email address emails should originate from') : $this->option('email');
141-
$variables['MAIL_FROM_NAME'] = is_null($this->option('from-name')) ? $this->ask('Name emails should appear to be from') : $this->option('from-name');
141+
$variables['MAIL_FROM'] = is_null($this->option('email')) ? $this->ask('Email address emails should originate from', config('mail.from.address')) : $this->option('email');
142+
$variables['MAIL_FROM_NAME'] = is_null($this->option('from-name')) ? $this->ask('Name emails should appear to be from', config('mail.from.name')) : $this->option('from-name');
143+
$variables['MAIL_FROM_NAME'] = '"' . $variables['MAIL_FROM_NAME'] . '"';
142144
$variables['MAIL_ENCRYPTION'] = 'tls';
143145

144146
$bar = $this->output->createProgressBar(count($variables));

0 commit comments

Comments
 (0)