mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-10-01 01:36:00 -04:00
Licensing: Added licenses app view
Extracted many methods to a new "MetaController" in the process.
This commit is contained in:
parent
ed956a4cf0
commit
0c524c7c8f
@ -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());
|
||||
}
|
||||
}
|
||||
|
67
app/App/MetaController.php
Normal file
67
app/App/MetaController.php
Normal file
@ -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')),
|
||||
]);
|
||||
}
|
||||
}
|
64
resources/views/help/licenses.blade.php
Normal file
64
resources/views/help/licenses.blade.php
Normal file
@ -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
|
@ -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');
|
||||
|
Loading…
Reference in New Issue
Block a user