mirror of
https://gitcode.com/JianFeeeee/TrulyMEM-TrueHumanMEM.git
synced 2026-09-22 18:08:12 +00:00
本轮实现功能: 1. 多用户隔离:每个用户独立 config.json + graph.db 2. TUI 登录页 + 旧版自动迁移(core/migrate.py) 3. Admin/User 角色体系(core/embedded_db.py) 4. Web 后台管理 API(userinfo + admin CRUD) 5. Web 设置页用户管理区(仅 admin 可见) 6. TUI 侧栏配置区权限同步(非 admin 隐藏 Web 服务设置) 7. Web 服务打包为独立二进制(trulymem-web) 8. 双入口 PyInstaller 构建脚本(TUI + Web) 9. 活动记录器(core/activity_recorder.py) 10. 静态页面模板(登录/设置/首次引导)
229 lines
7.5 KiB
HTML
229 lines
7.5 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="zh-CN">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>登录 - TrulyMEM</title>
|
|
<style>
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
}
|
|
body {
|
|
font-family: 'Courier New', monospace;
|
|
background: #0a0a1a;
|
|
color: #ffffff;
|
|
overflow: hidden;
|
|
width: 100vw;
|
|
height: 100vh;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
position: relative;
|
|
}
|
|
body::before {
|
|
content: '';
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
background:
|
|
radial-gradient(2px 2px at 20px 30px, #eee, transparent),
|
|
radial-gradient(2px 2px at 40px 70px, rgba(255,255,255,0.8), transparent),
|
|
radial-gradient(1px 1px at 90px 40px, #fff, transparent),
|
|
radial-gradient(1px 1px at 130px 80px, rgba(255,255,255,0.6), transparent),
|
|
radial-gradient(2px 2px at 160px 30px, #ddd, transparent);
|
|
background-repeat: repeat;
|
|
background-size: 200px 100px;
|
|
animation: twinkle 5s ease-in-out infinite alternate;
|
|
z-index: 0;
|
|
}
|
|
@keyframes twinkle {
|
|
0% { opacity: 0.5; }
|
|
100% { opacity: 1; }
|
|
}
|
|
.login-container {
|
|
position: relative;
|
|
z-index: 1;
|
|
width: 400px;
|
|
padding: 40px;
|
|
background: rgba(10, 10, 26, 0.9);
|
|
border-radius: 12px;
|
|
border: 1px solid rgba(100, 100, 255, 0.3);
|
|
box-shadow:
|
|
0 0 20px rgba(68, 136, 255, 0.2),
|
|
0 0 60px rgba(68, 136, 255, 0.1),
|
|
inset 0 0 20px rgba(68, 136, 255, 0.05);
|
|
backdrop-filter: blur(10px);
|
|
}
|
|
.login-title {
|
|
text-align: center;
|
|
font-size: 28px;
|
|
margin-bottom: 10px;
|
|
color: #4488ff;
|
|
text-shadow: 0 0 10px rgba(68, 136, 255, 0.5);
|
|
letter-spacing: 2px;
|
|
}
|
|
.login-subtitle {
|
|
text-align: center;
|
|
font-size: 14px;
|
|
color: #8888aa;
|
|
margin-bottom: 30px;
|
|
}
|
|
.form-group {
|
|
margin-bottom: 20px;
|
|
}
|
|
.form-group label {
|
|
display: block;
|
|
margin-bottom: 8px;
|
|
color: #aaaacc;
|
|
font-size: 14px;
|
|
}
|
|
.form-group input {
|
|
width: 100%;
|
|
padding: 12px 16px;
|
|
background: rgba(20, 20, 40, 0.8);
|
|
border: 1px solid rgba(100, 100, 255, 0.3);
|
|
border-radius: 6px;
|
|
color: #ffffff;
|
|
font-family: 'Courier New', monospace;
|
|
font-size: 14px;
|
|
transition: all 0.3s;
|
|
}
|
|
.form-group input:focus {
|
|
outline: none;
|
|
border-color: #4488ff;
|
|
box-shadow: 0 0 10px rgba(68, 136, 255, 0.3);
|
|
}
|
|
.form-group input::placeholder {
|
|
color: #555577;
|
|
}
|
|
.login-btn {
|
|
width: 100%;
|
|
padding: 14px;
|
|
background: linear-gradient(135deg, rgba(68, 136, 255, 0.3), rgba(68, 136, 255, 0.1));
|
|
border: 1px solid rgba(68, 136, 255, 0.5);
|
|
border-radius: 6px;
|
|
color: #ffffff;
|
|
font-family: 'Courier New', monospace;
|
|
font-size: 16px;
|
|
cursor: pointer;
|
|
transition: all 0.3s;
|
|
position: relative;
|
|
letter-spacing: 1px;
|
|
}
|
|
.login-btn:hover {
|
|
background: linear-gradient(135deg, rgba(68, 136, 255, 0.5), rgba(68, 136, 255, 0.3));
|
|
box-shadow: 0 0 15px rgba(68, 136, 255, 0.4);
|
|
}
|
|
.login-btn:disabled {
|
|
opacity: 0.6;
|
|
cursor: not-allowed;
|
|
}
|
|
.login-btn .spinner {
|
|
display: none;
|
|
width: 16px;
|
|
height: 16px;
|
|
border: 2px solid rgba(255, 255, 255, 0.3);
|
|
border-top-color: #ffffff;
|
|
border-radius: 50%;
|
|
animation: spin 0.6s linear infinite;
|
|
position: absolute;
|
|
left: 50%;
|
|
top: 50%;
|
|
transform: translate(-50%, -50%);
|
|
}
|
|
.login-btn.loading .spinner {
|
|
display: block;
|
|
}
|
|
.login-btn.loading span {
|
|
visibility: hidden;
|
|
}
|
|
@keyframes spin {
|
|
to { transform: translate(-50%, -50%) rotate(360deg); }
|
|
}
|
|
.error-message {
|
|
display: none;
|
|
margin-top: 15px;
|
|
padding: 12px;
|
|
background: rgba(255, 68, 68, 0.15);
|
|
border: 1px solid rgba(255, 68, 68, 0.4);
|
|
border-radius: 6px;
|
|
color: #ff6b6b;
|
|
font-size: 13px;
|
|
text-align: center;
|
|
}
|
|
.error-message.show {
|
|
display: block;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="login-container">
|
|
<h1 class="login-title">记忆星图</h1>
|
|
<p class="login-subtitle">TrulyMEM - 登录以继续</p>
|
|
|
|
<form id="loginForm">
|
|
<div class="form-group">
|
|
<label for="username">用户名</label>
|
|
<input type="text" id="username" name="username" placeholder="请输入用户名" required>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="password">密码</label>
|
|
<input type="password" id="password" name="password" placeholder="请输入密码" required>
|
|
</div>
|
|
<button type="submit" class="login-btn" id="loginBtn">
|
|
<span>登 录</span>
|
|
<div class="spinner"></div>
|
|
</button>
|
|
</form>
|
|
|
|
<div class="error-message" id="errorMsg"></div>
|
|
</div>
|
|
|
|
<script>
|
|
const loginForm = document.getElementById('loginForm');
|
|
const loginBtn = document.getElementById('loginBtn');
|
|
const errorMsg = document.getElementById('errorMsg');
|
|
|
|
loginForm.addEventListener('submit', async (e) => {
|
|
e.preventDefault();
|
|
|
|
const username = document.getElementById('username').value;
|
|
const password = document.getElementById('password').value;
|
|
|
|
errorMsg.classList.remove('show');
|
|
loginBtn.classList.add('loading');
|
|
loginBtn.disabled = true;
|
|
|
|
try {
|
|
const response = await fetch('/api/login', {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
body: JSON.stringify({ username, password })
|
|
});
|
|
|
|
const data = await response.json();
|
|
|
|
if (data.success) {
|
|
window.location.href = '/graph.html';
|
|
} else {
|
|
errorMsg.textContent = data.error || '登录失败';
|
|
errorMsg.classList.add('show');
|
|
}
|
|
} catch (err) {
|
|
errorMsg.textContent = '网络错误,请重试';
|
|
errorMsg.classList.add('show');
|
|
} finally {
|
|
loginBtn.classList.remove('loading');
|
|
loginBtn.disabled = false;
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|