mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-23 15:05:45 +00:00
Web.MastodonAPI.MastodonSocket: Add unauthentified websocket endpoints
reported by soka on CRTNet
This commit is contained in:
parent
675653ceb7
commit
5346fabf14
|
@ -45,6 +45,24 @@ defmodule Pleroma.Web.MastodonAPI.MastodonSocket do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def connect(%{"stream" => stream} = params, socket)
|
||||||
|
when stream in ["public", "public:local", "hashtag"] do
|
||||||
|
topic =
|
||||||
|
case stream do
|
||||||
|
"hashtag" -> "hashtag:#{params["tag"]}"
|
||||||
|
_ -> stream
|
||||||
|
end
|
||||||
|
|
||||||
|
with socket =
|
||||||
|
socket
|
||||||
|
|> assign(:topic, topic) do
|
||||||
|
Pleroma.Web.Streamer.add_socket(topic, socket)
|
||||||
|
{:ok, socket}
|
||||||
|
else
|
||||||
|
_e -> :error
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def id(_), do: nil
|
def id(_), do: nil
|
||||||
|
|
||||||
def handle(:text, message, _state) do
|
def handle(:text, message, _state) do
|
||||||
|
|
Loading…
Reference in a new issue