NOW MANAGED ON CODEBERG
Licensing: Added licenses app view
Dan Brown0c524c7c8f27
diff --git a/app/App/HomeController.php b/app/App/HomeController.phpindex 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 Controllerreturn 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.phpnew file mode 100644index 000000000..3d3a8d2c8--- /dev/null+++ b/app/App/MetaController.php@@ -0,0 +1,67 @@+<?php++namespace BookStack\App;++use BookStack\Http\Controller;+use BookStack\Uploads\FaviconHandler;++class MetaController extends Controller+{+ /**+ * 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());+ }++ /**+ * 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.phpnew file mode 100644index 000000000..a87d9e958--- /dev/null+++ b/resources/views/help/licenses.blade.php@@ -0,0 +1,64 @@+@extends('layouts.simple')++@section('body')++ <div class="container small">++ <div class="my-l"> </div>++ <div class="card content-wrap auto-height">+ <h1 class="list-heading">Licenses</h1>++ <p>+ 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.+ </p>++ <ul>+ <li><a href="#bookstack-license">BookStack License</a></li>+ <li><a href="#php-lib-licenses">PHP Library Licenses</a></li>+ <li><a href="#js-lib-licenses">JavaScript Library Licenses</a></li>+ <li><a href="#js-lib-licenses">Other Licenses</a></li>+ </ul>+ </div>++ <div id="bookstack-license" class="card content-wrap auto-height">+ <h3 class="list-heading">BookStack License</h3>+ <div style="white-space: pre-wrap;" class="mb-m">{{ $license }}</div>+ <p>BookStack® is a UK registered trade mark of Daniel Brown. </p>+ </div>++ <div id="php-lib-licenses" class="card content-wrap auto-height">+ <h3 class="list-heading">PHP Library Licenses</h3>+ <div style="white-space: pre-wrap;">{{ $phpLibData }}</div>+ </div>++ <div id="js-lib-licenses" class="card content-wrap auto-height">+ <h3 class="list-heading">JavaScript Library Licenses</h3>+ <div style="white-space: pre-wrap;">{{ $jsLibData }}</div>+ </div>++ <div id="other-licenses" class="card content-wrap auto-height">+ <h3 class="list-heading">Other Licenses</h3>+ <div style="white-space: pre-line;">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+ </div>+ </div>+ </div>++@endsection\ No newline at end of filediff --git a/routes/web.php b/routes/web.phpindex 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 routesRoute::view('/help/wysiwyg', 'help.wysiwyg');-Route::fallback([HomeController::class, 'notFound'])->name('fallback');+Route::fallback([MetaController::class, 'notFound'])->name('fallback');