update:文件大小限制
This commit is contained in:
@@ -10,6 +10,10 @@ from core.settings import settings
|
||||
|
||||
|
||||
async def admin_required(authorization: Union[str, None] = Header(default=None), request: Request = None):
|
||||
if authorization != settings.admin_token:
|
||||
raise HTTPException(status_code=401, detail='未授权或授权校验失败')
|
||||
return True
|
||||
is_admin = authorization == settings.admin_token
|
||||
if request.url.path.startswith('/share/'):
|
||||
if not settings.openUpload and not is_admin:
|
||||
raise HTTPException(status_code=403, detail='本站未开启游客上传,如需上传请先登录后台')
|
||||
else:
|
||||
if not is_admin:
|
||||
raise HTTPException(status_code=401, detail='未授权或授权校验失败')
|
||||
|
||||
Reference in New Issue
Block a user