commit 714f24b134f484bb9868385bfe7d36e3bd52a8f4
parent d6071a60f1450e0fceb98780615d0005b52767df
Author: Amit Dutta <mail@amit.is-a.dev>
Date: Thu, 3 Sep 2026 18:49:36 +0530
Refactor API routes and update raw URL handling
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/app/main.py b/app/main.py
@@ -105,16 +105,16 @@ async def handle_upload(files: list[UploadFile] = File(...), _ = Depends(verify_
results.append({
"filename": file.filename,
"cdn_url": f"{CDN_BASE_URL}/{hf_path}",
- "raw_url": f"{RAW_BASE_URL}/{hf_path}" # Updated to use new raw subdomain
+ "raw_url": f"{RAW_BASE_URL}/{hf_path}"
})
return {"files": results}
-@app.get("/ping", response_class=PlainTextResponse)
+@app.api_route("/ping", methods=["GET", "HEAD"], response_class=PlainTextResponse)
async def ping():
return "Server is awake!"
-@app.get("/{path:path}")
+@app.api_route("/{path:path}", methods=["GET", "HEAD"])
async def serve(request: Request, path: str):
clean_path = path.strip("/")