diff --git a/discord_rss_bot/main.py b/discord_rss_bot/main.py index 93e8e09..de211fe 100644 --- a/discord_rss_bot/main.py +++ b/discord_rss_bot/main.py @@ -193,6 +193,26 @@ async def create_feed(feed_url: str = Form(), webhook_dropdown: str = Form()) -> return RedirectResponse(url=f"/feed/?feed_url={feed_url}", status_code=303) +@app.post("/pause") +async def pause_feed(feed_url: str = Form()) -> dict[str, str] | RedirectResponse: + clean_url: str = urllib.parse.quote(feed_url) + + # Disable/pause the feed. + reader.disable_feed_updates(feed_url) + + return RedirectResponse(url=f"/feed/?feed_url={clean_url}", status_code=303) + + +@app.post("/unpause") +async def unpause_feed(feed_url: str = Form()) -> dict[str, str] | RedirectResponse: + clean_url: str = urllib.parse.quote(feed_url) + + # Enable/unpause the feed. + reader.enable_feed_updates(feed_url) + + return RedirectResponse(url=f"/feed/?feed_url={clean_url}", status_code=303) + + @app.get("/add", response_class=HTMLResponse) def get_add(request: Request) -> _TemplateResponse: """ diff --git a/discord_rss_bot/templates/feed.html b/discord_rss_bot/templates/feed.html index 96f5a0b..f2cd78f 100644 --- a/discord_rss_bot/templates/feed.html +++ b/discord_rss_bot/templates/feed.html @@ -39,6 +39,15 @@ + {% if not feed.updates_enabled %} +
+ +
+ {% else %} +
+ +
+ {% endif %} {% for entry in entries %}