Skip to content

Commit

Permalink
Move private helpers to the bottom
Browse files Browse the repository at this point in the history
  • Loading branch information
ku1ik committed Jul 1, 2024
1 parent ed2ecc5 commit 2d270d7
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions lib/asciinema_web/router.ex
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,6 @@ defmodule AsciinemaWeb.Router do
plug :put_secure_browser_headers
end

defp format_specific_plugs(conn, []) do
format_specific_plugs(conn, Phoenix.Controller.get_format(conn))
end

defp format_specific_plugs(conn, "html") do
conn
|> fetch_session([])
|> fetch_flash([])
|> protect_from_forgery([])
|> AsciinemaWeb.Plug.Authn.call([])
end

defp format_specific_plugs(conn, _other), do: conn

pipeline :oembed do
plug :accepts, ["json", "xml"]
plug :put_secure_browser_headers
Expand Down Expand Up @@ -110,4 +96,18 @@ defmodule AsciinemaWeb.Router do
forward "/mailbox", Plug.Swoosh.MailboxPreview
end
end

defp format_specific_plugs(conn, []) do
format_specific_plugs(conn, Phoenix.Controller.get_format(conn))
end

defp format_specific_plugs(conn, "html") do
conn
|> fetch_session([])
|> fetch_flash([])
|> protect_from_forgery([])
|> AsciinemaWeb.Plug.Authn.call([])
end

defp format_specific_plugs(conn, _other), do: conn
end

0 comments on commit 2d270d7

Please sign in to comment.