]> BookStack Code Mirror - bookstack/blob - app/App/MetaController.php
Merge pull request #5625 from BookStackApp/avif_images
[bookstack] / app / App / MetaController.php
1 <?php
2
3 namespace BookStack\App;
4
5 use BookStack\Http\Controller;
6 use BookStack\Uploads\FaviconHandler;
7
8 class MetaController extends Controller
9 {
10     /**
11      * Show the view for /robots.txt.
12      */
13     public function robots()
14     {
15         $sitePublic = setting('app-public', false);
16         $allowRobots = config('app.allow_robots');
17
18         if ($allowRobots === null) {
19             $allowRobots = $sitePublic;
20         }
21
22         return response()
23             ->view('misc.robots', ['allowRobots' => $allowRobots])
24             ->header('Content-Type', 'text/plain');
25     }
26
27     /**
28      * Show the route for 404 responses.
29      */
30     public function notFound()
31     {
32         return response()->view('errors.404', [], 404);
33     }
34
35     /**
36      * Serve the application favicon.
37      * Ensures a 'favicon.ico' file exists at the web root location (if writable) to be served
38      * directly by the webserver in the future.
39      */
40     public function favicon(FaviconHandler $favicons)
41     {
42         $exists = $favicons->restoreOriginalIfNotExists();
43         return response()->file($exists ? $favicons->getPath() : $favicons->getOriginalPath());
44     }
45
46     /**
47      * Serve a PWA application manifest.
48      */
49     public function pwaManifest(PwaManifestBuilder $manifestBuilder)
50     {
51         return response()->json($manifestBuilder->build());
52     }
53
54     /**
55      * Show license information for the application.
56      */
57     public function licenses()
58     {
59         $this->setPageTitle(trans('settings.licenses'));
60
61         return view('help.licenses', [
62             'license' => file_get_contents(base_path('LICENSE')),
63             'phpLibData' => file_get_contents(base_path('dev/licensing/php-library-licenses.txt')),
64             'jsLibData' => file_get_contents(base_path('dev/licensing/js-library-licenses.txt')),
65         ]);
66     }
67
68     /**
69      * Show the view for /opensearch.xml.
70      */
71     public function opensearch()
72     {
73         return response()
74             ->view('misc.opensearch')
75             ->header('Content-Type', 'application/opensearchdescription+xml');
76     }
77 }
Morty Proxy This is a proxified and sanitized view of the page, visit original site.