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 =