Commit 12d74370 authored by Mayel's avatar Mayel

simplify routes

parent 0acb46cd
Pipeline #28862499 failed with stages
in 3 minutes and 51 seconds
......@@ -56,7 +56,7 @@ config :pleroma, :http, proxy_url: nil
config :pleroma, :instance,
version: version,
name: "Pub of the Commons",
email: "example@example.com",
email: "example@example.local",
description: "A Pub of the Commons instance, a generic fediverse server",
limit: 5000,
upload_limit: 16_000_000,
......
......@@ -960,7 +960,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
|> render(MastodonView, "index.html", %{initial_state: initial_state})
else
conn
|> redirect(to: "/web/login")
|> redirect(to: "/?login")
end
end
......
......@@ -340,11 +340,14 @@ defmodule Pleroma.Web.Router do
scope "/", Pleroma.Web.MastodonAPI do
pipe_through(:mastodon_html)
get("/web/login", MastodonAPIController, :login)
post("/web/login", MastodonAPIController, :login_post)
get("/web/register", MastodonAPIController, :register)
post("/web/register", MastodonAPIController, :register_post)
get("/web/login", MastodonAPIController, :login)
post("/web/login", MastodonAPIController, :login_post)
get("/web/*path", MastodonAPIController, :index)
delete("/auth/sign_out", MastodonAPIController, :logout)
end
......@@ -357,24 +360,24 @@ defmodule Pleroma.Web.Router do
get("/:sig/:url", MediaProxyController, :remote)
end
scope "/", Fallback do
get("/registration/:token", RedirectController, :registration_page)
get("/*path", RedirectController, :redirector)
end
# scope "/", Fallback do
# get("/registration/:token", RedirectController, :registration_page)
# get("/*path", RedirectController, :redirector)
# end
end
defmodule Fallback.RedirectController do
use Pleroma.Web, :controller
def redirector(conn, _params) do
if Mix.env() != :test do
conn
|> put_resp_content_type("text/html")
|> send_file(200, "priv/static/index.html")
end
end
def registration_page(conn, params) do
redirector(conn, params)
end
end
# defmodule Fallback.RedirectController do
# use Pleroma.Web, :controller
# def redirector(conn, _params) do
# if Mix.env() != :test do
# conn
# |> put_resp_content_type("text/html")
# |> send_file(200, "priv/static/index.html")
# end
# end
# def registration_page(conn, params) do
# redirector(conn, params)
# end
# end
Markdown is supported
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