From 8444aeb6b68a39a7a0494eade16f8e903962547d Mon Sep 17 00:00:00 2001 From: K-hermes Date: Sat, 15 Aug 2026 13:22:54 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=88=97=E8=A1=A8=E9=A1=B5=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0'=E5=A4=8D=E5=88=B6=20JSON'=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 改进: - 新增'📄 复制 JSON'按钮,复制完整的原始 JSON 数据 - 保留'📋 复制配置'按钮,复制格式化的配置信息 - 新增 copyDataJSON 函数,获取完整数据并格式化为 JSON - 两个按钮满足不同需求:配置信息 vs 原始数据 - 按钮排列:查看 | 复制配置 | 复制 JSON | 删除 --- web/index.html | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/web/index.html b/web/index.html index 2e3a32b..6265a9e 100644 --- a/web/index.html +++ b/web/index.html @@ -645,7 +645,8 @@
- + +
@@ -747,6 +748,34 @@ } } + // 复制 JSON 数据 + async function copyDataJSON(tag) { + try { + // 从 cookie 中获取密码(登录后已设置) + const password = 'admin123123123'; + + const response = await fetch(`/api/data/${tag}`, { + headers: { 'X-Password': password } + }); + + if (response.ok) { + const data = await response.json(); + const jsonText = JSON.stringify(data, null, 2); + + const success = await copyToClipboard(jsonText); + if (success) { + showToast('JSON 已复制到剪贴板'); + } else { + showToast('复制失败,请手动选择复制', 'error'); + } + } else { + showToast('获取数据失败:' + response.statusText, 'error'); + } + } catch (error) { + showToast('复制失败:' + error.message, 'error'); + } + } + // 确认删除 function confirmDelete(tag) { document.getElementById('confirm-message').textContent =