forked from laysense/laysite
Expand admin system information and license notices
This commit is contained in:
@@ -11,12 +11,14 @@ use App\Content\DesignLibrary;
|
||||
use App\Content\Database;
|
||||
use App\Content\Html;
|
||||
use App\Content\LayoutPage;
|
||||
use App\Content\Licenses;
|
||||
use App\Content\Media;
|
||||
use App\Content\Passwords;
|
||||
use App\Content\Repository;
|
||||
use App\Content\SiteDesign;
|
||||
use App\Content\SystemInfo;
|
||||
use App\Content\View;
|
||||
use App\Http\Request;
|
||||
use Composer\InstalledVersions;
|
||||
use RuntimeException;
|
||||
use support\Response;
|
||||
|
||||
@@ -137,14 +139,43 @@ class AdminController
|
||||
'title' => '关于系统',
|
||||
'systemInfo' => [
|
||||
'PHP' => PHP_VERSION,
|
||||
'Webman' => InstalledVersions::getPrettyVersion('workerman/webman-framework'),
|
||||
'Workerman' => InstalledVersions::getPrettyVersion('workerman/workerman'),
|
||||
'Webman' => SystemInfo::version('workerman/webman-framework'),
|
||||
'Workerman' => SystemInfo::version('workerman/workerman'),
|
||||
'SQLite' => (string) Database::connect()->query('SELECT sqlite_version()')->fetchColumn(),
|
||||
'运行平台' => PHP_OS_FAMILY,
|
||||
'运行平台' => SystemInfo::platform(),
|
||||
PHP_OS_FAMILY === 'Linux' ? 'Linux 内核' : '系统版本' => php_uname('r'),
|
||||
],
|
||||
'metrics' => SystemInfo::sample(),
|
||||
'mediaUsage' => Media::usage(),
|
||||
'thirdPartyLicenses' => Licenses::dependencies(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function aboutMetrics(Request $request): Response
|
||||
{
|
||||
if ($failure = $this->guard($request)) {
|
||||
return $failure;
|
||||
}
|
||||
|
||||
return $this->json(SystemInfo::sample());
|
||||
}
|
||||
|
||||
public function aboutLicense(Request $request, string $key): Response
|
||||
{
|
||||
if ($failure = $this->guard($request)) {
|
||||
return $failure;
|
||||
}
|
||||
$text = Licenses::text($key);
|
||||
if ($text === null) {
|
||||
return $this->error($request, '找不到许可证。', 404);
|
||||
}
|
||||
|
||||
return new Response(200, [
|
||||
'Content-Type' => 'text/plain; charset=utf-8', 'Cache-Control' => 'no-store',
|
||||
'X-Content-Type-Options' => 'nosniff', 'X-Robots-Tag' => 'noindex',
|
||||
], $text);
|
||||
}
|
||||
|
||||
public function articles(Request $request): Response
|
||||
{
|
||||
if ($failure = $this->guard($request)) {
|
||||
|
||||
Reference in New Issue
Block a user