diff --git a/app/App/HomeController.php b/app/App/HomeController.php index 116f5c8a4..0585e0af5 100644 --- a/app/App/HomeController.php +++ b/app/App/HomeController.php @@ -9,7 +9,6 @@ use BookStack\Entities\Queries\QueryRecentlyViewed; use BookStack\Entities\Queries\QueryTopFavourites; use BookStack\Entities\Tools\PageContent; use BookStack\Http\Controller; -use BookStack\Uploads\FaviconHandler; use BookStack\Util\SimpleListOptions; use Illuminate\Http\Request; @@ -112,48 +111,4 @@ class HomeController extends Controller return view('home.default', $commonData); } - - /** - * Show the view for /robots.txt. - */ - public function robots() - { - $sitePublic = setting('app-public', false); - $allowRobots = config('app.allow_robots'); - - if ($allowRobots === null) { - $allowRobots = $sitePublic; - } - - return response() - ->view('misc.robots', ['allowRobots' => $allowRobots]) - ->header('Content-Type', 'text/plain'); - } - - /** - * Show the route for 404 responses. - */ - public function notFound() - { - 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()); - } - - /** - * Serve a PWA application manifest. - */ - public function pwaManifest(PwaManifestBuilder $manifestBuilder) - { - return response()->json($manifestBuilder->build()); - } } diff --git a/app/App/MetaController.php b/app/App/MetaController.php new file mode 100644 index 000000000..3d3a8d2c8 --- /dev/null +++ b/app/App/MetaController.php @@ -0,0 +1,67 @@ +view('misc.robots', ['allowRobots' => $allowRobots]) + ->header('Content-Type', 'text/plain'); + } + + /** + * Show the route for 404 responses. + */ + public function notFound() + { + 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()); + } + + /** + * Serve a PWA application manifest. + */ + public function pwaManifest(PwaManifestBuilder $manifestBuilder) + { + return response()->json($manifestBuilder->build()); + } + + /** + * Show license information for the application. + */ + public function licenses() + { + $this->setPageTitle('Licenses'); + + return view('help.licenses', [ + 'license' => file_get_contents(base_path('LICENSE')), + 'phpLibData' => file_get_contents(base_path('dev/licensing/php-library-licenses.txt')), + 'jsLibData' => file_get_contents(base_path('dev/licensing/js-library-licenses.txt')), + ]); + } +} diff --git a/resources/views/help/licenses.blade.php b/resources/views/help/licenses.blade.php new file mode 100644 index 000000000..a87d9e958 --- /dev/null +++ b/resources/views/help/licenses.blade.php @@ -0,0 +1,64 @@ +@extends('layouts.simple') + +@section('body') + +
+ +
 
+ +
+

Licenses

+ +

+ This page details license information for BookStack in addition to the projects & libraries that are used within BookStack. + Many projects listed may only be used in a development context. +

+ + +
+ +
+

BookStack License

+
{{ $license }}
+

BookStack® is a UK registered trade mark of Daniel Brown.

+
+ +
+

PHP Library Licenses

+
{{ $phpLibData }}
+
+ +
+

JavaScript Library Licenses

+
{{ $jsLibData }}
+
+ +
+

Other Licenses

+
BookStack makes heavy use of PHP: + License: PHP License, version 3.01 + License File: https://www.php.net/license/3_01.txt + Copyright: Copyright (c) 1999 - 2019 The PHP Group. All rights reserved. + Link: https://www.php.net/ + ----------- + BookStack uses Icons from Google Material Icons: + License: Apache License Version 2.0 + License File: https://github.com/google/material-design-icons/blob/master/LICENSE + Copyright: Copyright 2020 Google LLC + Link: https://github.com/google/material-design-icons + ----------- + BookStack is distributed with TinyMCE: + License: MIT + License File: https://github.com/tinymce/tinymce/blob/release/6.7/LICENSE.TXT + Copyright: Copyright (c) 2022 Ephox Corporation DBA Tiny Technologies, Inc. + Link: https://github.com/tinymce/tinymce +
+
+
+ +@endsection \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index 4620cd08b..03595288f 100644 --- a/routes/web.php +++ b/routes/web.php @@ -5,6 +5,7 @@ use BookStack\Activity\Controllers as ActivityControllers; use BookStack\Api\ApiDocsController; use BookStack\Api\UserApiTokenController; use BookStack\App\HomeController; +use BookStack\App\MetaController; use BookStack\Entities\Controllers as EntityControllers; use BookStack\Http\Middleware\VerifyCsrfToken; use BookStack\Permissions\PermissionsController; @@ -18,9 +19,10 @@ use Illuminate\Support\Facades\Route; use Illuminate\View\Middleware\ShareErrorsFromSession; Route::get('/status', [SettingControllers\StatusController::class, 'show']); -Route::get('/robots.txt', [HomeController::class, 'robots']); -Route::get('/favicon.ico', [HomeController::class, 'favicon']); -Route::get('/manifest.json', [HomeController::class, 'pwaManifest']); +Route::get('/robots.txt', [MetaController::class, 'robots']); +Route::get('/favicon.ico', [MetaController::class, 'favicon']); +Route::get('/manifest.json', [MetaController::class, 'pwaManifest']); +Route::get('/licenses', [MetaController::class, 'licenses']); // Authenticated routes... Route::middleware('auth')->group(function () { @@ -350,4 +352,4 @@ Route::post('/password/reset', [AccessControllers\ResetPasswordController::class // Metadata routes Route::view('/help/wysiwyg', 'help.wysiwyg'); -Route::fallback([HomeController::class, 'notFound'])->name('fallback'); +Route::fallback([MetaController::class, 'notFound'])->name('fallback');