]> BookStack Code Mirror - bookstack/commitdiff
Extracted app icon text, fixed issues
authorDan Brown <redacted>
Wed, 25 Jan 2023 16:11:34 +0000 (16:11 +0000)
committerDan Brown <redacted>
Wed, 25 Jan 2023 16:11:34 +0000 (16:11 +0000)
Tweaked sizes and meta tags based unpon ipad testing.
Fixed reduced sizes not being cleaned up.

app/Settings/AppSettingsStore.php
app/Uploads/ImageRepo.php
resources/lang/en/settings.php
resources/views/layouts/base.blade.php
resources/views/settings/customization.blade.php

index f2b6cdc521bbddc5c00ff91f8c7c486063e22022..8d7b73c1cfaf037df6a01e6b0babd10197677a68 100644 (file)
@@ -25,7 +25,7 @@ class AppSettingsStore
 
     protected function updateAppIcon(Request $request): void
     {
-        $sizes = [128, 64, 32];
+        $sizes = [180, 128, 64, 32];
 
         // Update icon image if set
         if ($request->hasFile('app_icon')) {
@@ -35,6 +35,7 @@ class AppSettingsStore
             setting()->put('app-icon', $image->url);
 
             foreach ($sizes as $size) {
+                $this->destroyExistingSettingImage('app-icon-' . $size);
                 $icon = $this->imageRepo->saveNew($iconFile, 'system', 0, $size, $size);
                 setting()->put('app-icon-' . $size, $icon->url);
             }
index 910248203c00f0667507a28b09023a67ba41e002..2c643a58be0f05110f88b0d881452e2b5e4a9289 100644 (file)
@@ -123,7 +123,10 @@ class ImageRepo
     public function saveNew(UploadedFile $uploadFile, string $type, int $uploadedTo = 0, int $resizeWidth = null, int $resizeHeight = null, bool $keepRatio = true): Image
     {
         $image = $this->imageService->saveNewFromUpload($uploadFile, $type, $uploadedTo, $resizeWidth, $resizeHeight, $keepRatio);
-        $this->loadThumbs($image);
+
+        if ($type !== 'system') {
+            $this->loadThumbs($image);
+        }
 
         return $image;
     }
index 318dc0a52a07285bd84e1c99e0315a55d638156d..023cf1beb1ea6895bf8ce9a9d0748bf3f20c590e 100755 (executable)
@@ -34,6 +34,8 @@ return [
     'app_custom_html_disabled_notice' => 'Custom HTML head content is disabled on this settings page to ensure any breaking changes can be reverted.',
     'app_logo' => 'Application Logo',
     'app_logo_desc' => 'This is used in the application header bar, among other areas. This image should be 86px in height. Large images will be scaled down.',
+    'app_icon' => 'Application Icon',
+    'app_icon_desc' => 'This icon is used for browser tabs and shortcut icons. This should be a 256px square PNG image.',
     'app_primary_color' => 'Application Primary Color',
     'app_primary_color_desc' => 'Sets the primary color for the application including the banner, buttons, and links.',
     'app_homepage' => 'Application Homepage',
index b09a8dfe9efbe5275a3d1befffafe5b776ed08b6..e0a6f46d0166c3b9698a4bed4bc389ec63438b38 100644 (file)
@@ -6,10 +6,11 @@
     <title>{{ isset($pageTitle) ? $pageTitle . ' | ' : '' }}{{ setting('app-name') }}</title>
 
     <!-- Meta -->
+    <meta charset="utf-8">
     <meta name="viewport" content="width=device-width">
     <meta name="token" content="{{ csrf_token() }}">
     <meta name="base-url" content="{{ url('/') }}">
-    <meta charset="utf-8">
+    <meta name="theme-color" content="{{ setting('app-color') }}"/>
 
     <!-- Social Cards Meta -->
     <meta property="og:title" content="{{ isset($pageTitle) ? $pageTitle . ' | ' : '' }}{{ setting('app-name') }}">
     <link rel="stylesheet" media="print" href="{{ versioned_asset('dist/print-styles.css') }}">
 
     <!-- Icons -->
-    <link rel="icon" type="image/png" sizes="256x256" href="{{ setting('app-icon') ?? url('/icon.png') }}">
-    <link rel="icon" type="image/png" sizes="128x128" href="{{ setting('app-icon-128') ?? url('/icon-128.png') }}">
-    <link rel="icon" type="image/png" sizes="64x64" href="{{ setting('app-icon-64') ?? url('/icon-64.png') }}">
-    <link rel="icon" type="image/png" sizes="32x32" href="{{ setting('app-icon-32') ?? url('/icon-32.png') }}">
+    <link rel="icon" type="image/png" sizes="256x256" href="{{ setting('app-icon') ?: url('/icon.png') }}">
+    <link rel="icon" type="image/png" sizes="180x180" href="{{ setting('app-icon-180') ?: url('/icon-180.png') }}">
+    <link rel="apple-touch-icon" sizes="180x180" href="{{ setting('app-icon-180') ?: url('/icon-180.png') }}">
+    <link rel="icon" type="image/png" sizes="128x128" href="{{ setting('app-icon-128') ?: url('/icon-128.png') }}">
+    <link rel="icon" type="image/png" sizes="64x64" href="{{ setting('app-icon-64') ?: url('/icon-64.png') }}">
+    <link rel="icon" type="image/png" sizes="32x32" href="{{ setting('app-icon-32') ?: url('/icon-32.png') }}">
 
     @yield('head')
 
index 8477040079811e152c258971814996d157e60c88..aa37c30c9e474223c6ca88cb1d7f7d9dca3cfe04 100644 (file)
 
             <div class="grid half gap-xl">
                 <div>
-                    <label class="setting-list-label">{{ 'Application Icon' }}</label>
-                    <p class="small">
-                        This icon is used for browser tabs and shortcut icons.
-                        This should be a 256px square PNG image.
-                    </p>
+                    <label class="setting-list-label">{{ trans('settings.app_icon') }}</label>
+                    <p class="small">{{ trans('settings.app_icon_desc') }}</p>
                 </div>
                 <div class="pt-xs">
                     @include('form.image-picker', [