From 2d270d74e5c1fa39eb5056b38818f9c22be99e1f Mon Sep 17 00:00:00 2001 From: Marcin Kulik Date: Mon, 1 Jul 2024 20:24:01 +0200 Subject: [PATCH] Move private helpers to the bottom --- lib/asciinema_web/router.ex | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/asciinema_web/router.ex b/lib/asciinema_web/router.ex index 6fe88612d..d1217ebe2 100644 --- a/lib/asciinema_web/router.ex +++ b/lib/asciinema_web/router.ex @@ -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 @@ -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