xiaoyukkkk's picture
Upload login.html
b197a12 verified
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>登录</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
background: #fafaf9;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
padding: 20px;
}
.container {
background: #fff;
border: 1px solid #e5e5e5;
border-radius: 12px;
width: 100%;
max-width: 380px;
padding: 40px 32px;
}
.header {
text-align: center;
margin-bottom: 32px;
}
h1 {
font-size: 22px;
font-weight: 600;
color: #1d1d1f;
margin-bottom: 6px;
}
.subtitle {
font-size: 14px;
color: #86868b;
}
.error-box {
padding: 12px 14px;
background: #fff5f5;
border: 1px solid #fecaca;
border-radius: 8px;
color: #dc2626;
font-size: 14px;
margin-bottom: 20px;
}
label {
display: block;
font-size: 14px;
font-weight: 500;
color: #1d1d1f;
margin-bottom: 8px;
}
input[type="password"] {
width: 100%;
padding: 12px 14px;
border: 1px solid #d4d4d4;
border-radius: 8px;
font-size: 15px;
color: #1d1d1f;
background: #fff;
transition: border-color 0.15s;
outline: none;
margin-bottom: 20px;
}
input[type="password"]:focus {
border-color: #0071e3;
}
input[type="password"]::placeholder {
color: #c7c7cc;
}
button {
width: 100%;
padding: 12px;
background: #0071e3;
color: #fff;
border: none;
border-radius: 8px;
font-size: 15px;
font-weight: 500;
cursor: pointer;
transition: background 0.15s;
}
button:hover {
background: #0077ed;
}
button:active {
background: #006dd1;
}
.hint {
margin-top: 20px;
padding: 12px;
background: #f6f6f8;
border-radius: 8px;
font-size: 13px;
color: #86868b;
line-height: 1.5;
}
.iframe-hint {
margin-top: 16px;
padding: 12px 14px;
background: #fff4e6;
border: 1px solid #ffd666;
border-radius: 8px;
font-size: 13px;
color: #d46b08;
line-height: 1.5;
display: none;
}
.iframe-hint a {
color: #0071e3;
text-decoration: none;
font-weight: 600;
}
.iframe-hint a:hover {
text-decoration: underline;
}
@media (max-width: 480px) {
.container {
padding: 32px 24px;
}
}
</style>
<script>
// 检测是否在 iframe 内
if (window.self !== window.top) {
document.addEventListener('DOMContentLoaded', function() {
const hint = document.getElementById('iframe-hint');
if (hint) {
hint.style.display = 'block';
// 获取当前完整 URL(去掉 iframe 参数)
const currentUrl = window.location.href.replace(/[?&]__theme=.*?(&|$)/, '');
const link = document.getElementById('direct-link');
if (link) {
link.href = currentUrl;
}
}
});
}
</script>
</head>
<body>
<div class="container">
<div class="header">
<h1>管理员登录</h1>
<p class="subtitle">Gemini Business API</p>
</div>
{% if error %}
<div class="error-box">
⚠️ {{ error }}
</div>
{% endif %}
<form method="POST" action="{{ request.url.path }}">
<label for="admin_key">密钥</label>
<input
type="password"
id="admin_key"
name="admin_key"
placeholder="输入 ADMIN_KEY"
required
autofocus
>
<button type="submit">登录</button>
</form>
<div class="hint">
会话保持 24 小时
</div>
<div id="iframe-hint" class="iframe-hint">
⚠️ HuggingFace 内部无法登录,<a id="direct-link" href="#" target="_blank">点我跳转</a>
</div>
</div>
</body>
</html>