diff --git a/Dockerfile.dev b/Dockerfile.dev index 078e107c9..797576e25 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -79,14 +79,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/Pages/Auth/EditProfile.php b/app/Filament/Pages/Auth/EditProfile.php index d0243fff9..66db49a08 100644 --- a/app/Filament/Pages/Auth/EditProfile.php +++ b/app/Filament/Pages/Auth/EditProfile.php @@ -39,6 +39,7 @@ use Filament\Support\Enums\MaxWidth; use Filament\Support\Exceptions\Halt; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; +use Illuminate\Support\Facades\File; use Illuminate\Support\Facades\Hash; use Illuminate\Support\HtmlString; use Illuminate\Validation\Rules\Password; @@ -375,7 +376,17 @@ class EditProfile extends BaseEditProfile ->default(30), Select::make('console_font') ->label(trans('profile.font')) - ->options(fn () => get_fonts(storage_path('app\public\fonts'))) + ->options(function () { + $fonts = []; + foreach (File::allFiles(public_path('storage/fonts')) as $file) { + if ($file->getExtension() === 'ttf') { + $name = pathinfo($file->getFilename(), PATHINFO_FILENAME); + $fonts[$name] = $name; + } + } + + return $fonts; + }) ->reactive() ->afterStateUpdated(fn ($state, callable $set) => $set('font_preview', $state)), Placeholder::make('font_preview') @@ -383,7 +394,7 @@ class EditProfile extends BaseEditProfile ->content(function (Get $get) { $fontName = $get('console_font') ?? 'No font selected.'; - $fontUrl = asset("fonts/{$fontName}.ttf"); + $fontUrl = asset("storage/fonts/{$fontName}.ttf"); $fontSize = $get('console_font_size') . 'px'; return new HtmlString(<< - */ - 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/resources/views/filament/components/server-console.blade.php b/resources/views/filament/components/server-console.blade.php index 3bf08e272..717a3be78 100644 --- a/resources/views/filament/components/server-console.blade.php +++ b/resources/views/filament/components/server-console.blade.php @@ -5,6 +5,18 @@ $userFontSize = auth()->user()->getCustomization()['console_font_size'] ?? 14; $userRows = auth()->user()->getCustomization()['console_rows'] ?? 30; @endphp + + @if ($userFont === 'ComicMono') + + @else + + + @endif @@ -12,14 +24,6 @@ - - - @endassets
diff --git a/storage/app/public/fonts/ComicMono.ttf b/storage/app/public/fonts/ComicMono.ttf deleted file mode 100644 index 9bc7354e3..000000000 Binary files a/storage/app/public/fonts/ComicMono.ttf and /dev/null differ