Hooked up new OPML route to UI; turned RSS and OPML feed buttons into links
This commit is contained in:
parent
48d84d76cd
commit
0a73b27d4a
5 changed files with 26 additions and 17 deletions
|
|
@ -40,11 +40,12 @@ defmodule PinchflatWeb.Sources.SourceHTML do
|
||||||
end
|
end
|
||||||
|
|
||||||
def rss_feed_url(conn, source) do
|
def rss_feed_url(conn, source) do
|
||||||
|
# TODO: finally address this. I shouldn't have to use concatination here
|
||||||
url(conn, ~p"/sources/#{source.uuid}/feed") <> ".xml"
|
url(conn, ~p"/sources/#{source.uuid}/feed") <> ".xml"
|
||||||
end
|
end
|
||||||
|
|
||||||
def opml_feed_url(conn) do
|
def opml_feed_url(conn) do
|
||||||
url(conn, ~p"/sources/opml") <> ".xml"
|
url(conn, ~p"/sources/opml.xml?#{[route_token: Settings.get!(:route_token)]}")
|
||||||
end
|
end
|
||||||
|
|
||||||
def output_path_template_override_placeholders(media_profiles) do
|
def output_path_template_override_placeholders(media_profiles) do
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,16 @@
|
||||||
<.button_dropdown text="Actions" class="justify-center w-full sm:w-50">
|
<.button_dropdown text="Actions" class="justify-center w-full sm:w-50">
|
||||||
<:option>
|
<:option>
|
||||||
<span
|
<.link href={rss_feed_url(@conn, @source)} x-data="{ copied: false }" x-on:click={~s"
|
||||||
x-data="{ copied: false }"
|
$event.preventDefault();
|
||||||
x-on:click={"
|
|
||||||
copyWithCallbacks(
|
copyWithCallbacks(
|
||||||
'#{rss_feed_url(@conn, @source)}',
|
'#{rss_feed_url(@conn, @source)}',
|
||||||
() => copied = true,
|
() => copied = true,
|
||||||
() => copied = false
|
() => copied = false
|
||||||
)
|
)
|
||||||
"}
|
"}>
|
||||||
>
|
|
||||||
Copy RSS Feed
|
Copy RSS Feed
|
||||||
<span x-show="copied" x-transition.duration.150ms><.icon name="hero-check" class="ml-2 h-4 w-4" /></span>
|
<span x-show="copied" x-transition.duration.150ms><.icon name="hero-check" class="ml-2 h-4 w-4" /></span>
|
||||||
</span>
|
</.link>
|
||||||
</:option>
|
</:option>
|
||||||
<:option>
|
<:option>
|
||||||
<span x-data="{ copied: false }" x-on:click={~s"
|
<span x-data="{ copied: false }" x-on:click={~s"
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,17 @@
|
||||||
<div class="mb-6 flex gap-3 flex-row items-center justify-between">
|
<div class="mb-6 flex gap-3 flex-row items-center justify-between">
|
||||||
<h2 class="text-title-md2 font-bold text-black dark:text-white">Sources</h2>
|
<h2 class="text-title-md2 font-bold text-black dark:text-white">Sources</h2>
|
||||||
<nav>
|
<nav class="flex items-center justify-between gap-6">
|
||||||
<.button color="bg-transparent" x-data="{ copied: false }" x-on:click={~s"
|
<.link href={opml_feed_url(@conn)} x-data="{ copied: false }" x-on:click={~s"
|
||||||
|
$event.preventDefault();
|
||||||
copyWithCallbacks(
|
copyWithCallbacks(
|
||||||
'#{opml_feed_url(@conn)}',
|
'#{opml_feed_url(@conn)}',
|
||||||
() => copied = true,
|
() => copied = true,
|
||||||
() => copied = false
|
() => copied = false
|
||||||
)
|
)
|
||||||
"}>
|
"}>
|
||||||
Copy OPML Feed
|
Copy OPML <span class="hidden sm:inline">Feed</span>
|
||||||
<span x-show="copied" x-transition.duration.150ms><.icon name="hero-check" class="ml-2 h-4 w-4" /></span>
|
<span x-show="copied" x-transition.duration.150ms><.icon name="hero-check" class="ml-2 h-4 w-4" /></span>
|
||||||
</.button>
|
</.link>
|
||||||
<.link href={~p"/sources/new"}>
|
<.link href={~p"/sources/new"}>
|
||||||
<.button color="bg-primary" rounding="rounded-lg">
|
<.button color="bg-primary" rounding="rounded-lg">
|
||||||
<span class="font-bold mx-2">+</span> New <span class="hidden sm:inline pl-1">Source</span>
|
<span class="font-bold mx-2">+</span> New <span class="hidden sm:inline pl-1">Source</span>
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,13 @@ defmodule PinchflatWeb.Endpoint do
|
||||||
Phoenix.Controller.put_router_url(conn, new_base_url)
|
Phoenix.Controller.put_router_url(conn, new_base_url)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Some podcast clients require file extensions, and others still will _add_
|
||||||
|
# file extensions to XML files if they don't have them. This plug removes
|
||||||
|
# the extension from the path so that the correct route is matched, regardless
|
||||||
|
# of the provided extension.
|
||||||
|
#
|
||||||
|
# This has the downside of in-app generated verified routes not working with
|
||||||
|
# extensions so this behaviour may change in the future.
|
||||||
defp strip_trailing_extension(%{path_info: []} = conn, _opts), do: conn
|
defp strip_trailing_extension(%{path_info: []} = conn, _opts), do: conn
|
||||||
|
|
||||||
defp strip_trailing_extension(conn, _opts) do
|
defp strip_trailing_extension(conn, _opts) do
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,9 @@ defmodule PinchflatWeb.Router do
|
||||||
plug :allow_iframe_embed
|
plug :allow_iframe_embed
|
||||||
end
|
end
|
||||||
|
|
||||||
pipeline :api, do: plug(:accepts, ["json"])
|
pipeline :api do
|
||||||
|
plug :accepts, ["json"]
|
||||||
|
end
|
||||||
|
|
||||||
scope "/", PinchflatWeb do
|
scope "/", PinchflatWeb do
|
||||||
pipe_through [:maybe_basic_auth, :token_protected_route]
|
pipe_through [:maybe_basic_auth, :token_protected_route]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue