diff --git a/NOTICE b/NOTICE new file mode 100644 index 0000000..0b6d24a --- /dev/null +++ b/NOTICE @@ -0,0 +1,15 @@ +LaySite: anothor AI website builder +Copyright (C) 2026 Shanghai Laysense Information Technology Co. Ltd. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as +published by the Free Software Foundation, either version 3 of the +License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . diff --git a/README.md b/README.md index 868272b..04cf20e 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # LaySite +Copyright (C) 2026 Shanghai Laysense Information Technology Co. Ltd. [版权与授权声明](NOTICE) + 基于 PHP Webman、SQLite、原生 CSS 和 jQuery 的通用站点编辑器。页面由服务端渲染,公开页复用站点组件和配色。新装提供空白首页、可编辑的文章页,以及九套十八个整页模板。 ## 安装 @@ -181,6 +183,6 @@ Caddy v1 的路径限额按前缀匹配。CDN 应转发 `/assets/`,并保留 ## 开源许可证 -LaySite 自有代码采用 [GNU Affero General Public License v3.0](LICENSE)(`AGPL-3.0-only`)。第三方项目沿用各自的许可证,可在后台「账户 → 关于系统 → 第三方项目与许可」查阅。 +LaySite 自有代码采用 [GNU Affero General Public License v3.0 或任何后续版本](LICENSE)(`AGPL-3.0-or-later`)。部署后的站点可通过 `/.laysite/license` 匿名查看授权声明和许可全文。第三方项目沿用各自的许可证,可在后台「账户 → 关于系统 → 第三方项目与许可」查阅。 通过网络提供修改版时,须按许可证第 13 节向与该版本通过网络交互的用户提供其对应源码。 diff --git a/app/Content/Licenses.php b/app/Content/Licenses.php index 6b57768..d77b49f 100644 --- a/app/Content/Licenses.php +++ b/app/Content/Licenses.php @@ -8,7 +8,18 @@ use Composer\InstalledVersions; final class Licenses { - public const PROJECT = 'AGPL-3.0-only'; + public const PROJECT = 'AGPL-3.0-or-later'; + public const PROJECT_NAME = 'GNU Affero General Public License v3.0'; + public const PROJECT_PATH = '/.laysite/license'; + + public static function projectText(): ?string + { + $root = dirname(__DIR__, 2); + $notice = @file_get_contents($root . '/NOTICE'); + $license = @file_get_contents($root . '/LICENSE'); + + return $notice === false || $license === false ? null : rtrim($notice) . "\n\n" . $license; + } public static function dependencies(): array { @@ -48,7 +59,7 @@ final class Licenses public static function text(string $key): ?string { - $path = $key === 'laysite' ? dirname(__DIR__, 2) . '/LICENSE' : (self::dependencies()[$key]['file'] ?? null); + $path = self::dependencies()[$key]['file'] ?? null; $text = $path === null ? false : @file_get_contents($path); return $text === false ? null : $text; diff --git a/app/Content/PageDraft.php b/app/Content/PageDraft.php index 097ecd2..dc4b6fa 100644 --- a/app/Content/PageDraft.php +++ b/app/Content/PageDraft.php @@ -8,7 +8,7 @@ use RuntimeException; final class PageDraft { - public const RESERVED = ['admin', 'assets', 'home', 'account', 'mcp', 'palette']; + public const RESERVED = ['.', '.laysite', 'admin', 'assets', 'home', 'account', 'mcp', 'palette']; public static function slug(mixed $value, array $reserved = self::RESERVED, bool $includeSpecial = false): string { diff --git a/app/Controller/SiteController.php b/app/Controller/SiteController.php index be714e7..0989ec3 100644 --- a/app/Controller/SiteController.php +++ b/app/Controller/SiteController.php @@ -7,6 +7,7 @@ namespace App\Controller; use App\Content\Assets; use App\Content\CanvasStyle; use App\Content\Html; +use App\Content\Licenses; use App\Content\Repository; use App\Content\View; use FastRoute\Dispatcher; @@ -21,6 +22,15 @@ final class SiteController return $this->page($request, 'home'); } + public function license(Request $request): Response + { + $text = Licenses::projectText(); + + return new Response($text === null ? 404 : 200, [ + 'Content-Type' => 'text/plain; charset=utf-8', 'X-Content-Type-Options' => 'nosniff', + ], $text ?? 'License not found.'); + } + public function page(Request $request, string $slug): Response { $repo = new Repository(); diff --git a/app/Middleware/SiteStatus.php b/app/Middleware/SiteStatus.php index 4c84f5f..5568067 100644 --- a/app/Middleware/SiteStatus.php +++ b/app/Middleware/SiteStatus.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace App\Middleware; +use App\Content\Licenses; use App\Content\Repository; use App\Content\SystemPage; use App\Controller\SiteController; @@ -16,7 +17,8 @@ final class SiteStatus implements MiddlewareInterface public function process(Request $request, callable $handler): Response { $path = $request->path(); - if ($path === '/admin' || str_starts_with($path, '/admin/')) { + if ($path === '/admin' || str_starts_with($path, '/admin/') + || ($path === Licenses::PROJECT_PATH && in_array($request->method(), ['GET', 'HEAD'], true))) { return $handler($request); } diff --git a/app/view/admin-about.php b/app/view/admin-about.php index 149bfac..6a2fa5e 100644 --- a/app/view/admin-about.php +++ b/app/view/admin-about.php @@ -31,8 +31,8 @@ $e = View::escape(...);

开源许可证

-
LaySite

GNU Affero General Public License v3.0()

- 查看许可证全文 +
LaySite

()

+ 查看许可证全文
第三方项目与许可 diff --git a/composer.json b/composer.json index 2f7b3f6..bf3f5a9 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "laysense/laysite", "description": "LaySite visual editor and content management system", - "license": "AGPL-3.0-only", + "license": "AGPL-3.0-or-later", "type": "project", "require": { "php": "^8.2", diff --git a/config/route.php b/config/route.php index 12a10af..17486d3 100644 --- a/config/route.php +++ b/config/route.php @@ -1,5 +1,6 @@ + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + declare(strict_types=1); chdir(__DIR__);