]> BookStack Code Mirror - bookstack/blobdiff - app/Settings/AppSettingsStore.php
Tests: Updated comment test to account for new editor usage
[bookstack] / app / Settings / AppSettingsStore.php
index f2b6cdc521bbddc5c00ff91f8c7c486063e22022..e6fc466baa2e20d67110aebdf5e9e12e8f4a7576 100644 (file)
@@ -2,16 +2,16 @@
 
 namespace BookStack\Settings;
 
+use BookStack\Uploads\FaviconHandler;
 use BookStack\Uploads\ImageRepo;
 use Illuminate\Http\Request;
 
 class AppSettingsStore
 {
-    protected ImageRepo $imageRepo;
-
-    public function __construct(ImageRepo $imageRepo)
-    {
-        $this->imageRepo = $imageRepo;
+    public function __construct(
+        protected ImageRepo $imageRepo,
+        protected FaviconHandler $faviconHandler,
+    ) {
     }
 
     public function storeFromUpdateRequest(Request $request, string $category)
@@ -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,9 +35,12 @@ 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);
             }
+
+            $this->faviconHandler->saveForUploadedImage($iconFile);
         }
 
         // Clear icon image if requested
@@ -48,6 +51,8 @@ class AppSettingsStore
                 $this->destroyExistingSettingImage('app-icon-' . $size);
                 setting()->remove('app-icon-' . $size);
             }
+
+            $this->faviconHandler->restoreOriginal();
         }
     }