fix: 游客上传
This commit is contained in:
@@ -68,12 +68,12 @@ async def admin_required(authorization: str = Header(default=None), request: Req
|
|||||||
验证管理员权限
|
验证管理员权限
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
if not authorization or not authorization.startswith('Bearer '):
|
if not authorization or not authorization.startswith("Bearer "):
|
||||||
raise ValueError("缺少Bearer token")
|
is_admin = False
|
||||||
|
else:
|
||||||
token = authorization.split(' ')[1]
|
token = authorization.split(" ")[1]
|
||||||
payload = verify_token(token)
|
payload = verify_token(token)
|
||||||
is_admin = payload.get("is_admin", False)
|
is_admin = payload.get("is_admin", False)
|
||||||
|
|
||||||
if request.url.path.startswith('/share/'):
|
if request.url.path.startswith('/share/'):
|
||||||
if not settings.openUpload and not is_admin:
|
if not settings.openUpload and not is_admin:
|
||||||
|
|||||||
Reference in New Issue
Block a user