change opml endpoint to be more inline with the other routes

This commit is contained in:
robs 2024-12-19 22:34:23 +01:00
parent 4cf7d357c7
commit 1f4104236b
3 changed files with 16 additions and 16 deletions

View file

@ -44,7 +44,7 @@ defmodule PinchflatWeb.Sources.SourceHTML do
end
def opml_feed_url(conn) do
url(conn, ~p"/podcasts/opml") <> ".xml"
url(conn, ~p"/sources/opml") <> ".xml"
end
def output_path_template_override_placeholders(media_profiles) do

View file

@ -23,6 +23,20 @@ defmodule PinchflatWeb.Router do
plug :maybe_basic_auth
end
# Routes in here _may not be_ protected by basic auth. This is necessary for
# media streaming to work for RSS podcast feeds.
scope "/", PinchflatWeb do
pipe_through :feeds
# has to match before /sources/:id
get "/sources/opml", Podcasts.PodcastController, :opml_feed
get "/sources/:uuid/feed", Podcasts.PodcastController, :rss_feed
get "/sources/:uuid/feed_image", Podcasts.PodcastController, :feed_image
get "/media/:uuid/episode_image", Podcasts.PodcastController, :episode_image
get "/media/:uuid/stream", MediaItems.MediaItemController, :stream
end
scope "/", PinchflatWeb do
pipe_through :browser
@ -48,20 +62,6 @@ defmodule PinchflatWeb.Router do
end
end
# Routes in here _may not be_ protected by basic auth. This is necessary for
# media streaming to work for RSS podcast feeds.
scope "/", PinchflatWeb do
pipe_through :feeds
get "/podcasts/opml", Podcasts.PodcastController, :opml_feed
get "/sources/:uuid/feed", Podcasts.PodcastController, :rss_feed
get "/sources/:uuid/feed_image", Podcasts.PodcastController, :feed_image
get "/media/:uuid/episode_image", Podcasts.PodcastController, :episode_image
get "/media/:uuid/stream", MediaItems.MediaItemController, :stream
end
# No auth or CSRF protection for the health check endpoint
scope "/", PinchflatWeb do
pipe_through :api

View file

@ -8,7 +8,7 @@ defmodule PinchflatWeb.PodcastControllerTest do
test "renders the XML document", %{conn: conn} do
source = source_fixture()
conn = get(conn, ~p"/podcasts/opml" <> ".xml")
conn = get(conn, ~p"/sources/opml" <> ".xml")
assert conn.status == 200
assert {"content-type", "application/opml+xml; charset=utf-8"} in conn.resp_headers