remove all endpoints marked as deprecated (#91)
[akkoma] / lib / pleroma / web / router.ex
index b9b52b1e54d75577f3008f84b86ebba81fc0a53e..8a53f770eb47f3ff7e9adab5b8080c256e8f1d07 100644 (file)
@@ -109,6 +109,12 @@ defmodule Pleroma.Web.Router do
     plug(Pleroma.Web.Plugs.UserIsAdminPlug)
   end
 
+  pipeline :mastodon_html do
+    plug(:browser)
+    plug(:authenticate)
+    plug(:after_auth)
+  end
+
   pipeline :pleroma_html do
     plug(:browser)
     plug(:authenticate)
@@ -229,6 +235,12 @@ defmodule Pleroma.Web.Router do
     post("/frontends/install", FrontendController, :install)
 
     post("/backups", AdminAPIController, :create_backup)
+
+    get("/announcements", AnnouncementController, :index)
+    post("/announcements", AnnouncementController, :create)
+    get("/announcements/:id", AnnouncementController, :show)
+    patch("/announcements/:id", AnnouncementController, :change)
+    delete("/announcements/:id", AnnouncementController, :delete)
   end
 
   # AdminAPI: admins and mods (staff) can perform these actions (if enabled by config)
@@ -343,6 +355,11 @@ defmodule Pleroma.Web.Router do
     post("/delete_account", UtilController, :delete_account)
     put("/notification_settings", UtilController, :update_notificaton_settings)
     post("/disable_account", UtilController, :disable_account)
+    post("/move_account", UtilController, :move_account)
+
+    put("/aliases", UtilController, :add_alias)
+    get("/aliases", UtilController, :list_aliases)
+    delete("/aliases", UtilController, :delete_alias)
   end
 
   scope "/api/pleroma", Pleroma.Web.PleromaAPI do
@@ -411,7 +428,6 @@ defmodule Pleroma.Web.Router do
       pipe_through(:authenticated_api)
 
       post("/chats/by-account-id/:id", ChatController, :create)
-      get("/chats", ChatController, :index)
       get("/chats/:id", ChatController, :show)
       get("/chats/:id/messages", ChatController, :messages)
       post("/chats/:id/messages", ChatController, :post_chat_message)
@@ -431,8 +447,6 @@ defmodule Pleroma.Web.Router do
       get("/mascot", MascotController, :show)
       put("/mascot", MascotController, :update)
 
-      post("/scrobble", ScrobbleController, :create)
-
       get("/backups", BackupController, :index)
       post("/backups", BackupController, :create)
     end
@@ -454,7 +468,6 @@ defmodule Pleroma.Web.Router do
 
   scope "/api/v1/pleroma", Pleroma.Web.PleromaAPI do
     pipe_through(:api)
-    get("/accounts/:id/scrobbles", ScrobbleController, :index)
     get("/federation_status", InstancesController, :show)
   end
 
@@ -529,8 +542,6 @@ defmodule Pleroma.Web.Router do
     post("/notifications/:id/dismiss", NotificationController, :dismiss)
     post("/notifications/clear", NotificationController, :clear)
     delete("/notifications/destroy_multiple", NotificationController, :destroy_multiple)
-    # Deprecated: was removed in Mastodon v3, use `/notifications/:id/dismiss` instead
-    post("/notifications/dismiss", NotificationController, :dismiss_via_body)
 
     post("/polls/:id/votes", PollController, :vote)
 
@@ -570,6 +581,16 @@ defmodule Pleroma.Web.Router do
     get("/timelines/home", TimelineController, :home)
     get("/timelines/direct", TimelineController, :direct)
     get("/timelines/list/:list_id", TimelineController, :list)
+
+    get("/announcements", AnnouncementController, :index)
+    post("/announcements/:id/dismiss", AnnouncementController, :mark_read)
+  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
@@ -583,8 +604,6 @@ defmodule Pleroma.Web.Router do
     pipe_through(:api)
 
     get("/accounts/search", SearchController, :account_search)
-    get("/search", SearchController, :search)
-
     get("/accounts/lookup", AccountController, :lookup)
 
     get("/accounts/:id/statuses", AccountController, :statuses)
@@ -600,7 +619,6 @@ defmodule Pleroma.Web.Router do
     get("/statuses", StatusController, :index)
     get("/statuses/:id", StatusController, :show)
     get("/statuses/:id/context", StatusController, :context)
-    get("/statuses/:id/card", StatusController, :card)
     get("/statuses/:id/favourited_by", StatusController, :favourited_by)
     get("/statuses/:id/reblogged_by", StatusController, :reblogged_by)
 
@@ -782,12 +800,20 @@ defmodule Pleroma.Web.Router do
     pipe_through(:api)
 
     get("/manifest.json", ManifestController, :show)
+    get("/web/manifest.json", MastoFEController, :manifest)
   end
 
   scope "/", Pleroma.Web do
-    pipe_through(:pleroma_html)
+    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)
 
-    post("/auth/password", TwitterAPI.PasswordController, :request)
+    get("/embed/:id", EmbedController, :show)
   end
 
   scope "/proxy/", Pleroma.Web do