diff --git a/app/main.py b/app/main.py index e782d0a..903b2c1 100644 --- a/app/main.py +++ b/app/main.py @@ -53,7 +53,16 @@ def get_xml_data(server: str, ticket_path: str): @app.get("/", response_class=HTMLResponse) async def index(request: Request): - return templates.TemplateResponse("index.html", {"request": request}) + # 提供默认的 release_data 和 obtain_data + return templates.TemplateResponse( + "index.html", + { + "request": request, + "release_data": None, # 默认值 + "obtain_data": None, # 默认值 + "server": None, # 默认服务器地址为空 + }, + ) @app.post("/fetch", response_class=HTMLResponse) diff --git a/app/templates/index.html b/app/templates/index.html index fcd2837..52dc8e3 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -16,7 +16,7 @@
- {% if obtain_data.response_code == "" %} + {% if obtain_data.response_code | default ("") == "" %}

Please input your server to check.

{% elif obtain_data.error %}

{{ obtain_data.error }}