diff --git a/discord_rss_bot/main.py b/discord_rss_bot/main.py index 088de75..851bca6 100644 --- a/discord_rss_bot/main.py +++ b/discord_rss_bot/main.py @@ -139,8 +139,8 @@ def get_add(request: Request): return templates.TemplateResponse("add.html", context) -@app.post("/feed", response_class=HTMLResponse) -async def get_feed(request: Request, feed_url: str = Form()): +@app.get("/feed/{feed_url:path}", response_class=HTMLResponse) +async def get_feed(feed_url: str, request: Request): """ Get a feed by URL. @@ -151,7 +151,9 @@ async def get_feed(request: Request, feed_url: str = Form()): Returns: HTMLResponse: The HTML response. """ - logger.info(f"Get feed: {feed_url}") + # Convert the URL to a valid URL. + logger.info(f"Got feed: {feed_url}") + feed = reader.get_feed(feed_url) return templates.TemplateResponse("feed.html", {"request": request, "feed": feed}) diff --git a/discord_rss_bot/templates/index.html b/discord_rss_bot/templates/index.html index c445852..4feac10 100644 --- a/discord_rss_bot/templates/index.html +++ b/discord_rss_bot/templates/index.html @@ -9,11 +9,7 @@ {% if feeds %} {% for feed in feeds %} -
+ {{ feed.url }} {% endfor %} {% else %}No feeds yet