mirror of
https://github.com/pterodactyl/panel.git
synced 2026-12-02 12:25:44 -05:00
Added a configurable panel company/brand logo.
## Extra Details:
- New logo is used for:
- Login page
- Navigation bar
- Page Favicon
- Panel Falls back to the default Ptero logo when no custom one is set.
- Supported File Formats: PNG, JPEG, WebP, AVIF, ICO, and safe SVG
files.
---
## Preview:
<img width="912" height="151"
alt="{67E9647B-AD26-41F8-8272-8B7F4D1CDFB7}"
src="https://github.com/user-attachments/assets/1af9c52b-ad4a-4f82-bb67-14a2b662beb2"
/>
<img width="916" height="256"
alt="{F49323AE-974C-4C16-B129-D60D3494BA0F}"
src="https://github.com/user-attachments/assets/3e35d7f1-c95b-4007-bf1f-69e2ce9891a2"
/>
<img width="1749" height="940"
alt="{252E88D0-BA45-43C8-99E2-5B31E81B739E}"
src="https://github.com/user-attachments/assets/2e807035-bbd0-48ca-823a-4510a9be696e"
/>
<img width="996" height="452" alt="image"
src="https://github.com/user-attachments/assets/c0bef229-285c-4cda-9291-7295e70b2189"
/>
98 lines
4.6 KiB
PHP
98 lines
4.6 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;
|
|
use Pterodactyl\Services\Helpers\BrandingLogoService;
|
|
|
|
#[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',
|
|
],
|
|
'logo' => null,
|
|
'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, logo, mail, advanced, and metadata settings.')]
|
|
#[ScribeResponse(self::SETTINGS_EXAMPLE, description: 'Settings returned.')]
|
|
public function index(GetSettingsRequest $request, BrandingLogoService $brandingLogo): 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'),
|
|
],
|
|
'logo' => $brandingLogo->url(),
|
|
'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'),
|
|
],
|
|
]);
|
|
}
|
|
}
|