aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/web/endpoint.ex
diff options
context:
space:
mode:
authoreugenijm <eugenijm@protonmail.com>2019-02-01 21:56:18 +0300
committereugenijm <eugenijm@protonmail.com>2019-02-01 21:58:43 +0300
commitd747bd98700dd8b015ef48e8a2a1df0025012b0a (patch)
tree33e96d85f882c0a4d4a0e0d9ed859dabca3167b6 /lib/pleroma/web/endpoint.ex
parent389e6a878a7636c29f57cb4603abd33f4cca98d9 (diff)
downloadpleroma-d747bd98700dd8b015ef48e8a2a1df0025012b0a.tar.gz
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.
Diffstat (limited to 'lib/pleroma/web/endpoint.ex')
-rw-r--r--lib/pleroma/web/endpoint.ex4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/pleroma/web/endpoint.ex b/lib/pleroma/web/endpoint.ex
index 2b156fdfd..ebbc5d7b5 100644
--- a/lib/pleroma/web/endpoint.ex
+++ b/lib/pleroma/web/endpoint.ex
@@ -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