Switch Phoenix back to upstream
See <https://github.com/phoenixframework/phoenix/pull/6094> for `:sec_websocket_protocol` -> `:sec_websocket_headers`
This commit is contained in:
parent
9fcf918e1c
commit
be327ca982
6 changed files with 12 additions and 10 deletions
|
|
@ -30,7 +30,7 @@ defmodule Pleroma.Web do
|
|||
|
||||
def controller do
|
||||
quote do
|
||||
use Phoenix.Controller, namespace: Pleroma.Web
|
||||
use Phoenix.Controller, formats: [json: "View", html: "View"]
|
||||
|
||||
import Plug.Conn
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ defmodule Pleroma.Web.Endpoint do
|
|||
websocket: [
|
||||
path: "/",
|
||||
compress: false,
|
||||
connect_info: [:sec_websocket_protocol],
|
||||
connect_info: [:sec_websocket_headers],
|
||||
error_handler: {Pleroma.Web.MastodonAPI.WebsocketHandler, :handle_error, []},
|
||||
fullsweep_after: 20
|
||||
]
|
||||
|
|
|
|||
|
|
@ -245,12 +245,14 @@ defmodule Pleroma.Web.MastodonAPI.WebsocketHandler do
|
|||
Plug.Conn.send_resp(conn, 404, "Not Found")
|
||||
end
|
||||
|
||||
defp find_access_token(%{
|
||||
connect_info: %{sec_websocket_protocol: [token]}
|
||||
}),
|
||||
do: token
|
||||
|
||||
defp find_access_token(%{params: %{"access_token" => token}}), do: token
|
||||
|
||||
defp find_access_token(%{connect_info: %{sec_websocket_headers: sec_headers}}),
|
||||
do:
|
||||
Enum.find_value(sec_headers, fn
|
||||
{"sec-websocket-protocol", v} -> v
|
||||
_ -> nil
|
||||
end)
|
||||
|
||||
defp find_access_token(_), do: nil
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue