defmodule Pleroma.Web.Router do
use Pleroma.Web, :router
+ import Phoenix.LiveDashboard.Router
pipeline :accepts_html do
plug(:accepts, ["html"])
plug(Pleroma.Web.Plugs.AdminSecretAuthenticationPlug)
plug(:after_auth)
plug(Pleroma.Web.Plugs.EnsureAuthenticatedPlug)
- plug(Pleroma.Web.Plugs.UserIsAdminPlug)
+ plug(Pleroma.Web.Plugs.UserIsStaffPlug)
plug(Pleroma.Web.Plugs.IdempotencyPlug)
end
- pipeline :mastodon_html do
- plug(:browser)
- plug(:authenticate)
- plug(:after_auth)
+ pipeline :require_admin do
+ plug(Pleroma.Web.Plugs.UserIsAdminPlug)
end
pipeline :pleroma_html do
end
scope "/api/v1/pleroma/admin", Pleroma.Web.AdminAPI do
- pipe_through(:admin_api)
+ pipe_through([:admin_api, :require_admin])
put("/users/disable_mfa", AdminAPIController, :disable_mfa)
put("/users/tag", AdminAPIController, :tag_users)
patch("/users/deactivate", UserController, :deactivate)
patch("/users/approve", UserController, :approve)
+ patch("/users/suggest", UserController, :suggest)
+ patch("/users/unsuggest", UserController, :unsuggest)
+
get("/relay", RelayController, :index)
post("/relay", RelayController, :follow)
delete("/relay", RelayController, :unfollow)
scope "/api/v1/pleroma/emoji", Pleroma.Web.PleromaAPI do
scope "/pack" do
- pipe_through(:admin_api)
+ pipe_through([:admin_api, :require_admin])
post("/", EmojiPackController, :create)
patch("/", EmojiPackController, :update)
# Modifying packs
scope "/packs" do
- pipe_through(:admin_api)
+ pipe_through([:admin_api, :require_admin])
get("/import", EmojiPackController, :import_from_filesystem)
get("/remote", EmojiPackController, :remote)
delete("/push/subscription", SubscriptionController, :delete)
get("/suggestions", SuggestionController, :index)
+ delete("/suggestions/:account_id", SuggestionController, :dismiss)
get("/timelines/home", TimelineController, :home)
get("/timelines/direct", TimelineController, :direct)
get("/timelines/list/:list_id", TimelineController, :list)
end
- scope "/api/web", Pleroma.Web do
- pipe_through(:authenticated_api)
-
- # Backend-obscure settings blob for MastoFE, don't parse/reuse elsewhere
- put("/settings", MastoFEController, :put_settings)
- end
-
scope "/api/v1", Pleroma.Web.MastodonAPI do
pipe_through(:app_api)
get("/search", SearchController, :search2)
post("/media", MediaController, :create2)
+
+ get("/suggestions", SuggestionController, :index2)
end
scope "/api", Pleroma.Web do
scope "/", Pleroma.Web do
pipe_through(:api)
- get("/web/manifest.json", MastoFEController, :manifest)
+ get("/manifest.json", ManifestController, :show)
end
scope "/", Pleroma.Web do
- pipe_through(:mastodon_html)
-
- get("/web/login", MastodonAPI.AuthController, :login)
- delete("/auth/sign_out", MastodonAPI.AuthController, :logout)
-
- post("/auth/password", MastodonAPI.AuthController, :password_reset)
-
- get("/web/*path", MastoFEController, :index)
+ pipe_through(:pleroma_html)
- get("/embed/:id", EmbedController, :show)
+ post("/auth/password", TwitterAPI.PasswordController, :request)
end
scope "/proxy/", Pleroma.Web do
end
end
+ scope "/" do
+ pipe_through([:pleroma_html, :authenticate, :require_admin])
+ live_dashboard("/phoenix/live_dashboard")
+ end
+
# Test-only routes needed to test action dispatching and plug chain execution
if Pleroma.Config.get(:env) == :test do
@test_actions [