Merge branch 'develop' into dtluna/pleroma-refactor/1

This commit is contained in:
Roger Braun 2017-05-05 11:46:59 +02:00
commit c48c381e90
63 changed files with 3293 additions and 228 deletions

View file

@ -58,28 +58,7 @@ defmodule Pleroma.Web do
apply(__MODULE__, which, [])
end
def host do
settings = Application.get_env(:pleroma, Pleroma.Web.Endpoint)
settings
|> Keyword.fetch!(:url)
|> Keyword.fetch!(:host)
end
def base_url do
settings = Application.get_env(:pleroma, Pleroma.Web.Endpoint)
host = host()
protocol = settings |> Keyword.fetch!(:protocol)
port_fragment = with {:ok, protocol_info} <- settings
|> Keyword.fetch(String.to_atom(protocol)),
{:ok, port} <- protocol_info |> Keyword.fetch(:port)
do
":#{port}"
else _e ->
""
end
"#{protocol}://#{host}#{port_fragment}"
Pleroma.Web.Endpoint.url
end
end