fix: bugs, add disable rss api.

This commit is contained in:
EstrellaXD
2023-08-29 19:28:44 +08:00
parent 4a509deb16
commit 7ccee98e2e
13 changed files with 105 additions and 55 deletions

View File

@@ -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,
}

View File

@@ -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)