Expand admin system information and license notices

This commit is contained in:
2026-11-25 21:39:13 +08:00
parent 2e1e43a3ce
commit acf59c9dfc
18 changed files with 1014 additions and 21 deletions
+58 -7
View File
@@ -1,14 +1,65 @@
<?php
use App\Content\Licenses;
use App\Content\View;
$e = View::escape(...);
?>
<header class="admin-heading"><h1><?= $e($title) ?></h1></header>
<section class="admin-panel admin-system-info" aria-labelledby="system-info-title">
<h2 id="system-info-title">版本与运行环境</h2>
<dl>
<?php foreach (['LaySite' => $laysiteVersion] + $systemInfo as $name => $value): ?>
<div><dt><?= $e($name) ?></dt><dd><?= $e($value) ?></dd></div>
<div class="admin-about">
<section class="admin-panel admin-system-info" aria-labelledby="system-info-title" data-about-metrics
data-cpu-total="<?= $e($metrics['cpu']['total'] ?? '') ?>" data-cpu-idle="<?= $e($metrics['cpu']['idle'] ?? '') ?>">
<h2 id="system-info-title">版本与运行环境</h2>
<dl>
<div><dt>LaySite</dt><dd><?= $e($laysiteVersion) ?></dd></div>
<div><dt>CPU 占用</dt><dd data-about-cpu>暂不可用</dd></div>
<div><dt>内存占用</dt><dd data-about-memory><?= $e($metrics['memory'] ?? '暂不可用') ?></dd></div>
<div><dt>媒体库占用</dt><dd><?= $e($mediaUsage['size']) ?><small>已登记文件,含归档资源</small></dd></div>
<?php if ($mediaUsage['free'] !== null): ?>
<div><dt>媒体磁盘可用</dt><dd><?= $e($mediaUsage['free']) ?></dd></div>
<?php endif ?>
</dl>
<p class="field-note">CPU 和内存显示当前 Linux 系统可见的用量,页面可见时自动更新。</p>
<details class="admin-options admin-about-details">
<summary>运行环境详情</summary>
<dl>
<?php foreach ($systemInfo as $name => $value): ?>
<div><dt><?= $e($name) ?></dt><dd><?= $e($value) ?></dd></div>
<?php endforeach ?>
</dl>
</details>
</section>
<section class="admin-panel admin-licenses" aria-labelledby="system-licenses-title">
<h2 id="system-licenses-title">开源许可证</h2>
<div class="admin-license-project">
<div><strong>LaySite</strong><p>GNU Affero General Public License v3.0(<?= $e(Licenses::PROJECT) ?>)</p></div>
<a href="/admin/about/license/laysite" target="_blank" rel="noopener noreferrer">查看许可证全文</a>
</div>
<details class="admin-options admin-about-details">
<summary>第三方项目与许可</summary>
<ul class="admin-license-list">
<?php foreach ($thirdPartyLicenses as $key => $project): ?>
<li>
<div>
<?php if ($project['url'] !== ''): ?><a href="<?= $e($project['url']) ?>" target="_blank" rel="noopener noreferrer"><?= $e($project['name']) ?></a>
<?php else: ?><?= $e($project['name']) ?><?php endif ?>
<?php if ($project['version'] !== ''): ?><small><?= $e($project['version']) ?></small><?php endif ?>
</div>
<div>
<span><?= $e($project['license']) ?></span>
<?php if ($project['file'] !== null): ?>
<a href="/admin/about/license/<?= $e($key) ?>" target="_blank" rel="noopener noreferrer" aria-label="<?= $e('查看 ' . $project['name'] . ' 的许可证全文') ?>">许可全文</a>
<?php endif ?>
</div>
</li>
<?php endforeach ?>
</ul>
</details>
</section>
<nav class="admin-about-links" aria-label="项目链接">
<?php foreach (['LaySite' => 'https://laysense.cn/laysite', 'Laysense' => 'https://laysense.cn'] as $name => $url): ?>
<a href="<?= $e($url) ?>" target="_blank" rel="noopener noreferrer">
<?= View::fragment('studio-icon', ['icon' => 'external']) ?><strong><?= $e($name) ?></strong><span><?= $e($url) ?></span>
</a>
<?php endforeach ?>
</dl>
</section>
</nav>
</div>