Merge branch '1.0-develop' into develop

This commit is contained in:
Matthew Penner 2022-12-12 16:23:11 -07:00
commit 4138fb7497
No known key found for this signature in database
14 changed files with 149 additions and 46 deletions

View file

@ -67,12 +67,6 @@ class EmailSettingsCommand extends Command
$this->config->get('mail.from.name')
);
$this->variables['MAIL_ENCRYPTION'] = $this->option('encryption') ?? $this->choice(
trans('command/messages.environment.mail.ask_encryption'),
['tls' => 'TLS', 'ssl' => 'SSL', '' => 'None'],
$this->config->get('mail.encryption', 'tls')
);
$this->writeToEnvironment($this->variables);
$this->line('Updating stored environment configuration file.');
@ -102,6 +96,12 @@ class EmailSettingsCommand extends Command
$this->variables['MAIL_PASSWORD'] = $this->option('password') ?? $this->secret(
trans('command/messages.environment.mail.ask_smtp_password')
);
$this->variables['MAIL_ENCRYPTION'] = $this->option('encryption') ?? $this->choice(
trans('command/messages.environment.mail.ask_encryption'),
['tls' => 'TLS', 'ssl' => 'SSL', '' => 'None'],
$this->config->get('mail.mailers.smtp.encryption', 'tls')
);
}
/**

View file

@ -54,8 +54,8 @@ class MailController extends Controller
}
$values = $request->normalize();
if (array_get($values, 'mail:password') === '!e') {
$values['mail:password'] = '';
if (array_get($values, 'mail:mailers:smtp:password') === '!e') {
$values['mail:mailers:smtp:password'] = '';
}
foreach ($values as $key => $value) {

View file

@ -13,11 +13,11 @@ class MailSettingsFormRequest extends AdminFormRequest
public function rules(): array
{
return [
'mail:host' => 'required|string',
'mail:port' => 'required|integer|between:1,65535',
'mail:encryption' => ['present', Rule::in([null, 'tls', 'ssl'])],
'mail:username' => 'nullable|string|max:191',
'mail:password' => 'nullable|string|max:191',
'mail:mailers:smtp:host' => 'required|string',
'mail:mailers:smtp:port' => 'required|integer|between:1,65535',
'mail:mailers:smtp:encryption' => ['present', Rule::in([null, 'tls', 'ssl'])],
'mail:mailers:smtp:username' => 'nullable|string|max:191',
'mail:mailers:smtp:password' => 'nullable|string|max:191',
'mail:from:address' => 'required|string|email',
'mail:from:name' => 'nullable|string|max:191',
];
@ -31,8 +31,8 @@ class MailSettingsFormRequest extends AdminFormRequest
{
$keys = array_flip(array_keys($this->rules()));
if (empty($this->input('mail:password'))) {
unset($keys['mail:password']);
if (empty($this->input('mail:mailers:smtp:password'))) {
unset($keys['mail:mailers:smtp:password']);
}
return $this->only(array_flip($keys));

View file

@ -2,7 +2,13 @@
namespace Pterodactyl\Models;
/** @property string $value */
/**
* Pterodactyl\Models\Setting.
*
* @property int $id
* @property string $key
* @property string $value
*/
class Setting extends Model
{
/**

View file

@ -37,13 +37,13 @@ class SettingsServiceProvider extends ServiceProvider
* when using the SMTP driver.
*/
protected array $emailKeys = [
'mail:host',
'mail:port',
'mail:mailers:smtp:host',
'mail:mailers:smtp:port',
'mail:mailers:smtp:encryption',
'mail:mailers:smtp:username',
'mail:mailers:smtp:password',
'mail:from:address',
'mail:from:name',
'mail:encryption',
'mail:username',
'mail:password',
];
/**
@ -51,7 +51,7 @@ class SettingsServiceProvider extends ServiceProvider
* configuration array.
*/
protected static array $encrypted = [
'mail:password',
'mail:mailers:smtp:password',
];
/**

View file

@ -231,6 +231,9 @@ class DaemonFileRepository extends DaemonRepository
'root' => $root ?? '/',
'file' => $file,
],
// Wait for up to 15 minutes for the decompress to be completed when calling this endpoint
// since it will likely take quite awhile for large directories.
'timeout' => 60 * 15,
]
);
} catch (TransferException $exception) {

View file

@ -140,10 +140,12 @@ class TelemetryCollectionService
'eggs' => [
'count' => Egg::count(),
'server_usage' => Egg::all()
->flatMap(fn (Egg $egg) => [$egg->uuid => $egg->servers->count()])
->filter(fn (int $count) => $count > 0)
->toArray(),
// Egg UUIDs are generated randomly on import, so there is not a consistent way to
// determine if servers are using default eggs or not.
// 'server_usage' => Egg::all()
// ->flatMap(fn (Egg $egg) => [$egg->uuid => $egg->servers->count()])
// ->filter(fn (int $count) => $count > 0)
// ->toArray(),
],
'locations' => [
@ -156,10 +158,12 @@ class TelemetryCollectionService
'nests' => [
'count' => Nest::count(),
'server_usage' => Nest::all()
->flatMap(fn (Nest $nest) => [$nest->uuid => $nest->eggs->sum(fn (Egg $egg) => $egg->servers->count())])
->filter(fn (int $count) => $count > 0)
->toArray(),
// Nest UUIDs are generated randomly on import, so there is not a consistent way to
// determine if servers are using default eggs or not.
// 'server_usage' => Nest::all()
// ->flatMap(fn (Nest $nest) => [$nest->uuid => $nest->eggs->sum(fn (Egg $egg) => $egg->servers->count())])
// ->filter(fn (int $count) => $count > 0)
// ->toArray(),
],
'nodes' => [