Spaces:
Sleeping
Sleeping
jslmmfboom-coder commited on
Commit ·
815407f
1
Parent(s): e601def
Fix: add /cover.png endpoint for static file serving
Browse files- app.py +9 -0
- index.html +2 -2
app.py
CHANGED
|
@@ -134,6 +134,15 @@ async def serve_frontend():
|
|
| 134 |
return FileResponse(FRONTEND_PATH)
|
| 135 |
|
| 136 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
@app.post("/api/login")
|
| 138 |
async def login(username: str = Form(...)):
|
| 139 |
try:
|
|
|
|
| 134 |
return FileResponse(FRONTEND_PATH)
|
| 135 |
|
| 136 |
|
| 137 |
+
@app.get("/cover.png")
|
| 138 |
+
async def serve_cover():
|
| 139 |
+
"""提供背景图片 cover.png"""
|
| 140 |
+
cover_path = os.path.join(BASE_DIR, 'cover.png')
|
| 141 |
+
if os.path.exists(cover_path):
|
| 142 |
+
return FileResponse(cover_path, media_type='image/png')
|
| 143 |
+
raise HTTPException(status_code=404, detail="cover not found")
|
| 144 |
+
|
| 145 |
+
|
| 146 |
@app.post("/api/login")
|
| 147 |
async def login(username: str = Form(...)):
|
| 148 |
try:
|
index.html
CHANGED
|
@@ -32,7 +32,7 @@ body{
|
|
| 32 |
/* === 背景图 cover.png === */
|
| 33 |
.bg-cover{
|
| 34 |
position:fixed;inset:0;z-index:-3;
|
| 35 |
-
background-image:url('cover.png');
|
| 36 |
background-size:cover;background-position:center;
|
| 37 |
opacity:0.35;
|
| 38 |
}
|
|
@@ -78,7 +78,7 @@ body{
|
|
| 78 |
}
|
| 79 |
.parallax-bg .bg-cover-inner{
|
| 80 |
position:absolute;inset:0;
|
| 81 |
-
background-image:url('cover.png');
|
| 82 |
background-size:cover;background-position:center;
|
| 83 |
opacity:0.3;
|
| 84 |
}
|
|
|
|
| 32 |
/* === 背景图 cover.png === */
|
| 33 |
.bg-cover{
|
| 34 |
position:fixed;inset:0;z-index:-3;
|
| 35 |
+
background-image:url('/cover.png');
|
| 36 |
background-size:cover;background-position:center;
|
| 37 |
opacity:0.35;
|
| 38 |
}
|
|
|
|
| 78 |
}
|
| 79 |
.parallax-bg .bg-cover-inner{
|
| 80 |
position:absolute;inset:0;
|
| 81 |
+
background-image:url('/cover.png');
|
| 82 |
background-size:cover;background-position:center;
|
| 83 |
opacity:0.3;
|
| 84 |
}
|