完善设备端体验与微信校验支持

This commit is contained in:
stu2not
2026-07-07 16:58:05 +08:00
parent b4fef6d2e0
commit 937e3023fc
38 changed files with 3377 additions and 51 deletions

View File

@@ -0,0 +1,18 @@
from pathlib import Path
from fastapi import APIRouter, HTTPException
from fastapi.responses import PlainTextResponse
router = APIRouter()
_VERIFY_FILES = {
"HXNd3XMbPq.txt": Path(__file__).resolve().parent.parent / "docs" / "HXNd3XMbPq.txt",
}
@router.get("/{filename}", response_class=PlainTextResponse, include_in_schema=False)
async def get_wechat_verify_file(filename: str) -> PlainTextResponse:
file_path = _VERIFY_FILES.get(filename)
if file_path is None or not file_path.is_file():
raise HTTPException(status_code=404, detail="Not Found")
return PlainTextResponse(file_path.read_text(encoding="utf-8").strip())