X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fweb%2Frouter.ex;h=f2d6b0affaa0be3dbe6d00ffbadf83f8671806a3;hb=aa681d7e15f6170e7e92d86146d5ba96be6433bc;hp=6defc80808d63aacdb63ea1b77e49ca9411df86b;hpb=264f0fde1b9f0cbaf7679eeb59938eb9ca653779;p=akkoma diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index 6defc8080..f2d6b0aff 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -57,7 +57,6 @@ defmodule Pleroma.Web.Router do pipeline :after_auth do plug(Pleroma.Web.Plugs.UserEnabledPlug) - plug(Pleroma.Web.Plugs.SetUserSessionIdPlug) plug(Pleroma.Web.Plugs.EnsureUserTokenAssignsPlug) plug(Pleroma.Web.Plugs.UserTrackingPlug) end @@ -109,6 +108,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 +234,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) @@ -241,12 +252,8 @@ defmodule Pleroma.Web.Router do patch("/users/:nickname/credentials", AdminAPIController, :update_user_credentials) get("/users/:nickname/statuses", AdminAPIController, :list_user_statuses) - get("/users/:nickname/chats", AdminAPIController, :list_user_chats) get("/statuses", StatusController, :index) - - get("/chats/:id", ChatController, :show) - get("/chats/:id/messages", ChatController, :messages) end # AdminAPI: admins and mods (staff) can perform these actions @@ -286,8 +293,6 @@ defmodule Pleroma.Web.Router do post("/reload_emoji", AdminAPIController, :reload_emoji) get("/stats", AdminAPIController, :stats) - - delete("/chats/:id/messages/:message_id", ChatController, :delete_message) end scope "/api/v1/pleroma/emoji", Pleroma.Web.PleromaAPI do @@ -343,6 +348,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 @@ -395,6 +405,7 @@ defmodule Pleroma.Web.Router do scope "/api/v1/pleroma", Pleroma.Web.PleromaAPI do pipe_through(:api) + get("/apps", AppController, :index) get("/statuses/:id/reactions/:emoji", EmojiReactionController, :index) get("/statuses/:id/reactions", EmojiReactionController, :index) end @@ -409,15 +420,6 @@ defmodule Pleroma.Web.Router do scope [] 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) - delete("/chats/:id/messages/:message_id", ChatController, :delete_message) - post("/chats/:id/read", ChatController, :mark_as_read) - post("/chats/:id/messages/:message_id/read", ChatController, :mark_message_as_read) - get("/conversations/:id/statuses", ConversationController, :statuses) get("/conversations/:id", ConversationController, :show) post("/conversations/read", ConversationController, :mark_as_read) @@ -430,8 +432,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 @@ -453,15 +453,12 @@ 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 - scope "/api/v2/pleroma", Pleroma.Web.PleromaAPI do - scope [] do - pipe_through(:authenticated_api) - get("/chats", ChatController, :index2) - end + scope "/api/v1", Pleroma.Web.PleromaAPI do + pipe_through(:authenticated_api) + put("/statuses/:id/emoji_reactions/:emoji", EmojiReactionController, :create) end scope "/api/v1", Pleroma.Web.MastodonAPI do @@ -528,8 +525,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) @@ -569,6 +564,17 @@ defmodule Pleroma.Web.Router do get("/timelines/home", TimelineController, :home) get("/timelines/direct", TimelineController, :direct) get("/timelines/list/:list_id", TimelineController, :list) + get("/timelines/bubble", TimelineController, :bubble) + + 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 @@ -582,7 +588,7 @@ 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) get("/accounts/:id/followers", AccountController, :followers) @@ -597,7 +603,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) @@ -779,12 +784,18 @@ 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) + get("/web/*path", MastoFEController, :index) + post("/auth/password", MastodonAPI.AuthController, :password_reset) - post("/auth/password", TwitterAPI.PasswordController, :request) + get("/embed/:id", EmbedController, :show) end scope "/proxy/", Pleroma.Web do