Skip to content

Commit e9c34a3

Browse files
committed
fix:issues/26
1 parent 3344f47 commit e9c34a3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

main.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ async def admin_delete(code: str, s: AsyncSession = Depends(get_session)):
9898
async def config(s: AsyncSession = Depends(get_session)):
9999
# 从数据库获取系统配置
100100
data = (await s.execute(select(Values).filter(Values.key == 'config'))).scalar_one_or_none()
101-
return {'detail': '获取成功', 'data': data.value if data else {}}
101+
return {'detail': '获取成功', 'data': data.value if data else {'banners': []}}
102102

103103

104104
@app.get('/')
@@ -114,7 +114,8 @@ async def banner(request: Request, s: AsyncSession = Depends(get_session)):
114114
if config and config.value.get('banners'):
115115
return {
116116
'detail': '查询成功',
117-
'data': config.value['banners']
117+
'data': config.value['banners'],
118+
'enable': request.headers.get('pwd', '') == settings.ADMIN_PASSWORD or settings.ENABLE_UPLOAD,
118119
}
119120
# 如果不存在config,就返回默认的banner
120121
return {

0 commit comments

Comments
 (0)