Use String.replace_leading instead of String.replace for getting websocket streaming api url.

Extract the login responsible for obtaining websocket URL into the corresponding
Endpoint function.
This commit is contained in:
eugenijm 2019-02-01 21:56:18 +03:00
commit d747bd9870
2 changed files with 5 additions and 1 deletions

View file

@ -82,4 +82,8 @@ defmodule Pleroma.Web.Endpoint do
port = System.get_env("PORT") || raise "expected the PORT environment variable to be set"
{:ok, Keyword.put(config, :http, [:inet6, port: port])}
end
def websocket_url do
String.replace_leading(static_url(), "http", "ws")
end
end