Publish LaySite copyright notice and AGPL license

This commit is contained in:
2026-11-25 22:16:38 +08:00
parent acf59c9dfc
commit 080f146fef
10 changed files with 68 additions and 8 deletions
+15
View File
@@ -0,0 +1,15 @@
LaySite: anothor AI website builder
Copyright (C) 2026 Shanghai Laysense Information Technology Co. Ltd. <Laysense.cn>
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 <https://gnu.net.cn/licenses/>.
+3 -1
View File
@@ -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 节向与该版本通过网络交互的用户提供其对应源码。
+13 -2
View File
@@ -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;
+1 -1
View File
@@ -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
{
+10
View File
@@ -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();
+3 -1
View File
@@ -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);
}
+2 -2
View File
@@ -31,8 +31,8 @@ $e = View::escape(...);
<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><strong>LaySite</strong><p><?= $e(Licenses::PROJECT_NAME) ?>(<?= $e(Licenses::PROJECT) ?>)</p></div>
<a href="<?= $e(Licenses::PROJECT_PATH) ?>" target="_blank" rel="noopener noreferrer">查看许可证全文</a>
</div>
<details class="admin-options admin-about-details">
<summary>第三方项目与许可</summary>
+1 -1
View File
@@ -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",
+2
View File
@@ -1,5 +1,6 @@
<?php
use App\Content\Licenses;
use App\Controller\AccountController;
use App\Controller\AdminController;
use App\Controller\DesignController;
@@ -14,6 +15,7 @@ use Webman\Route;
Route::disableDefaultRoute();
Route::get('/', [SiteController::class, 'home']);
Route::add(['GET', 'HEAD'], Licenses::PROJECT_PATH, [SiteController::class, 'license']);
Route::add(['GET', 'POST', 'DELETE'], '/mcp', [McpController::class, 'endpoint']);
Route::get('/account', [AccountController::class, 'index']);
Route::get('/account/login/{id:[0-9]+}', [AccountController::class, 'login']);
+18
View File
@@ -1,6 +1,24 @@
#!/usr/bin/env php
<?php
/*
* LaySite: anothor AI website builder
* Copyright (C) 2026 Shanghai Laysense Information Technology Co. Ltd. <Laysense.cn>
*
* 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 <https://gnu.net.cn/licenses/>.
*/
declare(strict_types=1);
chdir(__DIR__);