From 1ee361938e8d55bffb66d816a17a27de2141346e Mon Sep 17 00:00:00 2001 From: danilo silva Date: Sat, 4 Jul 2020 06:47:23 +0000 Subject: [PATCH] fix: fetch the hostname from the url to print the current link --- lib/openpod_web/templates/feed/feed.xml.eex | 4 ++-- lib/openpod_web/views/feed_view.ex | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/lib/openpod_web/templates/feed/feed.xml.eex b/lib/openpod_web/templates/feed/feed.xml.eex index ca9dcef..595009d 100644 --- a/lib/openpod_web/templates/feed/feed.xml.eex +++ b/lib/openpod_web/templates/feed/feed.xml.eex @@ -2,7 +2,7 @@ <%= @podcast.link %> - ]]> + <%= @podcast.language %> ©2022 ]]> ]]> @@ -21,7 +21,7 @@ <%= @podcast.keywords |> Enum.join(", ") %> ]]> - + <%= @podcast.pubDate |> Calendar.DateTime.Format.rfc2822 %> <![CDATA[<%= @podcast.title %>]]> ]]> diff --git a/lib/openpod_web/views/feed_view.ex b/lib/openpod_web/views/feed_view.ex index 0523e7c..817fb09 100644 --- a/lib/openpod_web/views/feed_view.ex +++ b/lib/openpod_web/views/feed_view.ex @@ -6,4 +6,19 @@ defmodule OpenpodWeb.FeedView do sec = length - (min * 60) |> Integer.to_string |> String.pad_leading(2, "0") "#{min}:#{sec}" end + + def base_url(conn) do + scheme = conn + |> Map.fetch!(:scheme) + |> Atom.to_string + + host = conn + |> Map.fetch!(:host) + + port = conn + |> Map.fetch!(:port) + |> Integer.to_string + + "#{scheme}://#{host}:#{port}" + end end