logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma
commit: ffbf306c9a03e88520c02690d5357d7a4937d961
parent: 7e384a2425b5188ca76aad4b97172b553ca9b640
Author: href <href+git-pleroma@random.sh>
Date:   Fri,  1 Feb 2019 19:39:50 +0000

Merge branch 'streaming-api-url-fix' into 'develop'

Fix WebSocket streaming API URL.

See merge request pleroma/pleroma!756

Diffstat:

Mlib/pleroma/web/endpoint.ex4++++
Mlib/pleroma/web/mastodon_api/mastodon_api_controller.ex2+-
2 files changed, 5 insertions(+), 1 deletion(-)

diff --git 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 @@ -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",