diff --git a/app/Console/Commands/AddNode.php b/app/Console/Commands/AddNode.php index 4b4468422..0aac540c0 100644 --- a/app/Console/Commands/AddNode.php +++ b/app/Console/Commands/AddNode.php @@ -83,7 +83,7 @@ class AddNode extends Command $selectedLocation = $this->option('location'); } - $this->data['location'] = $locations->where('short', $selectedLocation)->first()->id; + $this->data['location_id'] = $locations->where('short', $selectedLocation)->first()->id; if (is_null($this->option('fqdn'))) { $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.'); diff --git a/app/Console/Commands/ClearTasks.php b/app/Console/Commands/ClearTasks.php index 26f0da761..569caf028 100644 --- a/app/Console/Commands/ClearTasks.php +++ b/app/Console/Commands/ClearTasks.php @@ -64,7 +64,7 @@ class ClearTasks extends Command */ public function handle() { - $entries = Models\TaskLog::where('run_time', '<=', Carbon::now()->subHours(env('APP_CLEAR_TASKLOG', 720))->toAtomString())->get(); + $entries = Models\TaskLog::where('run_time', '<=', Carbon::now()->subHours(config('pterodactyl.tasks.clear_log'))->toAtomString())->get(); $this->info(sprintf('Preparing to delete %d old task log entries.', count($entries))); $bar = $this->output->createProgressBar(count($entries)); diff --git a/app/Console/Commands/RunTasks.php b/app/Console/Commands/RunTasks.php index 7807f8dbd..9524bb54a 100644 --- a/app/Console/Commands/RunTasks.php +++ b/app/Console/Commands/RunTasks.php @@ -72,7 +72,7 @@ class RunTasks extends Command foreach ($tasks as &$task) { $bar->advance(); - $this->dispatch((new SendScheduledTask(Models\Server::findOrFail($task->server), $task))->onQueue(env('QUEUE_LOW', 'low'))); + $this->dispatch((new SendScheduledTask(Models\Server::findOrFail($task->server), $task))->onQueue(config('pterodactyl.queues.low'))); } $bar->finish(); diff --git a/app/Console/Commands/UpdateEmailSettings.php b/app/Console/Commands/UpdateEmailSettings.php index fabfa469d..679d94ee7 100644 --- a/app/Console/Commands/UpdateEmailSettings.php +++ b/app/Console/Commands/UpdateEmailSettings.php @@ -100,6 +100,7 @@ class UpdateEmailSettings extends Command 'Postmark Transactional Email Service', ], ]); + $variables['MAIL_DRIVER'] = is_null($this->option('driver')) ? $this->choice('Which email driver would you like to use?', [ 'smtp', 'mail', @@ -110,9 +111,9 @@ class UpdateEmailSettings extends Command switch ($variables['MAIL_DRIVER']) { case 'smtp': - $variables['MAIL_HOST'] = is_null($this->option('host')) ? $this->ask('SMTP Host (e.g smtp.google.com)') : $this->option('host'); - $variables['MAIL_PORT'] = is_null($this->option('port')) ? $this->anticipate('SMTP Host Port (e.g 587)', ['587']) : $this->option('port'); - $variables['MAIL_USERNAME'] = is_null($this->option('username')) ? $this->ask('SMTP Username') : $this->option('password'); + $variables['MAIL_HOST'] = is_null($this->option('host')) ? $this->ask('SMTP Host (e.g smtp.google.com)', config('mail.host')) : $this->option('host'); + $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'); + $variables['MAIL_USERNAME'] = is_null($this->option('username')) ? $this->ask('SMTP Username', config('mail.username')) : $this->option('password'); $variables['MAIL_PASSWORD'] = is_null($this->option('password')) ? $this->secret('SMTP Password') : $this->option('password'); break; case 'mail': @@ -128,7 +129,7 @@ class UpdateEmailSettings extends Command $variables['MAIL_DRIVER'] = 'smtp'; $variables['MAIL_HOST'] = 'smtp.postmarkapp.com'; $variables['MAIL_PORT'] = 587; - $variables['MAIL_USERNAME'] = is_null($this->option('username')) ? $this->ask('Postmark API Token') : $this->option('username'); + $variables['MAIL_USERNAME'] = is_null($this->option('username')) ? $this->ask('Postmark API Token', config('mail.username')) : $this->option('username'); $variables['MAIL_PASSWORD'] = $variables['MAIL_USERNAME']; break; default: @@ -137,8 +138,9 @@ class UpdateEmailSettings extends Command break; } - $variables['MAIL_FROM'] = is_null($this->option('email')) ? $this->ask('Email address emails should originate from') : $this->option('email'); - $variables['MAIL_FROM_NAME'] = is_null($this->option('from-name')) ? $this->ask('Name emails should appear to be from') : $this->option('from-name'); + $variables['MAIL_FROM'] = is_null($this->option('email')) ? $this->ask('Email address emails should originate from', config('mail.from.address')) : $this->option('email'); + $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'); + $variables['MAIL_FROM_NAME'] = '"' . $variables['MAIL_FROM_NAME'] . '"'; $variables['MAIL_ENCRYPTION'] = 'tls'; $bar = $this->output->createProgressBar(count($variables)); diff --git a/app/Console/Commands/UpdateEnvironment.php b/app/Console/Commands/UpdateEnvironment.php index aa3dcfe7f..c9e1ea4ef 100644 --- a/app/Console/Commands/UpdateEnvironment.php +++ b/app/Console/Commands/UpdateEnvironment.php @@ -77,39 +77,31 @@ class UpdateEnvironment extends Command $envContents = file_get_contents($file); $this->info('Simply leave blank and press enter to fields that you do not wish to update.'); - if (! env('SERVICE_AUTHOR', false)) { + if (is_null(config('pterodactyl.service.author', null))) { $this->info('No service author set, setting one now.'); - $variables['SERVICE_AUTHOR'] = env('SERVICE_AUTHOR', (string) Uuid::generate(4)); - } - - if (! env('QUEUE_STANDARD', false) || ! env('QUEUE_DRIVER', false)) { - $this->info('Setting default queue settings.'); - $variables['QUEUE_DRIVER'] = env('QUEUE_DRIVER', 'database'); - $variables['QUEUE_HIGH'] = env('QUEUE_HIGH', 'high'); - $variables['QUEUE_STANDARD'] = env('QUEUE_STANDARD', 'standard'); - $variables['QUEUE_LOW'] = env('QUEUE_LOW', 'low'); + $variables['SERVICE_AUTHOR'] = (string) Uuid::generate(4); } if (is_null($this->option('dbhost'))) { - $variables['DB_HOST'] = $this->anticipate('Database Host', ['localhost', '127.0.0.1', env('DB_HOST')], env('DB_HOST')); + $variables['DB_HOST'] = $this->anticipate('Database Host', ['localhost', '127.0.0.1', config('database.connections.mysql.host')], config('database.connections.mysql.host')); } else { $variables['DB_HOST'] = $this->option('dbhost'); } if (is_null($this->option('dbport'))) { - $variables['DB_PORT'] = $this->anticipate('Database Port', [3306, env('DB_PORT')], env('DB_PORT')); + $variables['DB_PORT'] = $this->anticipate('Database Port', [3306, config('database.connections.mysql.port')], config('database.connections.mysql.port')); } else { $variables['DB_PORT'] = $this->option('dbport'); } if (is_null($this->option('dbname'))) { - $variables['DB_DATABASE'] = $this->anticipate('Database Name', ['pterodactyl', 'homestead', ENV('DB_DATABASE')], env('DB_DATABASE')); + $variables['DB_DATABASE'] = $this->anticipate('Database Name', ['pterodactyl', 'homestead', config('database.connections.mysql.database')], config('database.connections.mysql.database')); } else { $variables['DB_DATABASE'] = $this->option('dbname'); } if (is_null($this->option('dbuser'))) { - $variables['DB_USERNAME'] = $this->anticipate('Database Username', [ENV('DB_DATABASE')], env('DB_USERNAME')); + $variables['DB_USERNAME'] = $this->anticipate('Database Username', [config('database.connections.mysql.username')], config('database.connections.mysql.username')); } else { $variables['DB_USERNAME'] = $this->option('dbuser'); } @@ -122,25 +114,23 @@ class UpdateEnvironment extends Command } if (is_null($this->option('url'))) { - $variables['APP_URL'] = $this->ask('Panel URL (include http(s)://)', env('APP_URL')); + $variables['APP_URL'] = $this->ask('Panel URL (include http(s)://)', config('app.url')); } else { $variables['APP_URL'] = $this->option('url'); } if (is_null($this->option('timezone'))) { $this->line('The timezone should match one of the supported timezones according to http://php.net/manual/en/timezones.php'); - $variables['APP_TIMEZONE'] = $this->anticipate('Panel Timezone', \DateTimeZone::listIdentifiers(\DateTimeZone::ALL), env('APP_TIMEZONE')); + $variables['APP_TIMEZONE'] = $this->anticipate('Panel Timezone', \DateTimeZone::listIdentifiers(\DateTimeZone::ALL), config('app.timezone')); } else { $variables['APP_TIMEZONE'] = $this->option('timezone'); } - $variables['APP_THEME'] = 'pterodactyl'; $variables['CACHE_DRIVER'] = 'memcached'; $variables['SESSION_DRIVER'] = 'database'; $bar = $this->output->createProgressBar(count($variables)); - $this->line('Writing new environment configuration to file.'); foreach ($variables as $key => $value) { $newValue = $key . '=' . $value; @@ -155,8 +145,7 @@ class UpdateEnvironment extends Command file_put_contents($file, $envContents); $bar->finish(); - $this->line('Updating evironment configuration cache file.'); $this->call('config:cache'); - echo "\n"; + $this->line("\n"); } } diff --git a/app/Http/Controllers/Admin/BaseController.php b/app/Http/Controllers/Admin/BaseController.php index 0f54a8ee6..cd4b177c9 100644 --- a/app/Http/Controllers/Admin/BaseController.php +++ b/app/Http/Controllers/Admin/BaseController.php @@ -32,14 +32,6 @@ use Pterodactyl\Http\Controllers\Controller; class BaseController extends Controller { - /** - * Controller Constructor. - */ - public function __construct() - { - // - } - public function getIndex(Request $request) { return view('admin.index'); @@ -55,8 +47,6 @@ class BaseController extends Controller $validator = Validator::make($request->all(), [ 'company' => 'required|between:1,256', 'default_language' => 'required|alpha_dash|min:2|max:5', - 'email_from' => 'required|email', - 'email_sender_name' => 'required|between:1,256', ]); if ($validator->fails()) { @@ -65,8 +55,6 @@ class BaseController extends Controller Settings::set('company', $request->input('company')); Settings::set('default_language', $request->input('default_language')); - Settings::set('email_from', $request->input('email_from')); - Settings::set('email_sender_name', $request->input('email_sender_name')); Alert::success('Settings have been successfully updated.')->flash(); diff --git a/app/Observers/ServerObserver.php b/app/Observers/ServerObserver.php index 92d1b8f9a..2229154e3 100644 --- a/app/Observers/ServerObserver.php +++ b/app/Observers/ServerObserver.php @@ -79,7 +79,7 @@ class ServerObserver { event(new Events\Server\Deleting($server)); - $this->dispatch((new SuspendServer($server->id))->onQueue(env('QUEUE_HIGH', 'high'))); + $this->dispatch((new SuspendServer($server->id))->onQueue(config('pterodactyl.queues.high'))); } /** @@ -94,8 +94,8 @@ class ServerObserver $this->dispatch( (new DeleteServer($server->id)) - ->delay(Carbon::now()->addMinutes(env('APP_DELETE_MINUTES', 10))) - ->onQueue(env('QUEUE_STANDARD', 'standard')) + ->delay(Carbon::now()->addMinutes(config('pterodactyl.tasks.delete_server'))) + ->onQueue(config('pterodactyl.queues.standard')) ); } diff --git a/app/Services/VersionService.php b/app/Services/VersionService.php index dea0bb16d..819bf4755 100644 --- a/app/Services/VersionService.php +++ b/app/Services/VersionService.php @@ -36,11 +36,11 @@ class VersionService */ public function __construct() { - self::$versions = Cache::remember('versions', env('VERSION_CACHE_TIME', 60), function () { + self::$versions = Cache::remember('versions', config('pterodactyl.cdn.cache'), function () { $client = new Client(); try { - $response = $client->request('GET', env('VERSION_CHECK_URL', 'https://cdn.pterodactyl.io/releases/latest.json')); + $response = $client->request('GET', config('pterodactyl.cdn.url')); if ($response->getStatusCode() === 200) { return json_decode($response->getBody()); @@ -52,7 +52,7 @@ class VersionService return (object) [ 'panel' => 'error', 'daemon' => 'error', - 'discord' => 'https://pterodactyl.io', + 'discord' => 'https://pterodactyl.io/discord', ]; } }); diff --git a/config/database.php b/config/database.php index 420cd6184..5a6e63f33 100644 --- a/config/database.php +++ b/config/database.php @@ -46,12 +46,6 @@ return [ 'connections' => [ - 'sqlite' => [ - 'driver' => 'sqlite', - 'database' => storage_path('database.sqlite'), - 'prefix' => '', - ], - 'mysql' => [ 'driver' => 'mysql', 'host' => env('DB_HOST', 'localhost'), @@ -65,27 +59,6 @@ return [ 'strict' => false, ], - 'pgsql' => [ - 'driver' => 'pgsql', - 'host' => env('DB_HOST', 'localhost'), - 'database' => env('DB_DATABASE', 'forge'), - 'username' => env('DB_USERNAME', 'forge'), - 'password' => env('DB_PASSWORD', ''), - 'charset' => 'utf8', - 'prefix' => '', - 'schema' => 'public', - ], - - 'sqlsrv' => [ - 'driver' => 'sqlsrv', - 'host' => env('DB_HOST', 'localhost'), - 'database' => env('DB_DATABASE', 'forge'), - 'username' => env('DB_USERNAME', 'forge'), - 'password' => env('DB_PASSWORD', ''), - 'charset' => 'utf8', - 'prefix' => '', - ], - ], /* diff --git a/config/pterodactyl.php b/config/pterodactyl.php index 1b946c6a3..83e7270ae 100644 --- a/config/pterodactyl.php +++ b/config/pterodactyl.php @@ -42,4 +42,41 @@ return [ 'connect_timeout' => env('GUZZLE_CONNECT_TIMEOUT', 3), ], + /* + |-------------------------------------------------------------------------- + | Queue Names + |-------------------------------------------------------------------------- + | + | Configure the names of queues to be used in the database. + */ + 'queues' => [ + 'low' => env('QUEUE_LOW', 'low'), + 'standard' => env('QUEUE_STANDARD', 'standard'), + 'high' => env('QUEUE_HIGH', 'high'), + ], + + /* + |-------------------------------------------------------------------------- + | Task Timers + |-------------------------------------------------------------------------- + | + | The amount of time in minutes before performing certain actions on the system. + */ + 'tasks' => [ + 'clear_log' => env('PTERODACTYL_CLEAR_TASKLOG', 720), + 'delete_server' => env('PTERODACTYL_DELETE_MINUTES', 10), + ], + + /* + |-------------------------------------------------------------------------- + | CDN + |-------------------------------------------------------------------------- + | + | Information for the panel to use when contacting the CDN to confirm + | if panel is up to date. + */ + 'cdn' => [ + 'cache' => 60, + 'url' => 'https://cdn.pterodactyl.io/releases/latest.json', + ], ]; diff --git a/config/themes.php b/config/themes.php index 03a0b6155..f90a29f68 100644 --- a/config/themes.php +++ b/config/themes.php @@ -4,14 +4,9 @@ return [ 'enabled' => true, 'themes_path' => realpath(base_path('resources/themes')), 'asset_not_found' => 'LOG_ERROR', - 'active' => ENV('APP_THEME', 'default'), + 'active' => env('APP_THEME', 'pterodactyl'), 'themes' => [ - 'default' => [ - 'extends' => null, - 'views-path' => 'default', - 'asset-path' => 'themes/default', - ], 'pterodactyl' => [ 'extends' => null, 'views-path' => 'pterodactyl', diff --git a/resources/themes/pterodactyl/admin/servers/view/delete.blade.php b/resources/themes/pterodactyl/admin/servers/view/delete.blade.php index 5a0cfe297..e294b6443 100644 --- a/resources/themes/pterodactyl/admin/servers/view/delete.blade.php +++ b/resources/themes/pterodactyl/admin/servers/view/delete.blade.php @@ -61,7 +61,7 @@
This server is currently marked for deletion by the system {{ Carbon::parse($server->deleted_at)->addMinutes(env('APP_DELETE_MINUTES', 10))->diffForHumans() }}.
+This server is currently marked for deletion by the system {{ Carbon::parse($server->deleted_at)->addMinutes(config('pterodactyl.tasks.delete_server'))->diffForHumans() }}.
Deleting a server is an irreversible action. All server data (including files and users) will be removed from the system.
.env
file in this project's root folder.The email address that panel emails will be sent from. Note that some SMTP services require this to match for a given API key.
-The name that emails will appear to come from.
-php artisan pterodactyl:mail
in this project's root folder.