mirror of
https://github.com/pterodactyl/panel.git
synced 2026-12-01 11:55:51 -05:00
Added custom user avatar support.
## Extra Details:
- Users can upload custom `PNG, JPEG, SVG, WebP, AVIF`, and `ICO`
avatars.
- Added avatar management to the user account area.
- Added admin controls to update and remove user avatars.
- Custom User avatars appear in:
- Panel Navbar.
- Panel Admin Activity Logs.
- Server Sub user List.
- Server Activity Logs
- Personal Account Activity Logs.
- Server Ownership Details.
---
<img width="1329" height="327"
alt="{B32EBD7F-1FCA-4356-966C-0D60A9A23E49}"
src="https://github.com/user-attachments/assets/881fa5b3-9599-4370-975d-83b6bd91a7d1"
/>
---
<img width="997" height="847" alt="adminpage"
src="https://github.com/user-attachments/assets/989acbcc-351c-431b-ab7f-557ba4c7e070"
/>
---
<img width="955" height="781" alt="serverinfo"
src="https://github.com/user-attachments/assets/6556afac-1971-4112-9686-b71137072c5f"
/>
---
<img width="1376" height="919" alt="userarea"
src="https://github.com/user-attachments/assets/d49f0ddb-1f38-4884-b186-8db78bfed4b0"
/>
---
<img width="936" height="232" alt="userslist"
src="https://github.com/user-attachments/assets/0e8a4b4a-719a-4d52-a485-d7577736b43f"
/>
---
<img width="983" height="772" alt="activity"
src="https://github.com/user-attachments/assets/37ef7176-a804-43f7-ae32-ae65e1a2671b"
/>
95 lines
4.5 KiB
PHP
95 lines
4.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Pterodactyl\Http\Controllers\Api\Admin\Settings;
|
|
|
|
use Illuminate\Http\JsonResponse;
|
|
use Knuckles\Scribe\Attributes\Endpoint;
|
|
use Knuckles\Scribe\Attributes\Group;
|
|
use Knuckles\Scribe\Attributes\Response as ScribeResponse;
|
|
use Knuckles\Scribe\Attributes\Subgroup;
|
|
use Pterodactyl\Http\Controllers\Api\Admin\AdminApiController;
|
|
use Pterodactyl\Http\Requests\Api\Admin\Settings\GetSettingsRequest;
|
|
|
|
#[Group('Admin API', 'Root administrator endpoints for managing panel configuration and resources.')]
|
|
#[Subgroup('Settings', 'View and update global panel settings.')]
|
|
class SettingsController extends AdminApiController
|
|
{
|
|
private const array SETTINGS_EXAMPLE = [
|
|
'general' => [
|
|
'app:name' => 'Pterodactyl',
|
|
'pterodactyl:auth:2fa_required' => 0,
|
|
'pterodactyl:client_features:avatars:enabled' => false,
|
|
'app:locale' => 'en',
|
|
],
|
|
'mail' => [
|
|
'mail:default' => 'smtp',
|
|
'mail:mailers:smtp:host' => 'mail.example.com',
|
|
'mail:mailers:smtp:port' => 587,
|
|
'mail:mailers:smtp:encryption' => 'tls',
|
|
'mail:mailers:smtp:username' => 'panel@example.com',
|
|
'mail:mailers:smtp:password' => '',
|
|
'mail:from:address' => 'panel@example.com',
|
|
'mail:from:name' => 'Pterodactyl',
|
|
],
|
|
'advanced' => [
|
|
'recaptcha:enabled' => false,
|
|
'recaptcha:secret_key' => '',
|
|
'recaptcha:website_key' => 'website',
|
|
'pterodactyl:guzzle:timeout' => 15,
|
|
'pterodactyl:guzzle:connect_timeout' => 5,
|
|
'pterodactyl:client_features:allocations:enabled' => false,
|
|
'pterodactyl:client_features:allocations:range_start' => null,
|
|
'pterodactyl:client_features:allocations:range_end' => null,
|
|
],
|
|
'meta' => [
|
|
'load_environment_only' => false,
|
|
'show_recaptcha_warning' => false,
|
|
],
|
|
];
|
|
|
|
/**
|
|
* Return current panel settings.
|
|
*/
|
|
#[Endpoint('Get settings', 'Returns current general, mail, advanced, and metadata settings.')]
|
|
#[ScribeResponse(self::SETTINGS_EXAMPLE, description: 'Settings returned.')]
|
|
public function index(GetSettingsRequest $request): JsonResponse
|
|
{
|
|
return new JsonResponse([
|
|
'general' => [
|
|
'app:name' => config('app.name'),
|
|
'pterodactyl:auth:2fa_required' => config('pterodactyl.auth.2fa_required'),
|
|
'pterodactyl:client_features:avatars:enabled' => config('pterodactyl.client_features.avatars.enabled'),
|
|
'app:locale' => config('app.locale'),
|
|
],
|
|
'mail' => [
|
|
'mail:default' => config('mail.default'),
|
|
'mail:mailers:smtp:host' => config('mail.mailers.smtp.host'),
|
|
'mail:mailers:smtp:port' => config('mail.mailers.smtp.port'),
|
|
'mail:mailers:smtp:encryption' => config('mail.mailers.smtp.encryption'),
|
|
'mail:mailers:smtp:username' => config('mail.mailers.smtp.username'),
|
|
// Never return the SMTP password to the client.
|
|
'mail:mailers:smtp:password' => '',
|
|
'mail:from:address' => config('mail.from.address'),
|
|
'mail:from:name' => config('mail.from.name'),
|
|
],
|
|
'advanced' => [
|
|
'recaptcha:enabled' => config('recaptcha.enabled'),
|
|
'recaptcha:secret_key' => '',
|
|
'recaptcha:website_key' => config('recaptcha.website_key'),
|
|
'pterodactyl:guzzle:timeout' => config('pterodactyl.guzzle.timeout'),
|
|
'pterodactyl:guzzle:connect_timeout' => config('pterodactyl.guzzle.connect_timeout'),
|
|
'pterodactyl:client_features:allocations:enabled' => config('pterodactyl.client_features.allocations.enabled'),
|
|
'pterodactyl:client_features:allocations:range_start' => config('pterodactyl.client_features.allocations.range_start'),
|
|
'pterodactyl:client_features:allocations:range_end' => config('pterodactyl.client_features.allocations.range_end'),
|
|
],
|
|
'meta' => [
|
|
'load_environment_only' => config('pterodactyl.load_environment_only'),
|
|
'show_recaptcha_warning' => config('recaptcha._shipped_secret_key') === config('recaptcha.secret_key')
|
|
|| config('recaptcha._shipped_website_key') === config('recaptcha.website_key'),
|
|
],
|
|
]);
|
|
}
|
|
}
|