Verified Commit 5346fabf authored by Haelwenn's avatar Haelwenn
Browse files

Web.MastodonAPI.MastodonSocket: Add unauthentified websocket endpoints

reported by soka on CRTNet
parent 675653ce
Pipeline #4656 passed with stages
in 8 minutes and 34 seconds
......@@ -45,6 +45,24 @@ def connect(params, socket) do
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 handle(:text, message, _state) do
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment