系统设置增加备份恢复:中控本机备份,并可下载各客户端备份。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-10-04 06:50:44 +08:00
parent 9f3a1f5b66
commit a983fff6e0
7 changed files with 720 additions and 2 deletions
+1 -1
View File
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{% block title %}期权中控{% endblock %}</title>
<link rel="stylesheet" href="{{ url_for('static', filename='hub.css') }}?v=4">
<link rel="stylesheet" href="{{ url_for('static', filename='hub.css') }}?v=5">
</head>
<body class="{% if request.path.startswith('/login') %}page-login{% elif request.path.startswith('/desk') %}page-desk{% elif request.path.startswith('/stats') %}page-stats{% elif request.path == '/' %}page-dashboard{% endif %}">
{% if session.get('logged_in') %}
+51
View File
@@ -74,5 +74,56 @@
</div>
</form>
</section>
<section class="panel settings-card settings-card--backup" style="grid-column:1/-1">
<div class="settings-card-head">
<span class="settings-badge">Backup</span>
<h2>备份恢复</h2>
<p class="muted">每天北京时间 03:00 自动备份,保留最近 10 天。中控可下载本机与各客户端备份;客户端仅能下载自己的。</p>
</div>
<div class="backup-block">
<div class="backup-block-head">
<h3>中控备份</h3>
<p class="muted field-hint">目录 <code id="hub-backup-dir">/root/crypto_okx_hub_backups</code> · 含 <code>.env</code> 与 <code>hub.db</code></p>
<div class="settings-actions">
<button type="button" class="settings-primary" id="hub-backup-create">立即备份</button>
<button type="button" class="btn-secondary" id="hub-backup-refresh">刷新</button>
<span class="muted" id="hub-backup-status" style="font-size:.8rem"></span>
</div>
</div>
<div class="table-wrap">
<table class="backup-table">
<thead><tr><th>文件</th><th>时间</th><th>大小</th><th>操作</th></tr></thead>
<tbody id="hub-backup-body"><tr><td colspan="4" class="muted">加载中…</td></tr></tbody>
</table>
</div>
</div>
<div class="backup-block" style="margin-top:18px">
<div class="backup-block-head">
<h3>客户端备份</h3>
<p class="muted field-hint">经 Bridge 拉取各机备份列表,可下载到本地</p>
<div class="settings-actions">
<label class="settings-field" style="margin:0;min-width:12rem">
客户端
<select id="client-backup-instance"></select>
</label>
<button type="button" class="btn-secondary" id="client-backup-refresh">刷新</button>
<span class="muted" id="client-backup-status" style="font-size:.8rem"></span>
</div>
</div>
<div class="table-wrap">
<table class="backup-table">
<thead><tr><th>文件</th><th>时间</th><th>大小</th><th>操作</th></tr></thead>
<tbody id="client-backup-body"><tr><td colspan="4" class="muted">请选择客户端</td></tr></tbody>
</table>
</div>
</div>
</section>
</div>
{% endblock %}
{% block scripts %}
<script src="{{ url_for('static', filename='settings_backup.js') }}?v=1"></script>
<script>HubSettingsBackup.boot();</script>
{% endblock %}