99c3e3e853
- Hash路由: #/dashboard #/files #/plugins/xxx 支持刷新保持/前进后退 - 登录过期保留hash,登录后自动跳回原页面 - 插件WebUI页面内联加载到page-container(不再弹新窗) - 插件页面HTML自动处理: style提取/body剥离/script执行/padding归零 - 侧边栏新增「插件面板」可折叠项,展开列出所有已注册插件页面 - 内存卡片显示 已用/总容量(百分比右侧) - 插件开发指南新增 2.6 WebUI页面开发章节 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
41 lines
1.8 KiB
HTML
41 lines
1.8 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>SenSu 登录</title>
|
|
<link rel="stylesheet" href="./static/css/style.css">
|
|
</head>
|
|
<body>
|
|
<div class="login-wrapper">
|
|
<div class="login-card">
|
|
<h2>🐱 SenSu Login</h2>
|
|
<div class="input-group"><label>用户名</label><input class="input" type="text" id="u" value="admin"></div>
|
|
<div class="input-group"><label>密码</label><input class="input" type="password" id="p" value="admin"></div>
|
|
<button class="btn btn-filled" style="width:100%;margin-top:8px" onclick="doLogin()">进入系统</button>
|
|
<div id="err" class="err-msg"></div>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
async function doLogin() {
|
|
const u = document.getElementById('u').value;
|
|
const p = document.getElementById('p').value;
|
|
const err = document.getElementById('err');
|
|
err.textContent = "验证中...";
|
|
try {
|
|
const res = await fetch('./api/login', {
|
|
method: 'POST', headers: {'Content-Type': 'application/json'},
|
|
credentials: 'include', body: JSON.stringify({username: u, password: p})
|
|
});
|
|
const data = await res.json();
|
|
if(res.ok && data.success) {
|
|
var hash = sessionStorage.getItem('sensu_redirect_hash') || '';
|
|
sessionStorage.removeItem('sensu_redirect_hash');
|
|
window.location.href = './home.html' + hash;
|
|
}
|
|
else err.textContent = data.msg || "凭证错误";
|
|
} catch(e) { err.textContent = "网络异常"; }
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|