完善设备端体验与微信校验支持
This commit is contained in:
18
talkingq-url/api/wechat_verify.py
Normal file
18
talkingq-url/api/wechat_verify.py
Normal 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())
|
||||
Reference in New Issue
Block a user