3 namespace BookStack\App;
5 use BookStack\Http\Controller;
6 use BookStack\Uploads\FaviconHandler;
8 class MetaController extends Controller
11 * Show the view for /robots.txt.
13 public function robots()
15 $sitePublic = setting('app-public', false);
16 $allowRobots = config('app.allow_robots');
18 if ($allowRobots === null) {
19 $allowRobots = $sitePublic;
23 ->view('misc.robots', ['allowRobots' => $allowRobots])
24 ->header('Content-Type', 'text/plain');
28 * Show the route for 404 responses.
30 public function notFound()
32 return response()->view('errors.404', [], 404);
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.
40 public function favicon(FaviconHandler $favicons)
42 $exists = $favicons->restoreOriginalIfNotExists();
43 return response()->file($exists ? $favicons->getPath() : $favicons->getOriginalPath());
47 * Serve a PWA application manifest.
49 public function pwaManifest(PwaManifestBuilder $manifestBuilder)
51 return response()->json($manifestBuilder->build());
55 * Show license information for the application.
57 public function licenses()
59 $this->setPageTitle(trans('settings.licenses'));
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')),
69 * Show the view for /opensearch.xml.
71 public function opensearch()
74 ->view('misc.opensearch')
75 ->header('Content-Type', 'application/opensearchdescription+xml');