fix: Sentinel 编辑节点时 api_key 留空 → 保留旧值

This commit is contained in:
qinglong
2026-06-13 20:44:44 +08:00
parent cc50ecb813
commit c8f2cb7b98
5 changed files with 29 additions and 3 deletions
+4
View File
@@ -127,6 +127,10 @@ class Plugin(PluginWebMixin):
return web.json_response({"ok": False, "error": "名称和 URL 不能为空"}, status=400)
existing = [i for i, n in enumerate(nodes) if n.get("id") == node_id]
if existing:
old = nodes[existing[0]]
# 保留未填写的敏感字段
if not node["api_key"]:
node["api_key"] = old.get("api_key", "")
nodes[existing[0]] = node
else:
nodes.append(node)