feat: 增加配置导入导出功能
This commit is contained in:
+35
-6
@@ -4,7 +4,7 @@
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>金价提醒 · Gold Price Watcher</title>
|
||||
<link rel="stylesheet" href="/styles.css?v=20261124q" />
|
||||
<link rel="stylesheet" href="/styles.css?v=20261124s" />
|
||||
</head>
|
||||
<body>
|
||||
<header class="topbar">
|
||||
@@ -194,11 +194,21 @@
|
||||
<label class="check"><input type="checkbox" id="appOpenBrowser" /> 启动时自动打开浏览器</label>
|
||||
</div>
|
||||
<p class="hint" id="configPathHint"></p>
|
||||
<div class="row">
|
||||
<button class="btn ghost" id="btnExportConfig">导出配置</button>
|
||||
<button class="btn ghost" id="btnImportConfig">导入配置</button>
|
||||
<input type="file" id="importFile" accept="application/json" hidden />
|
||||
</div>
|
||||
|
||||
<!-- 配置备份:导出为 JSON 文件、导入前自动备份当前配置 -->
|
||||
<div class="card setting-card">
|
||||
<div class="card-head"><h3>配置备份</h3></div>
|
||||
<p class="hint">导出成 JSON 文件,可用于换机迁移、分享给同事,或改坏配置后回滚;导入会<b>覆盖</b>当前全部配置(品种、规则、渠道、端口等),导入前程序会自动把现有配置备份到 <code>config/backups/</code>。</p>
|
||||
<div class="row wrap">
|
||||
<label class="check"><input type="checkbox" id="exportWithSecrets" /> 导出时包含密钥(邮箱密码 / WebHook 加签)</label>
|
||||
</div>
|
||||
<div class="row wrap">
|
||||
<button class="btn primary" id="btnExportConfig">导出配置</button>
|
||||
<button class="btn ghost" id="btnImportConfig">导入配置</button>
|
||||
<input type="file" id="importFile" accept="application/json,.json" hidden />
|
||||
</div>
|
||||
<p class="hint" id="backupListHint"></p>
|
||||
</div>
|
||||
|
||||
<div class="row sticky-save">
|
||||
@@ -369,8 +379,27 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ============ 弹窗:确认导入配置 ============ -->
|
||||
<div class="modal" id="modalImport" hidden>
|
||||
<div class="modal-box">
|
||||
<div class="modal-head">
|
||||
<h3>确认导入配置</h3>
|
||||
<button class="icon-btn" data-close="modalImport">✕</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p class="hint">导入会<b>覆盖</b>当前全部配置(品种、规则、通知渠道、端口等);导入前程序会自动把现有配置备份到 <code>config/backups/</code>,不满意可以用备份回滚。</p>
|
||||
<div class="import-summary" id="importSummary"></div>
|
||||
</div>
|
||||
<div class="modal-foot">
|
||||
<span class="test-result" id="importResult"></span>
|
||||
<button class="btn ghost" data-close="modalImport">取消</button>
|
||||
<button class="btn primary" id="btnConfirmImport">确认导入</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="toast-wrap" id="toastWrap"></div>
|
||||
<script src="/app.js?v=20261124q"></script>
|
||||
<script src="/app.js?v=20261124s"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user