New Database
This commit is contained in:
@@ -261,7 +261,6 @@
|
||||
<button type="button" id="kick-all-users-btn" class="btn-danger">🚫 踢掉所有用户</button>
|
||||
</div>
|
||||
<p style="font-size:13px;color:#E05555;margin-bottom:12px;">🚫 踢掉所有用户:所有用户的控制端与显示端立即全部下线(含当前设备),需二次验证身份。</p>
|
||||
<div id="pending-requests" style="margin-bottom:16px;"></div>
|
||||
<div id="user-list"></div>
|
||||
</div>
|
||||
</section>
|
||||
@@ -315,6 +314,23 @@
|
||||
<div style="margin-top:6px;font-size:12px;color:var(--text-dim);">包含当前控制端与所有显示端,全部立即下线。</div>
|
||||
<div id="mode-msg" style="margin-top:8px;font-size:13px;color:var(--text-dim);"></div>
|
||||
</div>
|
||||
<div class="section" id="db-admin-section" style="display:none;">
|
||||
<h3>数据库管理</h3>
|
||||
<p style="font-size:13px;color:var(--text-dim);margin-bottom:12px;">
|
||||
仅 Root 可用。可导入旧版 SQLite 数据库文件(*.db)或本系统导出的备份(JSON),导入会<strong>覆盖当前全部数据(含所有账户的登录凭据)</strong>(单事务执行,失败自动回滚、不影响现有数据),且<strong>所有设备将下线需重新登录</strong>。导出的备份同样包含凭据,请妥善保管。请勿导入不可信的备份文件。
|
||||
</p>
|
||||
<div style="font-size:13px;margin-bottom:10px;">
|
||||
当前状态: <span id="db-status" style="color:var(--text-dim);">加载中...</span>
|
||||
</div>
|
||||
<div style="display:flex;gap:8px;flex-wrap:wrap;margin-bottom:10px;">
|
||||
<button type="button" id="db-export-btn" class="btn-secondary">⬇️ 导出现有数据库</button>
|
||||
</div>
|
||||
<form id="db-import-form" class="inline-form">
|
||||
<input type="file" id="db-import-file" accept=".db,.sqlite,.sqlite3,.json" style="max-width:260px;">
|
||||
<button type="submit" id="db-import-btn" class="btn-primary">⬆️ 导入数据库(自动识别 SQLite / 备份 JSON)</button>
|
||||
</form>
|
||||
<div id="db-admin-msg" style="margin-top:8px;font-size:13px;color:var(--text-dim);"></div>
|
||||
</div>
|
||||
<div class="section">
|
||||
<h3>时区设置</h3>
|
||||
<div style="font-size:13px;color:var(--text-dim);margin-bottom:10px;">
|
||||
|
||||
@@ -206,10 +206,6 @@
|
||||
<button id="recovery-submit">验证恢复码</button>
|
||||
<div class="back-link" id="back-to-totp">← 返回 TOTP</div>
|
||||
</div>
|
||||
|
||||
<div style="margin-top:16px;font-size:12px;color:var(--text-dim);">
|
||||
<a href="/register-request" style="color:var(--text-dim);">还没有账号?申请账号</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
@@ -215,10 +215,6 @@
|
||||
<span class="recovery-link" id="show-totp">返回 TOTP</span>
|
||||
</div>
|
||||
|
||||
<div style="margin-top:20px;font-size:13px;">
|
||||
<a href="/register-request" style="color:var(--accent);text-decoration:none;">还没有账号?申请账号</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
@@ -1,151 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>申请账号 - Cal Display</title>
|
||||
<style>
|
||||
:root {
|
||||
--bg: #0f1117;
|
||||
--card-bg: #1a1d2e;
|
||||
--text: #e0e0e0;
|
||||
--text-dim: #888;
|
||||
--accent: #4A90D9;
|
||||
--accent-green: #4CAF50;
|
||||
--accent-red: #E05555;
|
||||
--radius: 12px;
|
||||
--input-bg: #242838;
|
||||
--input-border: rgba(255,255,255,0.14);
|
||||
--divider: rgba(255,255,255,0.16);
|
||||
--card-border: rgba(255,255,255,0.10);
|
||||
--soft-bg: rgba(255,255,255,0.06);
|
||||
--shadow: 0 4px 24px rgba(0,0,0,0.30);
|
||||
}
|
||||
/* 浅色主题覆盖 */
|
||||
.theme-light {
|
||||
--bg: #e8edf4;
|
||||
--card-bg: #ffffff;
|
||||
--text: #1c2333;
|
||||
--text-dim: #5b6a7e;
|
||||
--accent: #2f6fb2;
|
||||
--accent-green: #3a9450;
|
||||
--accent-red: #c74545;
|
||||
--radius: 12px;
|
||||
--input-bg: #fafafa;
|
||||
--input-border: #d7dfe8;
|
||||
--divider: #d7dfe8;
|
||||
--card-border: transparent;
|
||||
--soft-bg: #eef2f7;
|
||||
--shadow: 0 2px 12px rgba(30,40,60,0.08);
|
||||
}
|
||||
/* 主题切换动画 */
|
||||
html.theme-anim, html.theme-anim * {
|
||||
transition: background-color 0.55s ease, color 0.55s ease,
|
||||
border-color 0.55s ease, box-shadow 0.55s ease !important;
|
||||
}
|
||||
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
html, body {
|
||||
min-height: 100vh;
|
||||
font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
|
||||
background: var(--bg);
|
||||
color: var(--text);
|
||||
display: flex; align-items: center; justify-content: center;
|
||||
}
|
||||
.box {
|
||||
width: min(92vw, 420px);
|
||||
background: var(--card-bg);
|
||||
border-radius: var(--radius);
|
||||
padding: 32px;
|
||||
box-shadow: 0 2px 12px rgba(0,0,0,0.06);
|
||||
text-align: center;
|
||||
}
|
||||
.box h1 { font-size: 22px; margin-bottom: 8px; font-weight: 600; }
|
||||
.box .subtitle { font-size: 14px; color: var(--text-dim); margin-bottom: 24px; line-height: 1.6; }
|
||||
input[type="text"] {
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
font-size: 16px;
|
||||
border-radius: 8px;
|
||||
border: 1px solid #ddd;
|
||||
background: #fafafa;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
button {
|
||||
width: 100%;
|
||||
padding: 13px;
|
||||
font-size: 16px;
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
background: var(--accent);
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
}
|
||||
button:hover { opacity: 0.9; }
|
||||
button:disabled { opacity: 0.5; cursor: not-allowed; }
|
||||
.msg { min-height: 22px; font-size: 14px; margin-top: 12px; }
|
||||
.msg.ok { color: var(--accent-green); }
|
||||
.msg.err { color: var(--accent-red); }
|
||||
.back { display: inline-block; margin-top: 16px; font-size: 13px; color: var(--accent); text-decoration: none; }
|
||||
|
||||
/* ═══ 主题适配(注册申请页)═══ */
|
||||
body { background: var(--bg); }
|
||||
.box { background: var(--card-bg); box-shadow: var(--shadow); border: 1px solid var(--card-border); }
|
||||
.box input[type="text"] { background: var(--input-bg); border-color: var(--input-border); color: var(--text); }
|
||||
</style>
|
||||
<script src="/static/js/theme.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="box">
|
||||
<h1>📋 申请账号</h1>
|
||||
<p class="subtitle">填写你的称呼,提交后等待管理员确认。管理员确认后你会收到一个临时验证码,用它登录并配置你自己的登录方式(Passkey 或 TOTP)。</p>
|
||||
<input type="text" id="remark-input" placeholder="你的称呼 / 备注" maxlength="64" autocomplete="off">
|
||||
<button id="submit-btn">提交申请</button>
|
||||
<div class="msg" id="msg"></div>
|
||||
<a class="back" href="/login">← 返回登录</a>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
(function () {
|
||||
'use strict';
|
||||
var btn = document.getElementById('submit-btn');
|
||||
var input = document.getElementById('remark-input');
|
||||
var msg = document.getElementById('msg');
|
||||
|
||||
function submit() {
|
||||
var remark = input.value.trim();
|
||||
if (!remark) { msg.className = 'msg err'; msg.textContent = '请填写你的称呼'; return; }
|
||||
btn.disabled = true;
|
||||
msg.textContent = '提交中...';
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('POST', '/api/auth/register-request');
|
||||
xhr.setRequestHeader('Content-Type', 'application/json');
|
||||
xhr.onload = function () {
|
||||
var res = JSON.parse(xhr.responseText || '{}');
|
||||
if (xhr.status === 200 || xhr.status === 201) {
|
||||
msg.className = 'msg ok';
|
||||
msg.textContent = res.message || '✅ 已提交申请,请等待管理员确认';
|
||||
input.disabled = true;
|
||||
btn.disabled = true;
|
||||
btn.textContent = '已提交';
|
||||
} else {
|
||||
msg.className = 'msg err';
|
||||
msg.textContent = res.error || '提交失败,请稍后再试';
|
||||
btn.disabled = false;
|
||||
}
|
||||
};
|
||||
xhr.onerror = function () {
|
||||
msg.className = 'msg err';
|
||||
msg.textContent = '网络错误,请重试';
|
||||
btn.disabled = false;
|
||||
};
|
||||
xhr.send(JSON.stringify({ remark: remark }));
|
||||
}
|
||||
|
||||
btn.addEventListener('click', submit);
|
||||
input.addEventListener('keydown', function (e) { if (e.key === 'Enter') submit(); });
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user