mirror of
https://github.com/EstrellaXD/Auto_Bangumi.git
synced 2026-04-15 02:50:42 +08:00
fix: bugs, add disable rss api.
This commit is contained in:
@@ -80,11 +80,13 @@ async def program_status(current_user=Depends(get_current_user)):
|
||||
return {
|
||||
"status": False,
|
||||
"version": VERSION,
|
||||
"first_run": program.first_run,
|
||||
}
|
||||
else:
|
||||
return {
|
||||
"status": True,
|
||||
"version": VERSION,
|
||||
"first_run": program.first_run,
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -47,6 +47,23 @@ async def delete_rss(rss_id: int, current_user=Depends(get_current_user)):
|
||||
)
|
||||
|
||||
|
||||
@router.patch(path="/disable/{rss_id}", response_model=APIResponse)
|
||||
async def disable_rss(rss_id: int, current_user=Depends(get_current_user)):
|
||||
if not current_user:
|
||||
raise UNAUTHORIZED
|
||||
with RSSEngine() as engine:
|
||||
if engine.rss.disable(rss_id):
|
||||
return JSONResponse(
|
||||
status_code=200,
|
||||
content={"msg_en": "Disable RSS successfully.", "msg_zh": "禁用 RSS 成功。"},
|
||||
)
|
||||
else:
|
||||
return JSONResponse(
|
||||
status_code=406,
|
||||
content={"msg_en": "Disable RSS failed.", "msg_zh": "禁用 RSS 失败。"},
|
||||
)
|
||||
|
||||
|
||||
@router.patch(path="/update/{rss_id}", response_model=APIResponse)
|
||||
async def update_rss(
|
||||
rss_id: int, data: RSSUpdate, current_user=Depends(get_current_user)
|
||||
|
||||
Reference in New Issue
Block a user