From 50997a4e3a595de341ce87c83666db9698daf723 Mon Sep 17 00:00:00 2001 From: JianFeeeee Date: Sun, 11 Oct 2026 16:47:24 +0800 Subject: [PATCH] =?UTF-8?q?fix(ui):=20=E8=AE=BE=E7=BD=AE=E9=A1=B5=E9=80=82?= =?UTF-8?q?=E9=85=8D=E9=A2=9D=E5=A4=96=E5=87=BA=E7=AB=99=E4=B8=BB=E6=9C=BA?= =?UTF-8?q?=E6=8E=88=E6=9D=83=20=E2=80=94=E2=80=94=20hosts=5Fdeclared/host?= =?UTF-8?q?s=5Fgranted?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 上一提交把 auth_hosts 语义泛化为 plugin.hosts(额外出站主机授权),但设置页 仍读旧字段名 auth_hosts_declared/auth_hosts_granted、提交 auth_hosts 键 —— 导致内核权限面板的主机授权区永远显示"未声明",勾选保存也不生效。 - 读取: auth_hosts_declared/granted → hosts_declared/granted - 提交: { auth_hosts } → { hosts } - 文案: "登录主机" → "额外出站主机"(授权与登录无关,登录是插件自己的事) 内联 JS node --check 全部通过;UI 契约测试通过。 --- internal/gateway/ui/index.html | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/internal/gateway/ui/index.html b/internal/gateway/ui/index.html index 8fd7f82..69aec6d 100644 --- a/internal/gateway/ui/index.html +++ b/internal/gateway/ui/index.html @@ -864,11 +864,11 @@ plDanger: "危险级", plSave: "保存", plClose: "关闭", - plAuthHosts: "登录主机(出站白名单)", - plAuthHostsHint: "登录流程要访问的主机不是上游源,默认被出站白名单拒绝。勾选即批准;只能批准插件自己声明过的。", + plAuthHosts: "额外出站主机(白名单)", + plAuthHostsHint: "插件要访问的主机若不是上游源,默认被出站白名单拒绝。勾选即批准;只能批准插件自己声明过的。", plHostOk: "已批准", plHostPending: "待批准", - plNoAuthHosts: "该插件未声明登录主机", + plNoAuthHosts: "该插件未声明额外出站主机", plAccessTitle: "访问控制", plAccessHint: "填写允许访问的角色或密钥(@名称)。留空=仅 admin。填 public=任何人。指定 @密钥 时只有该密钥能访问,不受角色规则影响。", plWholePlugin: "以下端点", @@ -1195,11 +1195,11 @@ plDanger: "Danger", plSave: "Save", plClose: "Close", - plAuthHosts: "Login hosts (outbound allowlist)", - plAuthHostsHint: "Login flows reach hosts that are not upstream sources, which the outbound allowlist blocks by default. Tick to approve; only hosts the plugin itself declared can be approved.", + plAuthHosts: "Extra outbound hosts (allowlist)", + plAuthHostsHint: "Hosts a plugin needs that are not upstream sources are blocked by the outbound allowlist by default. Tick to approve; only hosts the plugin itself declared can be approved.", plHostOk: "approved", plHostPending: "pending", - plNoAuthHosts: "this plugin declared no login hosts", + plNoAuthHosts: "this plugin declared no extra outbound hosts", plAccessTitle: "Access control", plAccessHint: "Roles or keys (@name) allowed to reach each endpoint. Empty = admin only. public = anyone. Listing @keys replaces the role rules entirely.", plWholePlugin: "endpoints below", @@ -5059,8 +5059,8 @@ function afterChainEdit() { ${tag}`; }) .join(""); - const declaredHosts = j.auth_hosts_declared || []; - const grantedHosts = new Set(j.auth_hosts_granted || []); + const declaredHosts = j.hosts_declared || []; + const grantedHosts = new Set(j.hosts_granted || []); const hostRows = declaredHosts.length ? declaredHosts .map( @@ -5090,13 +5090,13 @@ function afterChainEdit() { const actions = [...document.querySelectorAll("[data-ka]")] .filter((c) => c.checked) .map((c) => c.getAttribute("data-ka")); - const auth_hosts = [...document.querySelectorAll("[data-ah]")] + const hosts = [...document.querySelectorAll("[data-ah]")] .filter((c) => c.checked) .map((c) => c.getAttribute("data-ah")); try { await api("/api/plugins/" + encodeURIComponent(name) + "/kernel", { method: "PUT", - body: JSON.stringify({ actions, all_read: false, auth_hosts }), + body: JSON.stringify({ actions, all_read: false, hosts }), }); await refreshKernelSummary(); await openKernelEditor(name);