From 37924b295b440f4d2d59a291e4b490409534f44e Mon Sep 17 00:00:00 2001 From: JianFeeeee Date: Mon, 14 Sep 2026 17:48:54 +0800 Subject: [PATCH] =?UTF-8?q?feat(webui):=20=E6=80=BB=E8=A7=88=E5=BA=95?= =?UTF-8?q?=E9=83=A8=E6=BA=90=E7=A0=81=E5=8C=BA=E6=94=B9=E4=B8=BA=E7=8B=AC?= =?UTF-8?q?=E7=AB=8B=E7=9A=84=E3=80=8C=E5=BC=80=E6=BA=90=E8=AE=B8=E5=8F=AF?= =?UTF-8?q?=E3=80=8D=E6=A1=86=EF=BC=88=E5=8D=8F=E8=AE=AE=20+=20=E5=85=A8?= =?UTF-8?q?=E6=96=87=20+=20=E6=BA=90=E7=A0=81=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 此前总览底部只在 KPI 卡里挂了一行小链接(.ov-foot),既看不出受什么许可 约束,也看不出 AGPL 网络服务场景下的义务。现在单独成一张卡: 开销许可 许可协议 AGPL-3.0-only → GNU 官方全文 源码仓库 → 仓库 网络服务条款(§13):把修改后的版本作为网络服务对外提供时, 必须向使用者提供取得对应源码的途径。 内核侧(License 是新事实,不能只靠前端写死): - internal/meta:新增 License(SPDX 标识)与 LicenseURL,都可 -ldflags 覆盖。 LicenseURL 默认指向 GNU 官方 AGPL-3.0 全文页 —— 与仓库托管方、分支名、 文件路径都无关,换仓库/换分支不会失效。 - internal/sdk/status.go 的 BuildStatus:新增 License / LicenseURL 两个 json 字段(additive,旧消费方忽略未知字段即可)。 ❗注意 internal/sdk 不受公开接口冻结约束(docs/git-branching.md §六), 本次未触碰 third_party/homeagent-sdk/sdk/。 - internal/agent/core/status.go:从 meta 填充。 前端: - 骨架里 .ov-foot 换成独立的
'; + '' + + // 开源许可单独成框:之前在 KPI 卡底部只是一行小链接(.ov-foot), + // 几乎看不见,也看不出是许可证还是别的什么。 + ''; } updateOverview(); } @@ -1427,20 +1430,55 @@ "ov-runtime", rt.goroutines ? rt.goroutines + (rt.memory_mb ? " · " + rt.memory_mb + "M" : "") : "—", ); - // 源码链接(AGPL §13):静态文本,第一次填好后不参与轮询刷新。 - var foot = document.getElementById("ov-foot"); - if (foot) { - var src = k && k.build && k.build.source_url; - var want = src - ? '' + + __("许可协议", "License") + + '' + + (licURL + ? '' + escHtml(lic) + "" + : escHtml(lic)) + + ""; + } + if (src) { + rows += + '
' + + __("源码仓库", "Source") + + '' + - __("源码", "Source") + - "" + escHtml(src) + + "
"; + } + // 网络条款只在 AGPL 系的许可下才成立,所以按标识判断,不硬写协议名。 + var note = + lic && lic.toUpperCase().indexOf("AGPL") >= 0 + ? '" + : ""; + var want = rows + ? '

' + __("开源许可", "License") + "

" + rows + note : ""; - if (foot.__html !== want) { - foot.__html = want; - foot.innerHTML = want; + if (legal.__html !== want) { + legal.__html = want; + legal.innerHTML = want; } } } diff --git a/internal/sdk/status.go b/internal/sdk/status.go index e83e8d1..79c628d 100644 --- a/internal/sdk/status.go +++ b/internal/sdk/status.go @@ -251,6 +251,13 @@ type BuildStatus struct { // 服务时,要给他们拿到 Corresponding Source 的机会——WebUI 状态页会把它渲染成 // 可见链接,所以**修改后对外部署的分支必须把这个值改指向自己的源码仓库**。 SourceURL string `json:"source_url,omitempty"` + // License 是开源许可标识(SPDX,如 AGPL-3.0-only)。 + // + // 为何与 SourceURL 分开:只看一个源码链接,使用者没法从界面上看出这是什么 + // 许可、网络服务场景下有哪些义务。许可名与许可全文地址是两个独立事实。 + License string `json:"license,omitempty"` + // LicenseURL 是 License 对应的全文地址。 + LicenseURL string `json:"license_url,omitempty"` } type TrackerStatus struct {