Improve RSS feed token authentication logging and error handling
This commit is contained in:
+6
-3
@@ -419,9 +419,12 @@ async def get_media(channel: str, post_id: int, file_unique_id: str, digest: str
|
||||
@app.get("/rss/{channel}", response_class=Response)
|
||||
@app.get("/rss/{channel}/{token}", response_class=Response)
|
||||
async def get_rss_feed(channel: str, token: str | None = None, limit: int = 20):
|
||||
if Config["token"] and token != Config["token"]:
|
||||
logger.error(f"Invalid token for RSS feed: {token}")
|
||||
#raise HTTPException(status_code=403, detail="Invalid token")
|
||||
if Config["token"]:
|
||||
if token != Config["token"]:
|
||||
logger.error(f"Invalid token for RSS feed: {token}")
|
||||
raise HTTPException(status_code=403, detail="Invalid token")
|
||||
else:
|
||||
logger.info(f"Valid token for RSS feed: {token}")
|
||||
|
||||
try:
|
||||
rss_content = await generate_channel_rss(channel, client=client.client, limit=limit)
|
||||
|
||||
Reference in New Issue
Block a user