Update main.py
Browse files
main.py
CHANGED
@@ -70,6 +70,10 @@ PROXY_URL = os.getenv("PROXY_URL")
|
|
70 |
async def verify_token(
|
71 |
request: Request, credentials: HTTPAuthorizationCredentials = Depends(security)
|
72 |
):
|
|
|
|
|
|
|
|
|
73 |
# 验证Bearer格式
|
74 |
if credentials.scheme != "Bearer":
|
75 |
raise HTTPException(
|
@@ -146,6 +150,11 @@ async def get_files(item: FileRequest):
|
|
146 |
)
|
147 |
|
148 |
|
|
|
|
|
|
|
|
|
|
|
149 |
@app.post("/offline")
|
150 |
async def offline(item: OfflineRequest):
|
151 |
return await THUNDERX_CLIENT.offline_download(
|
|
|
70 |
async def verify_token(
|
71 |
request: Request, credentials: HTTPAuthorizationCredentials = Depends(security)
|
72 |
):
|
73 |
+
excluded_paths = ["/"] # 需要排除的路径列表
|
74 |
+
if request.url.path in excluded_paths:
|
75 |
+
return # 直接跳过验证
|
76 |
+
|
77 |
# 验证Bearer格式
|
78 |
if credentials.scheme != "Bearer":
|
79 |
raise HTTPException(
|
|
|
150 |
)
|
151 |
|
152 |
|
153 |
+
@app.get("/files/{file_id}")
|
154 |
+
async def get_file_info(file_id: str):
|
155 |
+
return await THUNDERX_CLIENT.get_download_url(file_id)
|
156 |
+
|
157 |
+
|
158 |
@app.post("/offline")
|
159 |
async def offline(item: OfflineRequest):
|
160 |
return await THUNDERX_CLIENT.offline_download(
|