diff options
author | tusooa <tusooa@kazv.moe> | 2022-10-09 02:05:27 +0000 |
---|---|---|
committer | tusooa <tusooa@kazv.moe> | 2022-10-09 02:05:27 +0000 |
commit | 59b8c920f62649b5b5902cf0e569749abe3d7991 (patch) | |
tree | 870cd2b7f437978fca89150db4d0703cc8898391 /lib/pleroma/web/mastodon_api | |
parent | b22843a98247cf683764759f3e447845f3fcedf8 (diff) | |
parent | 31fd41de0cbca28cd2461e96384460596e54e9e9 (diff) | |
download | pleroma-stable.tar.gz |
Release/2.4.4
See merge request pleroma/pleroma!3761
Diffstat (limited to 'lib/pleroma/web/mastodon_api')
-rw-r--r-- | lib/pleroma/web/mastodon_api/websocket_handler.ex | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/pleroma/web/mastodon_api/websocket_handler.ex b/lib/pleroma/web/mastodon_api/websocket_handler.ex index 0d1faffbd..930e9eb29 100644 --- a/lib/pleroma/web/mastodon_api/websocket_handler.ex +++ b/lib/pleroma/web/mastodon_api/websocket_handler.ex @@ -32,7 +32,8 @@ defmodule Pleroma.Web.MastodonAPI.WebsocketHandler do req end - {:cowboy_websocket, req, %{user: user, topic: topic, count: 0, timer: nil}, + {:cowboy_websocket, req, + %{user: user, topic: topic, oauth_token: oauth_token, count: 0, timer: nil}, %{idle_timeout: @timeout}} else {:error, :bad_topic} -> @@ -54,7 +55,7 @@ defmodule Pleroma.Web.MastodonAPI.WebsocketHandler do }, topic #{state.topic}" ) - Streamer.add_socket(state.topic, state.user) + Streamer.add_socket(state.topic, state.oauth_token) {:ok, %{state | timer: timer()}} end @@ -100,6 +101,10 @@ defmodule Pleroma.Web.MastodonAPI.WebsocketHandler do {:reply, :ping, %{state | timer: nil, count: 0}, :hibernate} end + def websocket_info(:close, state) do + {:stop, state} + end + # State can be `[]` only in case we terminate before switching to websocket, # we already log errors for these cases in `init/1`, so just do nothing here def terminate(_reason, _req, []), do: :ok |