diff --git a/.gitignore b/.gitignore
index e0865a5d4..4024bbde7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,6 @@
/.phpunit.cache
/node_modules
/public/build
-/public/hot
/public/storage
/storage/*.key
/storage/pail
diff --git a/Dockerfile b/Dockerfile
index f07367734..ccc06a934 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -75,14 +75,15 @@ RUN chown root:www-data ./ \
&& chmod 750 ./ \
# Files should not have execute set, but directories need it
&& find ./ -type d -exec chmod 750 {} \; \
- # Create necessary directories
+ # Create necessary directories
&& mkdir -p /pelican-data/storage /var/www/html/storage/app/public /var/run/supervisord /etc/supercronic \
# Symlinks for env, database, and avatars
&& ln -s /pelican-data/.env ./.env \
&& ln -s /pelican-data/database/database.sqlite ./database/database.sqlite \
&& ln -sf /var/www/html/storage/app/public /var/www/html/public/storage \
&& ln -s /pelican-data/storage/avatars /var/www/html/storage/app/public/avatars \
- # Allow www-data write permissions where necessary
+ && ln -s /pelican-data/storage/fonts /var/www/html/storage/app/public/fonts \
+ # Allow www-data write permissions where necessary
&& chown -R www-data:www-data /pelican-data ./storage ./bootstrap/cache /var/run/supervisord /var/www/html/public/storage \
&& chmod -R u+rwX,g+rwX,o-rwx /pelican-data ./storage ./bootstrap/cache /var/run/supervisord
diff --git a/app/Filament/Admin/Pages/Settings.php b/app/Filament/Admin/Pages/Settings.php
index 78803125c..f0eda16e4 100644
--- a/app/Filament/Admin/Pages/Settings.php
+++ b/app/Filament/Admin/Pages/Settings.php
@@ -13,6 +13,7 @@ use Filament\Actions\Action;
use Filament\Forms\Components\Actions;
use Filament\Forms\Components\Actions\Action as FormAction;
use Filament\Forms\Components\Component;
+use Filament\Forms\Components\FileUpload;
use Filament\Forms\Components\Group;
use Filament\Forms\Components\Hidden;
use Filament\Forms\Components\Section;
@@ -724,10 +725,17 @@ class Settings extends Page implements HasForms
->onColor('success')
->offColor('danger')
->live()
- ->columnSpanFull()
+ ->columnSpan(1)
->formatStateUsing(fn ($state): bool => (bool) $state)
->afterStateUpdated(fn ($state, Set $set) => $set('PANEL_EDITABLE_SERVER_DESCRIPTIONS', (bool) $state))
->default(env('PANEL_EDITABLE_SERVER_DESCRIPTIONS', config('panel.editable_server_descriptions'))),
+ FileUpload::make('ConsoleFonts')
+ ->hint(trans('admin/setting.misc.server.console_font_hint'))
+ ->label(trans('admin/setting.misc.server.console_font_upload'))
+ ->directory('fonts')
+ ->columnSpan(1)
+ ->maxFiles(1)
+ ->preserveFilenames(),
]),
Section::make(trans('admin/setting.misc.webhook.title'))
->description(trans('admin/setting.misc.webhook.helper'))
@@ -756,6 +764,7 @@ class Settings extends Page implements HasForms
{
try {
$data = $this->form->getState();
+ unset($data['ConsoleFonts']);
// Convert bools to a string, so they are correctly written to the .env file
$data = array_map(fn ($value) => is_bool($value) ? ($value ? 'true' : 'false') : $value, $data);
diff --git a/app/Filament/Pages/Auth/EditProfile.php b/app/Filament/Pages/Auth/EditProfile.php
index 4b167bf53..d0243fff9 100644
--- a/app/Filament/Pages/Auth/EditProfile.php
+++ b/app/Filament/Pages/Auth/EditProfile.php
@@ -373,10 +373,35 @@ class EditProfile extends BaseEditProfile
->required()
->columnSpan(1)
->default(30),
- // Select::make('console_font')
- // ->label(trans('profile.font'))
- // ->hidden() //TODO
- // ->columnSpan(1),
+ Select::make('console_font')
+ ->label(trans('profile.font'))
+ ->options(fn () => get_fonts(storage_path('app\public\fonts')))
+ ->reactive()
+ ->afterStateUpdated(fn ($state, callable $set) => $set('font_preview', $state)),
+ Placeholder::make('font_preview')
+ ->label('Preview')
+ ->content(function (Get $get) {
+ $fontName = $get('console_font') ?? 'No font selected.';
+
+ $fontUrl = asset("fonts/{$fontName}.ttf");
+ $fontSize = $get('console_font_size') . 'px';
+
+ return new HtmlString(<<
+ @font-face {
+ font-family: "CustomPreviewFont";
+ src: url("$fontUrl");
+ }
+ .preview-text {
+ font-family: "CustomPreviewFont";
+ font-size: $fontSize;
+ margin-top: 10px;
+ display: block;
+ }
+
+ The quick blue pelican jumps over the lazy pterodactyl. :)
+ HTML);
+ }),
TextInput::make('console_font_size')
->label(trans('profile.font_size'))
->columnSpan(1)
@@ -446,12 +471,13 @@ class EditProfile extends BaseEditProfile
protected function mutateFormDataBeforeSave(array $data): array
{
$moarbetterdata = [
+ 'console_font' => $data['console_font'],
'console_font_size' => $data['console_font_size'],
'console_rows' => $data['console_rows'],
'dashboard_layout' => $data['dashboard_layout'],
];
- unset($data['dashboard_layout'], $data['console_font_size'], $data['console_rows']);
+ unset($data['console_font'],$data['console_font_size'], $data['console_rows'], $data['dashboard_layout']);
$data['customization'] = json_encode($moarbetterdata);
return $data;
@@ -461,6 +487,7 @@ class EditProfile extends BaseEditProfile
{
$moarbetterdata = json_decode($data['customization'], true);
+ $data['console_font'] = $moarbetterdata['console_font'] ?? 'ComicMono';
$data['console_font_size'] = $moarbetterdata['console_font_size'] ?? 14;
$data['console_rows'] = $moarbetterdata['console_rows'] ?? 30;
$data['dashboard_layout'] = $moarbetterdata['dashboard_layout'] ?? 'grid';
diff --git a/app/helpers.php b/app/helpers.php
index 0fe63c7a5..2c02054dd 100644
--- a/app/helpers.php
+++ b/app/helpers.php
@@ -67,3 +67,17 @@ if (!function_exists('resolve_path')) {
return implode('/', $absolutes);
}
}
+
+if (!function_exists('get_fonts')) {
+ /**
+ * @return array
+ */
+ function get_fonts(?string $directory = null): array
+ {
+ $directory ??= public_path('fonts');
+
+ return collect(glob($directory . '/*.ttf', GLOB_BRACE) ?: [])
+ ->mapWithKeys(fn ($file) => [$name = pathinfo($file, PATHINFO_FILENAME) => $name])
+ ->all();
+ }
+}
diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh
index 0dd8d2e29..1089ea539 100644
--- a/docker/entrypoint.sh
+++ b/docker/entrypoint.sh
@@ -23,7 +23,7 @@ else
echo -e "APP_INSTALLED=false" >> /pelican-data/.env
fi
-mkdir -p /pelican-data/database /pelican-data/storage/avatars /var/www/html/storage/logs/supervisord 2>/dev/null
+mkdir -p /pelican-data/database /pelican-data/storage/avatars /pelican-data/storage/fonts /var/www/html/storage/logs/supervisord 2>/dev/null
if ! grep -q "APP_KEY=" .env || grep -q "APP_KEY=$" .env; then
echo "Generating APP_KEY..."
diff --git a/lang/en/admin/setting.php b/lang/en/admin/setting.php
index 969dab597..9f0ee01be 100644
--- a/lang/en/admin/setting.php
+++ b/lang/en/admin/setting.php
@@ -137,6 +137,8 @@ return [
'title' => 'Servers',
'helper' => 'Settings for Servers',
'edit_server_desc' => 'Allow Users to edit Descriptions?',
+ 'console_font_upload' => 'Console Font Upload',
+ 'console_font_hint' => 'Only *.ttf fonts are supported. Mono fonts strongly recommended!',
],
'webhook' => [
'title' => 'Webhooks',
diff --git a/public/css/filament/server/console.css b/public/css/filament/server/console.css
index a95de40e5..51c2d8957 100644
--- a/public/css/filament/server/console.css
+++ b/public/css/filament/server/console.css
@@ -48,15 +48,3 @@
::-webkit-scrollbar-corner {
background: transparent;
}
-
-@font-face {
- font-family: Comic Mono;
- font-weight: normal;
- src: url('/fonts/ComicMono.ttf');
-}
-
-@font-face {
- font-family: Comic Mono;
- font-weight: bold;
- src: url('/fonts/ComicMono-bold.ttf');
-}
diff --git a/public/fonts/ComicMono-Bold.ttf b/public/fonts/ComicMono-Bold.ttf
deleted file mode 100644
index e03f41e73..000000000
Binary files a/public/fonts/ComicMono-Bold.ttf and /dev/null differ
diff --git a/resources/views/filament/components/server-console.blade.php b/resources/views/filament/components/server-console.blade.php
index 4ce34a40d..3bf08e272 100644
--- a/resources/views/filament/components/server-console.blade.php
+++ b/resources/views/filament/components/server-console.blade.php
@@ -1,12 +1,25 @@
@assets
-
+ @php
+ $userFont = auth()->user()->getCustomization()['console_font'] ?? 'ComicMono';
+ $userFontSize = auth()->user()->getCustomization()['console_font_size'] ?? 14;
+ $userRows = auth()->user()->getCustomization()['console_rows'] ?? 30;
+ @endphp
+
+
+
+
@endassets
@@ -57,14 +70,14 @@
};
let options = {
- fontSize: {{ auth()->user()->getCustomization()['console_font_size'] ?? 14 }},
- fontFamily: 'Comic Mono, monospace',
+ fontSize: {{ $userFontSize }},
+ fontFamily: '{{ $userFont }}',
lineHeight: 1.2,
disableStdin: true,
cursorStyle: 'underline',
cursorInactiveStyle: 'underline',
allowTransparency: true,
- rows: {{ auth()->user()->getCustomization()['console_rows'] ?? 30 }},
+ rows: {{ $userRows }},
theme: theme
};
diff --git a/public/fonts/ComicMono.ttf b/storage/app/public/fonts/ComicMono.ttf
similarity index 100%
rename from public/fonts/ComicMono.ttf
rename to storage/app/public/fonts/ComicMono.ttf