From aad3e696a254606073dda410a7da10cf9f329717 Mon Sep 17 00:00:00 2001 From: Codebuddy Date: Thu, 27 Aug 2026 10:56:15 +0800 Subject: [PATCH] =?utf8?q?feat:=20=E6=96=B0=E5=A2=9E=E9=BB=91=E7=99=BD?= =?utf8?q?=E7=81=B0=E7=BB=88=E7=AB=AF=E9=A3=8E=E6=A0=BC=E7=AB=99=E7=82=B9?= =?utf8?q?=E5=9B=BE=E6=A0=87=EF=BC=88favicon=20+=20=E7=99=BB=E5=BD=95?= =?utf8?q?=E9=A1=B5=20logo=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit - 新增 frontend/favicon.svg:圆角方块 + 白色 > 提示符 + 灰色光标,黑/白/灰极简设计 - 后端新增 /favicon.svg 路由(image/svg+xml,缓存 1 天) - frontend/index.html 添加 并替换登录页 🤖 emoji 为同款内联 SVG Co-Authored-By: CodeBuddy --- backend/app.py | 15 ++++++++++++++- frontend/favicon.svg | 6 ++++++ frontend/index.html | 10 +++++++++- 3 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 frontend/favicon.svg diff --git a/backend/app.py b/backend/app.py index cae45d0..f804338 100644 --- a/backend/app.py +++ b/backend/app.py @@ -30,7 +30,7 @@ import zipfile import uvicorn from fastapi import FastAPI, WebSocket, WebSocketDisconnect, Request -from fastapi.responses import HTMLResponse, JSONResponse +from fastapi.responses import HTMLResponse, JSONResponse, Response # JWT from jose import jwt, JWTError @@ -511,6 +511,19 @@ async def index(): return HTMLResponse(load_html(), headers={"Cache-Control": "no-store"}) +# 站点图标(黑白灰终端提示符风格 SVG),供浏览器标签页 / 收藏夹使用 +FAVICON_FILE = FRONTEND_DIR / "favicon.svg" +@app.get("/favicon.svg") +async def favicon(): + if not FAVICON_FILE.exists(): + return Response(status_code=404) + return Response( + FAVICON_FILE.read_text(encoding="utf-8"), + media_type="image/svg+xml", + headers={"Cache-Control": "public, max-age=86400"}, + ) + + # 设计说明 / 帮助页(独立静态 HTML,可从应用内“❓ 帮助”打开,支持打印为 PDF) HELP_FILE = FRONTEND_DIR / "help.html" @app.get("/help") diff --git a/frontend/favicon.svg b/frontend/favicon.svg new file mode 100644 index 0000000..3a0be9a --- /dev/null +++ b/frontend/favicon.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/frontend/index.html b/frontend/index.html index b12986a..997c642 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -4,6 +4,7 @@ Codebuddy Web Console +