]> BookStack Code Mirror - bookstack/blobdiff - app/Http/Controllers/HomeController.php
Fix timestamp in API docs example response
[bookstack] / app / Http / Controllers / HomeController.php
index c3c8d1066d75dd664cad9750a45f955905c651dc..a82710523846ca252ada0d2cf4db88a4650f6509 100644 (file)
@@ -10,6 +10,7 @@ use BookStack\Entities\Queries\TopFavourites;
 use BookStack\Entities\Repos\BookRepo;
 use BookStack\Entities\Repos\BookshelfRepo;
 use BookStack\Entities\Tools\PageContent;
+use BookStack\Uploads\FaviconHandler;
 use BookStack\Util\SimpleListOptions;
 use Illuminate\Http\Request;
 
@@ -127,4 +128,15 @@ class HomeController extends Controller
     {
         return response()->view('errors.404', [], 404);
     }
+
+    /**
+     * Serve the application favicon.
+     * Ensures a 'favicon.ico' file exists at the web root location (if writable) to be served
+     * directly by the webserver in the future.
+     */
+    public function favicon(FaviconHandler $favicons)
+    {
+        $exists = $favicons->restoreOriginalIfNotExists();
+        return response()->file($exists ? $favicons->getPath() : $favicons->getOriginalPath());
+    }
 }