aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorhref <href+git-pleroma@random.sh>2019-02-01 19:39:50 +0000
committerhref <href+git-pleroma@random.sh>2019-02-01 19:39:50 +0000
commitffbf306c9a03e88520c02690d5357d7a4937d961 (patch)
treec9f2d0fcabd8d335ac82cece05ad55f4e204b634 /lib
parent7e384a2425b5188ca76aad4b97172b553ca9b640 (diff)
parenta184811a605a56436cc5b9eae8ef5c3834285922 (diff)
downloadpleroma-ffbf306c9a03e88520c02690d5357d7a4937d961.tar.gz
Merge branch 'streaming-api-url-fix' into 'develop'
Fix WebSocket streaming API URL. See merge request pleroma/pleroma!756
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/web/endpoint.ex4
-rw-r--r--lib/pleroma/web/mastodon_api/mastodon_api_controller.ex2
2 files changed, 5 insertions, 1 deletions
diff --git a/lib/pleroma/web/endpoint.ex b/lib/pleroma/web/endpoint.ex
index 2b156fdfd..3eed047ca 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(url(), "http", "ws")
+ end
end
diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
index a94eb5c73..85769c3d7 100644
--- a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
+++ b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex
@@ -138,7 +138,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
version: "#{@mastodon_api_level} (compatible; #{Pleroma.Application.named_version()})",
email: Keyword.get(instance, :email),
urls: %{
- streaming_api: String.replace(Pleroma.Web.Endpoint.static_url(), "http", "ws")
+ streaming_api: Pleroma.Web.Endpoint.websocket_url()
},
stats: Stats.get_stats(),
thumbnail: Web.base_url() <> "/instance/thumbnail.jpeg",