modify the project, everything go under app folder

This commit is contained in:
2026-05-16 20:13:46 +08:00
parent 5be47649e2
commit ceea04299a
10 changed files with 9 additions and 9 deletions
-19
View File
@@ -1,19 +0,0 @@
from fastapi import Request, HTTPException
import jwt
import os
JWT_SECRET = os.getenv("JWT_SECRET")
JWT_ALGORITHM = os.getenv("JWT_ALGORITHM", "HS256")
def get_current_user(request: Request):
token = request.cookies.get("access_token")
if not token:
raise HTTPException(status_code=401, detail="Not authenticated")
try:
payload = jwt.decode(token, JWT_SECRET, algorithms=[JWT_ALGORITHM])
return payload["user_id"]
except:
raise HTTPException(status_code=401, detail="Invalid token")