Spaces:
Sleeping
Sleeping
Upload 6 files
Browse files- app.py +12 -26
- templates/dashboard.html +0 -0
- templates/login.html +349 -339
app.py
CHANGED
@@ -18,6 +18,9 @@ app = Flask(__name__, template_folder='templates')
|
|
18 |
app.secret_key = os.environ.get("SECRET_KEY", "abacus_chat_proxy_secret_key")
|
19 |
app.config['PERMANENT_SESSION_LIFETIME'] = timedelta(days=7)
|
20 |
|
|
|
|
|
|
|
21 |
|
22 |
API_ENDPOINT_URL = "https://abacus.ai/api/v0/describeDeployment"
|
23 |
MODEL_LIST_URL = "https://abacus.ai/api/v0/listExternalApplications"
|
@@ -922,41 +925,22 @@ def get_compute_points_log(session, cookies, session_token):
|
|
922 |
print(f"获取计算点使用日志异常: {e}")
|
923 |
|
924 |
|
925 |
-
#
|
926 |
-
def get_space_url():
|
927 |
-
# 尝试从Hugging Face Space环境变量获取
|
928 |
-
space_url = os.environ.get("SPACE_URL")
|
929 |
-
if space_url:
|
930 |
-
return space_url
|
931 |
-
|
932 |
-
# 尝试构建URL
|
933 |
-
space_username = os.environ.get("SPACE_USERNAME")
|
934 |
-
space_name = os.environ.get("SPACE_NAME")
|
935 |
-
if space_username and space_name:
|
936 |
-
return f"https://{space_username}-{space_name}.hf.space"
|
937 |
-
|
938 |
-
# 如果无法从环境变量获取,返回默认值或None
|
939 |
-
return os.environ.get("CUSTOM_URL", None)
|
940 |
-
|
941 |
-
# 获取部署URL
|
942 |
-
SPACE_URL = get_space_url()
|
943 |
-
|
944 |
@app.route("/login", methods=["GET", "POST"])
|
945 |
def login():
|
946 |
error = None
|
947 |
-
space_url = SPACE_URL
|
948 |
-
|
949 |
if request.method == "POST":
|
950 |
password = request.form.get("password")
|
951 |
if password and hashlib.sha256(password.encode()).hexdigest() == PASSWORD:
|
952 |
flask_session['logged_in'] = True
|
953 |
flask_session.permanent = True
|
|
|
954 |
return redirect(url_for('dashboard'))
|
955 |
else:
|
956 |
-
#
|
957 |
-
error =
|
958 |
-
|
959 |
-
return render_template('login.html', error=error,
|
960 |
|
961 |
|
962 |
@app.route("/logout")
|
@@ -993,7 +977,9 @@ def dashboard():
|
|
993 |
model_stats=model_usage_stats,
|
994 |
total_tokens=total_tokens,
|
995 |
compute_points=compute_points,
|
996 |
-
compute_points_log=compute_points_log
|
|
|
|
|
997 |
)
|
998 |
|
999 |
|
|
|
18 |
app.secret_key = os.environ.get("SECRET_KEY", "abacus_chat_proxy_secret_key")
|
19 |
app.config['PERMANENT_SESSION_LIFETIME'] = timedelta(days=7)
|
20 |
|
21 |
+
# 获取 Hugging Face Space 主机名 (如果存在)
|
22 |
+
SPACE_HOST = os.environ.get("SPACE_HOST")
|
23 |
+
BASE_URL = f"https://{SPACE_HOST}" if SPACE_HOST else None
|
24 |
|
25 |
API_ENDPOINT_URL = "https://abacus.ai/api/v0/describeDeployment"
|
26 |
MODEL_LIST_URL = "https://abacus.ai/api/v0/listExternalApplications"
|
|
|
925 |
print(f"获取计算点使用日志异常: {e}")
|
926 |
|
927 |
|
928 |
+
# 添加登录相关路由
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
929 |
@app.route("/login", methods=["GET", "POST"])
|
930 |
def login():
|
931 |
error = None
|
|
|
|
|
932 |
if request.method == "POST":
|
933 |
password = request.form.get("password")
|
934 |
if password and hashlib.sha256(password.encode()).hexdigest() == PASSWORD:
|
935 |
flask_session['logged_in'] = True
|
936 |
flask_session.permanent = True
|
937 |
+
# 登录成功后重定向到仪表盘
|
938 |
return redirect(url_for('dashboard'))
|
939 |
else:
|
940 |
+
# 更新错误提示信息
|
941 |
+
error = "密码不正确。密码为您在环境变量 'password' 中设置的值,该值也用作 API 调用的验证密钥。"
|
942 |
+
# 将 BASE_URL 传递给模板
|
943 |
+
return render_template('login.html', error=error, base_url=BASE_URL)
|
944 |
|
945 |
|
946 |
@app.route("/logout")
|
|
|
977 |
model_stats=model_usage_stats,
|
978 |
total_tokens=total_tokens,
|
979 |
compute_points=compute_points,
|
980 |
+
compute_points_log=compute_points_log,
|
981 |
+
# 将 BASE_URL 传递给模板
|
982 |
+
base_url=BASE_URL
|
983 |
)
|
984 |
|
985 |
|
templates/dashboard.html
CHANGED
The diff for this file is too large to render.
See raw diff
|
|
templates/login.html
CHANGED
@@ -1,340 +1,350 @@
|
|
1 |
-
<!DOCTYPE html>
|
2 |
-
<html lang="zh-CN">
|
3 |
-
<head>
|
4 |
-
<meta charset="UTF-8">
|
5 |
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
-
<title>Abacus Chat Proxy - 登录</title>
|
7 |
-
<style>
|
8 |
-
:root {
|
9 |
-
--primary-color: #
|
10 |
-
--
|
11 |
-
--
|
12 |
-
--
|
13 |
-
--card-bg:
|
14 |
-
--
|
15 |
-
--
|
16 |
-
--error: #
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
:
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
width: 100%;
|
69 |
-
height: 100%;
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
}
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
}
|
135 |
-
|
136 |
-
.login-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
0
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
}
|
190 |
-
|
191 |
-
.
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
.
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
}
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
font-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
}
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
<
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
340 |
</html>
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="zh-CN">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>Abacus Chat Proxy - 登录</title>
|
7 |
+
<style>
|
8 |
+
:root {
|
9 |
+
--primary-color: #6f42c1;
|
10 |
+
--secondary-color: #4a32a8;
|
11 |
+
--bg-color: #0a0a1a;
|
12 |
+
--text-color: #e6e6ff;
|
13 |
+
--card-bg: rgba(30, 30, 60, 0.7);
|
14 |
+
--input-bg: rgba(40, 40, 80, 0.6);
|
15 |
+
--success-color: #36d399;
|
16 |
+
--error-color: #f87272;
|
17 |
+
}
|
18 |
+
|
19 |
+
* {
|
20 |
+
margin: 0;
|
21 |
+
padding: 0;
|
22 |
+
box-sizing: border-box;
|
23 |
+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
24 |
+
}
|
25 |
+
|
26 |
+
body {
|
27 |
+
min-height: 100vh;
|
28 |
+
display: flex;
|
29 |
+
align-items: center;
|
30 |
+
justify-content: center;
|
31 |
+
background-color: var(--bg-color);
|
32 |
+
background-image:
|
33 |
+
radial-gradient(circle at 20% 35%, rgba(111, 66, 193, 0.15) 0%, transparent 40%),
|
34 |
+
radial-gradient(circle at 80% 10%, rgba(70, 111, 171, 0.1) 0%, transparent 40%);
|
35 |
+
color: var(--text-color);
|
36 |
+
position: relative;
|
37 |
+
overflow: hidden;
|
38 |
+
}
|
39 |
+
|
40 |
+
/* 动态背景网格 */
|
41 |
+
.grid-background {
|
42 |
+
position: absolute;
|
43 |
+
top: 0;
|
44 |
+
left: 0;
|
45 |
+
width: 100%;
|
46 |
+
height: 100%;
|
47 |
+
background-image: linear-gradient(rgba(50, 50, 100, 0.05) 1px, transparent 1px),
|
48 |
+
linear-gradient(90deg, rgba(50, 50, 100, 0.05) 1px, transparent 1px);
|
49 |
+
background-size: 30px 30px;
|
50 |
+
z-index: -1;
|
51 |
+
animation: grid-move 20s linear infinite;
|
52 |
+
}
|
53 |
+
|
54 |
+
@keyframes grid-move {
|
55 |
+
0% {
|
56 |
+
transform: translateY(0);
|
57 |
+
}
|
58 |
+
100% {
|
59 |
+
transform: translateY(30px);
|
60 |
+
}
|
61 |
+
}
|
62 |
+
|
63 |
+
/* 浮动粒子效果 */
|
64 |
+
.particles {
|
65 |
+
position: absolute;
|
66 |
+
top: 0;
|
67 |
+
left: 0;
|
68 |
+
width: 100%;
|
69 |
+
height: 100%;
|
70 |
+
overflow: hidden;
|
71 |
+
z-index: -1;
|
72 |
+
}
|
73 |
+
|
74 |
+
.particle {
|
75 |
+
position: absolute;
|
76 |
+
display: block;
|
77 |
+
pointer-events: none;
|
78 |
+
width: 6px;
|
79 |
+
height: 6px;
|
80 |
+
background-color: rgba(111, 66, 193, 0.2);
|
81 |
+
border-radius: 50%;
|
82 |
+
animation: float 20s infinite ease-in-out;
|
83 |
+
}
|
84 |
+
|
85 |
+
@keyframes float {
|
86 |
+
0%, 100% {
|
87 |
+
transform: translateY(0) translateX(0);
|
88 |
+
opacity: 0;
|
89 |
+
}
|
90 |
+
50% {
|
91 |
+
opacity: 0.5;
|
92 |
+
}
|
93 |
+
25%, 75% {
|
94 |
+
transform: translateY(-100px) translateX(50px);
|
95 |
+
}
|
96 |
+
}
|
97 |
+
|
98 |
+
.login-card {
|
99 |
+
width: 380px;
|
100 |
+
padding: 2.5rem;
|
101 |
+
border-radius: 16px;
|
102 |
+
background: var(--card-bg);
|
103 |
+
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
|
104 |
+
backdrop-filter: blur(8px);
|
105 |
+
border: 1px solid rgba(255, 255, 255, 0.1);
|
106 |
+
z-index: 10;
|
107 |
+
animation: card-fade-in 0.6s ease-out;
|
108 |
+
}
|
109 |
+
|
110 |
+
@keyframes card-fade-in {
|
111 |
+
from {
|
112 |
+
opacity: 0;
|
113 |
+
transform: translateY(20px);
|
114 |
+
}
|
115 |
+
to {
|
116 |
+
opacity: 1;
|
117 |
+
transform: translateY(0);
|
118 |
+
}
|
119 |
+
}
|
120 |
+
|
121 |
+
.login-header {
|
122 |
+
text-align: center;
|
123 |
+
margin-bottom: 2rem;
|
124 |
+
}
|
125 |
+
|
126 |
+
.login-header h1 {
|
127 |
+
font-size: 2rem;
|
128 |
+
font-weight: 600;
|
129 |
+
margin-bottom: 0.5rem;
|
130 |
+
background: linear-gradient(45deg, #6f42c1, #5181f1);
|
131 |
+
-webkit-background-clip: text;
|
132 |
+
-webkit-text-fill-color: transparent;
|
133 |
+
letter-spacing: 0.5px;
|
134 |
+
}
|
135 |
+
|
136 |
+
.login-header p {
|
137 |
+
color: rgba(230, 230, 255, 0.7);
|
138 |
+
font-size: 0.95rem;
|
139 |
+
}
|
140 |
+
|
141 |
+
.login-form {
|
142 |
+
display: flex;
|
143 |
+
flex-direction: column;
|
144 |
+
}
|
145 |
+
|
146 |
+
.form-group {
|
147 |
+
margin-bottom: 1.5rem;
|
148 |
+
position: relative;
|
149 |
+
}
|
150 |
+
|
151 |
+
.form-group label {
|
152 |
+
display: block;
|
153 |
+
margin-bottom: 0.5rem;
|
154 |
+
font-size: 0.9rem;
|
155 |
+
font-weight: 500;
|
156 |
+
color: rgba(230, 230, 255, 0.9);
|
157 |
+
}
|
158 |
+
|
159 |
+
.form-control {
|
160 |
+
width: 100%;
|
161 |
+
padding: 0.75rem 1rem;
|
162 |
+
font-size: 1rem;
|
163 |
+
line-height: 1.5;
|
164 |
+
color: var(--text-color);
|
165 |
+
background-color: var(--input-bg);
|
166 |
+
border: 1px solid rgba(255, 255, 255, 0.1);
|
167 |
+
border-radius: 8px;
|
168 |
+
transition: all 0.2s ease;
|
169 |
+
outline: none;
|
170 |
+
}
|
171 |
+
|
172 |
+
.form-control:focus {
|
173 |
+
border-color: var(--primary-color);
|
174 |
+
box-shadow: 0 0 0 3px rgba(111, 66, 193, 0.2);
|
175 |
+
}
|
176 |
+
|
177 |
+
.btn {
|
178 |
+
display: inline-block;
|
179 |
+
font-weight: 500;
|
180 |
+
text-align: center;
|
181 |
+
vertical-align: middle;
|
182 |
+
cursor: pointer;
|
183 |
+
padding: 0.75rem 1rem;
|
184 |
+
font-size: 1rem;
|
185 |
+
line-height: 1.5;
|
186 |
+
border-radius: 8px;
|
187 |
+
transition: all 0.15s ease-in-out;
|
188 |
+
border: none;
|
189 |
+
}
|
190 |
+
|
191 |
+
.btn-primary {
|
192 |
+
color: #fff;
|
193 |
+
background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
|
194 |
+
box-shadow: 0 4px 10px rgba(111, 66, 193, 0.3);
|
195 |
+
position: relative;
|
196 |
+
overflow: hidden;
|
197 |
+
}
|
198 |
+
|
199 |
+
.btn-primary:hover {
|
200 |
+
transform: translateY(-2px);
|
201 |
+
box-shadow: 0 6px 15px rgba(111, 66, 193, 0.4);
|
202 |
+
}
|
203 |
+
|
204 |
+
.btn-primary:active {
|
205 |
+
transform: translateY(0);
|
206 |
+
}
|
207 |
+
|
208 |
+
/* 添加光效效果 */
|
209 |
+
.btn-primary::before {
|
210 |
+
content: '';
|
211 |
+
position: absolute;
|
212 |
+
top: -50%;
|
213 |
+
left: -50%;
|
214 |
+
width: 200%;
|
215 |
+
height: 200%;
|
216 |
+
background: linear-gradient(
|
217 |
+
to bottom right,
|
218 |
+
rgba(255, 255, 255, 0) 0%,
|
219 |
+
rgba(255, 255, 255, 0.1) 50%,
|
220 |
+
rgba(255, 255, 255, 0) 100%
|
221 |
+
);
|
222 |
+
transform: rotate(45deg);
|
223 |
+
animation: btn-shine 3s infinite;
|
224 |
+
}
|
225 |
+
|
226 |
+
@keyframes btn-shine {
|
227 |
+
0% {
|
228 |
+
left: -50%;
|
229 |
+
}
|
230 |
+
100% {
|
231 |
+
left: 150%;
|
232 |
+
}
|
233 |
+
}
|
234 |
+
|
235 |
+
.error-message {
|
236 |
+
background: rgba(248, 113, 113, 0.1); /* error-color with opacity */
|
237 |
+
color: var(--error-color);
|
238 |
+
padding: 1rem;
|
239 |
+
border-radius: 8px;
|
240 |
+
margin-bottom: 1.5rem;
|
241 |
+
border: 1px solid rgba(248, 113, 113, 0.3);
|
242 |
+
text-align: center;
|
243 |
+
font-size: 0.9rem;
|
244 |
+
line-height: 1.5; /* 增加行高以便阅读 */
|
245 |
+
}
|
246 |
+
|
247 |
+
.logo {
|
248 |
+
margin-bottom: 1rem;
|
249 |
+
font-size: 3rem;
|
250 |
+
animation: glow 2s infinite alternate;
|
251 |
+
}
|
252 |
+
|
253 |
+
@keyframes glow {
|
254 |
+
from {
|
255 |
+
text-shadow: 0 0 5px rgba(111, 66, 193, 0.5), 0 0 10px rgba(111, 66, 193, 0.5);
|
256 |
+
}
|
257 |
+
to {
|
258 |
+
text-shadow: 0 0 10px rgba(111, 66, 193, 0.8), 0 0 20px rgba(111, 66, 193, 0.8);
|
259 |
+
}
|
260 |
+
}
|
261 |
+
|
262 |
+
.info-text {
|
263 |
+
text-align: center;
|
264 |
+
color: rgba(230, 230, 255, 0.7);
|
265 |
+
margin-bottom: 1.5rem;
|
266 |
+
font-size: 0.9rem;
|
267 |
+
}
|
268 |
+
|
269 |
+
.info-text a {
|
270 |
+
color: var(--accent-color);
|
271 |
+
text-decoration: none;
|
272 |
+
font-weight: 600;
|
273 |
+
}
|
274 |
+
|
275 |
+
.info-text a:hover {
|
276 |
+
text-decoration: underline;
|
277 |
+
}
|
278 |
+
</style>
|
279 |
+
</head>
|
280 |
+
<body>
|
281 |
+
<div class="grid-background"></div>
|
282 |
+
<div class="particles">
|
283 |
+
<!-- 粒子元素会由JS生成 -->
|
284 |
+
</div>
|
285 |
+
|
286 |
+
<div class="login-card">
|
287 |
+
<div class="login-header">
|
288 |
+
<div class="logo">🤖</div>
|
289 |
+
<h1>Abacus Chat Proxy</h1>
|
290 |
+
<p>请输入访问密码</p>
|
291 |
+
</div>
|
292 |
+
|
293 |
+
{% if base_url %}
|
294 |
+
<p class="info-text">
|
295 |
+
请访问 <a href="{{ base_url }}" target="_blank">{{ base_url }}</a> 来登录查看使用情况。
|
296 |
+
</p>
|
297 |
+
{% endif %}
|
298 |
+
|
299 |
+
<div class="error-message" id="error-message">
|
300 |
+
{{ error }}
|
301 |
+
</div>
|
302 |
+
|
303 |
+
<form class="login-form" method="post" action="/login">
|
304 |
+
<div class="form-group">
|
305 |
+
<label for="password">密码</label>
|
306 |
+
<input type="password" class="form-control" id="password" name="password" placeholder="请输入访问密码" required>
|
307 |
+
</div>
|
308 |
+
|
309 |
+
<button type="submit" class="btn btn-primary">登录</button>
|
310 |
+
</form>
|
311 |
+
</div>
|
312 |
+
|
313 |
+
<script>
|
314 |
+
// 创建浮动粒子
|
315 |
+
function createParticles() {
|
316 |
+
const particlesContainer = document.querySelector('.particles');
|
317 |
+
const particleCount = 20;
|
318 |
+
|
319 |
+
for (let i = 0; i < particleCount; i++) {
|
320 |
+
const particle = document.createElement('div');
|
321 |
+
particle.className = 'particle';
|
322 |
+
|
323 |
+
// 随机位置和大小
|
324 |
+
const size = Math.random() * 5 + 2;
|
325 |
+
const x = Math.random() * 100;
|
326 |
+
const y = Math.random() * 100;
|
327 |
+
|
328 |
+
particle.style.width = `${size}px`;
|
329 |
+
particle.style.height = `${size}px`;
|
330 |
+
particle.style.left = `${x}%`;
|
331 |
+
particle.style.top = `${y}%`;
|
332 |
+
|
333 |
+
// 随机动画延迟
|
334 |
+
particle.style.animationDelay = `${Math.random() * 10}s`;
|
335 |
+
particle.style.animationDuration = `${Math.random() * 10 + 10}s`;
|
336 |
+
|
337 |
+
// 随机透明度
|
338 |
+
particle.style.opacity = Math.random() * 0.5;
|
339 |
+
|
340 |
+
particlesContainer.appendChild(particle);
|
341 |
+
}
|
342 |
+
}
|
343 |
+
|
344 |
+
// 页面加载时创建粒子
|
345 |
+
window.addEventListener('load', () => {
|
346 |
+
createParticles();
|
347 |
+
});
|
348 |
+
</script>
|
349 |
+
</body>
|
350 |
</html>
|