1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.Router do
6 use Pleroma.Web, :router
9 plug(:accepts, ["html"])
15 plug(Pleroma.Plugs.OAuthPlug)
16 plug(Pleroma.Plugs.UserEnabledPlug)
20 plug(:accepts, ["json"])
22 plug(Pleroma.Plugs.OAuthPlug)
23 plug(Pleroma.Plugs.BasicAuthDecoderPlug)
24 plug(Pleroma.Plugs.UserFetcherPlug)
25 plug(Pleroma.Plugs.SessionAuthenticationPlug)
26 plug(Pleroma.Plugs.LegacyAuthenticationPlug)
27 plug(Pleroma.Plugs.AuthenticationPlug)
28 plug(Pleroma.Plugs.UserEnabledPlug)
29 plug(Pleroma.Plugs.SetUserSessionIdPlug)
30 plug(Pleroma.Plugs.EnsureUserKeyPlug)
31 plug(Pleroma.Plugs.IdempotencyPlug)
32 plug(OpenApiSpex.Plug.PutApiSpec, module: Pleroma.Web.ApiSpec)
35 pipeline :authenticated_api do
36 plug(:accepts, ["json"])
38 plug(Pleroma.Plugs.AuthExpectedPlug)
39 plug(Pleroma.Plugs.OAuthPlug)
40 plug(Pleroma.Plugs.BasicAuthDecoderPlug)
41 plug(Pleroma.Plugs.UserFetcherPlug)
42 plug(Pleroma.Plugs.SessionAuthenticationPlug)
43 plug(Pleroma.Plugs.LegacyAuthenticationPlug)
44 plug(Pleroma.Plugs.AuthenticationPlug)
45 plug(Pleroma.Plugs.UserEnabledPlug)
46 plug(Pleroma.Plugs.SetUserSessionIdPlug)
47 plug(Pleroma.Plugs.EnsureAuthenticatedPlug)
48 plug(Pleroma.Plugs.IdempotencyPlug)
49 plug(OpenApiSpex.Plug.PutApiSpec, module: Pleroma.Web.ApiSpec)
52 pipeline :admin_api do
53 plug(:accepts, ["json"])
55 plug(Pleroma.Plugs.OAuthPlug)
56 plug(Pleroma.Plugs.BasicAuthDecoderPlug)
57 plug(Pleroma.Plugs.UserFetcherPlug)
58 plug(Pleroma.Plugs.SessionAuthenticationPlug)
59 plug(Pleroma.Plugs.LegacyAuthenticationPlug)
60 plug(Pleroma.Plugs.AuthenticationPlug)
61 plug(Pleroma.Plugs.AdminSecretAuthenticationPlug)
62 plug(Pleroma.Plugs.UserEnabledPlug)
63 plug(Pleroma.Plugs.SetUserSessionIdPlug)
64 plug(Pleroma.Plugs.EnsureAuthenticatedPlug)
65 plug(Pleroma.Plugs.UserIsAdminPlug)
66 plug(Pleroma.Plugs.IdempotencyPlug)
67 plug(OpenApiSpex.Plug.PutApiSpec, module: Pleroma.Web.ApiSpec)
70 pipeline :mastodon_html do
71 plug(:accepts, ["html"])
73 plug(Pleroma.Plugs.OAuthPlug)
74 plug(Pleroma.Plugs.BasicAuthDecoderPlug)
75 plug(Pleroma.Plugs.UserFetcherPlug)
76 plug(Pleroma.Plugs.SessionAuthenticationPlug)
77 plug(Pleroma.Plugs.LegacyAuthenticationPlug)
78 plug(Pleroma.Plugs.AuthenticationPlug)
79 plug(Pleroma.Plugs.UserEnabledPlug)
80 plug(Pleroma.Plugs.SetUserSessionIdPlug)
81 plug(Pleroma.Plugs.EnsureUserKeyPlug)
84 pipeline :pleroma_html do
85 plug(:accepts, ["html"])
87 plug(Pleroma.Plugs.OAuthPlug)
88 plug(Pleroma.Plugs.BasicAuthDecoderPlug)
89 plug(Pleroma.Plugs.UserFetcherPlug)
90 plug(Pleroma.Plugs.SessionAuthenticationPlug)
91 plug(Pleroma.Plugs.AuthenticationPlug)
92 plug(Pleroma.Plugs.EnsureUserKeyPlug)
95 pipeline :well_known do
96 plug(:accepts, ["json", "jrd+json", "xml", "xrd+xml"])
100 plug(:accepts, ["json", "xml"])
101 plug(OpenApiSpex.Plug.PutApiSpec, module: Pleroma.Web.ApiSpec)
104 pipeline :pleroma_api do
105 plug(:accepts, ["html", "json"])
106 plug(OpenApiSpex.Plug.PutApiSpec, module: Pleroma.Web.ApiSpec)
109 pipeline :mailbox_preview do
110 plug(:accepts, ["html"])
112 plug(:put_secure_browser_headers, %{
113 "content-security-policy" =>
114 "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline' 'unsafe-eval'"
118 pipeline :http_signature do
119 plug(Pleroma.Web.Plugs.HTTPSignaturePlug)
120 plug(Pleroma.Web.Plugs.MappedSignatureToIdentityPlug)
123 scope "/api/pleroma", Pleroma.Web.TwitterAPI do
124 pipe_through(:pleroma_api)
126 get("/password_reset/:token", PasswordController, :reset, as: :reset_password)
127 post("/password_reset", PasswordController, :do_reset, as: :reset_password)
128 get("/emoji", UtilController, :emoji)
129 get("/captcha", UtilController, :captcha)
130 get("/healthcheck", UtilController, :healthcheck)
133 scope "/api/pleroma", Pleroma.Web do
134 pipe_through(:pleroma_api)
135 post("/uploader_callback/:upload_path", UploaderController, :callback)
138 scope "/api/pleroma/admin", Pleroma.Web.AdminAPI do
139 pipe_through(:admin_api)
141 post("/users/follow", AdminAPIController, :user_follow)
142 post("/users/unfollow", AdminAPIController, :user_unfollow)
144 delete("/users", AdminAPIController, :user_delete)
145 post("/users", AdminAPIController, :users_create)
146 patch("/users/:nickname/toggle_activation", AdminAPIController, :user_toggle_activation)
147 patch("/users/activate", AdminAPIController, :user_activate)
148 patch("/users/deactivate", AdminAPIController, :user_deactivate)
149 put("/users/tag", AdminAPIController, :tag_users)
150 delete("/users/tag", AdminAPIController, :untag_users)
152 get("/users/:nickname/permission_group", AdminAPIController, :right_get)
153 get("/users/:nickname/permission_group/:permission_group", AdminAPIController, :right_get)
155 post("/users/:nickname/permission_group/:permission_group", AdminAPIController, :right_add)
158 "/users/:nickname/permission_group/:permission_group",
163 post("/users/permission_group/:permission_group", AdminAPIController, :right_add_multiple)
166 "/users/permission_group/:permission_group",
168 :right_delete_multiple
171 get("/relay", AdminAPIController, :relay_list)
172 post("/relay", AdminAPIController, :relay_follow)
173 delete("/relay", AdminAPIController, :relay_unfollow)
175 post("/users/invite_token", AdminAPIController, :create_invite_token)
176 get("/users/invites", AdminAPIController, :invites)
177 post("/users/revoke_invite", AdminAPIController, :revoke_invite)
178 post("/users/email_invite", AdminAPIController, :email_invite)
180 get("/users/:nickname/password_reset", AdminAPIController, :get_password_reset)
181 patch("/users/force_password_reset", AdminAPIController, :force_password_reset)
182 get("/users/:nickname/credentials", AdminAPIController, :show_user_credentials)
183 patch("/users/:nickname/credentials", AdminAPIController, :update_user_credentials)
185 get("/users", AdminAPIController, :list_users)
186 get("/users/:nickname", AdminAPIController, :user_show)
187 get("/users/:nickname/statuses", AdminAPIController, :list_user_statuses)
189 get("/instances/:instance/statuses", AdminAPIController, :list_instance_statuses)
191 patch("/users/confirm_email", AdminAPIController, :confirm_email)
192 patch("/users/resend_confirmation_email", AdminAPIController, :resend_confirmation_email)
194 get("/reports", AdminAPIController, :list_reports)
195 get("/reports/:id", AdminAPIController, :report_show)
196 patch("/reports", AdminAPIController, :reports_update)
197 post("/reports/:id/notes", AdminAPIController, :report_notes_create)
198 delete("/reports/:report_id/notes/:id", AdminAPIController, :report_notes_delete)
200 put("/statuses/:id", AdminAPIController, :status_update)
201 delete("/statuses/:id", AdminAPIController, :status_delete)
202 get("/statuses", AdminAPIController, :list_statuses)
204 get("/config", AdminAPIController, :config_show)
205 post("/config", AdminAPIController, :config_update)
206 get("/config/descriptions", AdminAPIController, :config_descriptions)
207 get("/need_reboot", AdminAPIController, :need_reboot)
208 get("/restart", AdminAPIController, :restart)
210 get("/moderation_log", AdminAPIController, :list_log)
212 post("/reload_emoji", AdminAPIController, :reload_emoji)
213 get("/stats", AdminAPIController, :stats)
216 scope "/api/pleroma/emoji", Pleroma.Web.PleromaAPI do
219 pipe_through(:admin_api)
221 post("/import_from_fs", EmojiAPIController, :import_from_fs)
223 post("/:pack_name/update_file", EmojiAPIController, :update_file)
224 post("/:pack_name/update_metadata", EmojiAPIController, :update_metadata)
225 put("/:name", EmojiAPIController, :create)
226 delete("/:name", EmojiAPIController, :delete)
227 post("/download_from", EmojiAPIController, :download_from)
228 post("/list_from", EmojiAPIController, :list_from)
232 # Pack info / downloading
233 get("/", EmojiAPIController, :list_packs)
234 get("/:name/download_shared/", EmojiAPIController, :download_shared)
238 scope "/", Pleroma.Web.TwitterAPI do
239 pipe_through(:pleroma_html)
241 post("/main/ostatus", UtilController, :remote_subscribe)
242 get("/ostatus_subscribe", RemoteFollowController, :follow)
244 post("/ostatus_subscribe", RemoteFollowController, :do_follow)
247 scope "/api/pleroma", Pleroma.Web.TwitterAPI do
248 pipe_through(:authenticated_api)
250 post("/change_email", UtilController, :change_email)
251 post("/change_password", UtilController, :change_password)
252 post("/delete_account", UtilController, :delete_account)
253 put("/notification_settings", UtilController, :update_notificaton_settings)
254 post("/disable_account", UtilController, :disable_account)
256 post("/blocks_import", UtilController, :blocks_import)
257 post("/follow_import", UtilController, :follow_import)
260 scope "/oauth", Pleroma.Web.OAuth do
263 get("/authorize", OAuthController, :authorize)
266 post("/authorize", OAuthController, :create_authorization)
267 post("/token", OAuthController, :token_exchange)
268 post("/revoke", OAuthController, :token_revoke)
269 get("/registration_details", OAuthController, :registration_details)
272 pipe_through(:browser)
274 get("/prepare_request", OAuthController, :prepare_request)
275 get("/:provider", OAuthController, :request)
276 get("/:provider/callback", OAuthController, :callback)
277 post("/register", OAuthController, :register)
281 scope "/api/v1/pleroma", Pleroma.Web.PleromaAPI do
284 get("/statuses/:id/reactions/:emoji", PleromaAPIController, :emoji_reactions_by)
285 get("/statuses/:id/reactions", PleromaAPIController, :emoji_reactions_by)
288 scope "/api/v1/pleroma", Pleroma.Web.PleromaAPI do
290 pipe_through(:authenticated_api)
292 get("/conversations/:id/statuses", PleromaAPIController, :conversation_statuses)
293 get("/conversations/:id", PleromaAPIController, :conversation)
294 post("/conversations/read", PleromaAPIController, :read_conversations)
298 pipe_through(:authenticated_api)
300 patch("/conversations/:id", PleromaAPIController, :update_conversation)
301 put("/statuses/:id/reactions/:emoji", PleromaAPIController, :react_with_emoji)
302 delete("/statuses/:id/reactions/:emoji", PleromaAPIController, :unreact_with_emoji)
303 post("/notifications/read", PleromaAPIController, :read_notification)
305 patch("/accounts/update_avatar", AccountController, :update_avatar)
306 patch("/accounts/update_banner", AccountController, :update_banner)
307 patch("/accounts/update_background", AccountController, :update_background)
309 get("/mascot", MascotController, :show)
310 put("/mascot", MascotController, :update)
312 post("/scrobble", ScrobbleController, :new_scrobble)
317 get("/accounts/:id/favourites", AccountController, :favourites)
321 pipe_through(:authenticated_api)
323 post("/accounts/:id/subscribe", AccountController, :subscribe)
324 post("/accounts/:id/unsubscribe", AccountController, :unsubscribe)
327 post("/accounts/confirmation_resend", AccountController, :confirmation_resend)
330 scope "/api/v1/pleroma", Pleroma.Web.PleromaAPI do
332 get("/accounts/:id/scrobbles", ScrobbleController, :user_scrobbles)
335 scope "/api/v1", Pleroma.Web.MastodonAPI do
336 pipe_through(:authenticated_api)
338 get("/accounts/verify_credentials", AccountController, :verify_credentials)
340 get("/accounts/relationships", AccountController, :relationships)
342 get("/accounts/:id/lists", AccountController, :lists)
343 get("/accounts/:id/identity_proofs", AccountController, :identity_proofs)
345 get("/follow_requests", FollowRequestController, :index)
346 get("/blocks", AccountController, :blocks)
347 get("/mutes", AccountController, :mutes)
349 get("/timelines/home", TimelineController, :home)
350 get("/timelines/direct", TimelineController, :direct)
352 get("/favourites", StatusController, :favourites)
353 get("/bookmarks", StatusController, :bookmarks)
355 get("/notifications", NotificationController, :index)
356 get("/notifications/:id", NotificationController, :show)
357 post("/notifications/:id/dismiss", NotificationController, :dismiss)
358 post("/notifications/clear", NotificationController, :clear)
359 delete("/notifications/destroy_multiple", NotificationController, :destroy_multiple)
360 # Deprecated: was removed in Mastodon v3, use `/notifications/:id/dismiss` instead
361 post("/notifications/dismiss", NotificationController, :dismiss)
363 get("/scheduled_statuses", ScheduledActivityController, :index)
364 get("/scheduled_statuses/:id", ScheduledActivityController, :show)
366 get("/lists", ListController, :index)
367 get("/lists/:id", ListController, :show)
368 get("/lists/:id/accounts", ListController, :list_accounts)
370 get("/domain_blocks", DomainBlockController, :index)
372 get("/filters", FilterController, :index)
374 get("/suggestions", SuggestionController, :index)
376 get("/conversations", ConversationController, :index)
377 post("/conversations/:id/read", ConversationController, :read)
379 get("/endorsements", AccountController, :endorsements)
381 patch("/accounts/update_credentials", AccountController, :update_credentials)
383 post("/statuses", StatusController, :create)
384 delete("/statuses/:id", StatusController, :delete)
386 post("/statuses/:id/reblog", StatusController, :reblog)
387 post("/statuses/:id/unreblog", StatusController, :unreblog)
388 post("/statuses/:id/favourite", StatusController, :favourite)
389 post("/statuses/:id/unfavourite", StatusController, :unfavourite)
390 post("/statuses/:id/pin", StatusController, :pin)
391 post("/statuses/:id/unpin", StatusController, :unpin)
392 post("/statuses/:id/bookmark", StatusController, :bookmark)
393 post("/statuses/:id/unbookmark", StatusController, :unbookmark)
394 post("/statuses/:id/mute", StatusController, :mute_conversation)
395 post("/statuses/:id/unmute", StatusController, :unmute_conversation)
397 put("/scheduled_statuses/:id", ScheduledActivityController, :update)
398 delete("/scheduled_statuses/:id", ScheduledActivityController, :delete)
400 post("/polls/:id/votes", PollController, :vote)
402 post("/media", MediaController, :create)
403 put("/media/:id", MediaController, :update)
405 delete("/lists/:id", ListController, :delete)
406 post("/lists", ListController, :create)
407 put("/lists/:id", ListController, :update)
409 post("/lists/:id/accounts", ListController, :add_to_list)
410 delete("/lists/:id/accounts", ListController, :remove_from_list)
412 post("/filters", FilterController, :create)
413 get("/filters/:id", FilterController, :show)
414 put("/filters/:id", FilterController, :update)
415 delete("/filters/:id", FilterController, :delete)
417 post("/reports", ReportController, :create)
419 post("/follows", AccountController, :follows)
420 post("/accounts/:id/follow", AccountController, :follow)
421 post("/accounts/:id/unfollow", AccountController, :unfollow)
422 post("/accounts/:id/block", AccountController, :block)
423 post("/accounts/:id/unblock", AccountController, :unblock)
424 post("/accounts/:id/mute", AccountController, :mute)
425 post("/accounts/:id/unmute", AccountController, :unmute)
427 post("/follow_requests/:id/authorize", FollowRequestController, :authorize)
428 post("/follow_requests/:id/reject", FollowRequestController, :reject)
430 post("/domain_blocks", DomainBlockController, :create)
431 delete("/domain_blocks", DomainBlockController, :delete)
433 post("/push/subscription", SubscriptionController, :create)
434 get("/push/subscription", SubscriptionController, :get)
435 put("/push/subscription", SubscriptionController, :update)
436 delete("/push/subscription", SubscriptionController, :delete)
438 get("/markers", MarkerController, :index)
439 post("/markers", MarkerController, :upsert)
442 scope "/api/web", Pleroma.Web do
443 pipe_through(:authenticated_api)
445 put("/settings", MastoFEController, :put_settings)
448 scope "/api/v1", Pleroma.Web.MastodonAPI do
451 post("/accounts", AccountController, :create)
452 get("/accounts/search", SearchController, :account_search)
454 get("/instance", InstanceController, :show)
455 get("/instance/peers", InstanceController, :peers)
457 post("/apps", AppController, :create)
458 get("/apps/verify_credentials", AppController, :verify_credentials)
460 get("/statuses/:id/card", StatusController, :card)
461 get("/statuses/:id/favourited_by", StatusController, :favourited_by)
462 get("/statuses/:id/reblogged_by", StatusController, :reblogged_by)
464 get("/custom_emojis", CustomEmojiController, :index)
466 get("/trends", MastodonAPIController, :empty_array)
468 get("/timelines/public", TimelineController, :public)
469 get("/timelines/tag/:tag", TimelineController, :hashtag)
470 get("/timelines/list/:list_id", TimelineController, :list)
472 get("/statuses", StatusController, :index)
473 get("/statuses/:id", StatusController, :show)
474 get("/statuses/:id/context", StatusController, :context)
476 get("/polls/:id", PollController, :show)
478 get("/accounts/:id/statuses", AccountController, :statuses)
479 get("/accounts/:id/followers", AccountController, :followers)
480 get("/accounts/:id/following", AccountController, :following)
481 get("/accounts/:id", AccountController, :show)
483 get("/search", SearchController, :search)
486 scope "/api/v2", Pleroma.Web.MastodonAPI do
488 get("/search", SearchController, :search2)
491 scope "/api", Pleroma.Web do
492 pipe_through(:config)
494 get("/help/test", TwitterAPI.UtilController, :help_test)
495 post("/help/test", TwitterAPI.UtilController, :help_test)
496 get("/statusnet/config", TwitterAPI.UtilController, :config)
497 get("/statusnet/version", TwitterAPI.UtilController, :version)
498 get("/pleroma/frontend_configurations", TwitterAPI.UtilController, :frontend_configurations)
501 scope "/api", Pleroma.Web do
505 "/account/confirm_email/:user_id/:token",
506 TwitterAPI.Controller,
515 get("/openapi", OpenApiSpex.Plug.RenderSpec, [])
518 scope "/api", Pleroma.Web, as: :authenticated_twitter_api do
519 pipe_through(:authenticated_api)
521 get("/oauth_tokens", TwitterAPI.Controller, :oauth_tokens)
522 delete("/oauth_tokens/:id", TwitterAPI.Controller, :revoke_token)
524 post("/qvitter/statuses/notifications/read", TwitterAPI.Controller, :notifications_read)
527 pipeline :ap_service_actor do
528 plug(:accepts, ["activity+json", "json"])
532 plug(:accepts, ["html", "xml", "rss", "atom", "activity+json", "json"])
533 plug(Pleroma.Plugs.StaticFEPlug)
537 plug(:accepts, ["json", "xml"])
540 scope "/", Pleroma.Web do
541 pipe_through(:ostatus)
542 pipe_through(:http_signature)
544 get("/objects/:uuid", OStatus.OStatusController, :object)
545 get("/activities/:uuid", OStatus.OStatusController, :activity)
546 get("/notice/:id", OStatus.OStatusController, :notice)
547 get("/notice/:id/embed_player", OStatus.OStatusController, :notice_player)
549 get("/users/:nickname/feed", Feed.UserController, :feed, as: :user_feed)
550 get("/users/:nickname", Feed.UserController, :feed_redirect, as: :user_feed)
552 get("/tags/:tag", Feed.TagController, :feed, as: :tag_feed)
555 scope "/", Pleroma.Web do
556 pipe_through(:browser)
557 get("/mailer/unsubscribe/:token", Mailer.SubscriptionController, :unsubscribe)
560 # Server to Server (S2S) AP interactions
561 pipeline :activitypub do
562 plug(:accepts, ["activity+json", "json"])
563 plug(Pleroma.Web.Plugs.HTTPSignaturePlug)
564 plug(Pleroma.Web.Plugs.MappedSignatureToIdentityPlug)
567 scope "/", Pleroma.Web.ActivityPub do
568 # XXX: not really ostatus
569 pipe_through(:ostatus)
571 get("/users/:nickname/outbox", ActivityPubController, :outbox)
574 # Client to Server (C2S) AP interactions
575 pipeline :activitypub_client do
576 plug(:accepts, ["activity+json", "json"])
578 plug(Pleroma.Plugs.OAuthPlug)
579 plug(Pleroma.Plugs.BasicAuthDecoderPlug)
580 plug(Pleroma.Plugs.UserFetcherPlug)
581 plug(Pleroma.Plugs.SessionAuthenticationPlug)
582 plug(Pleroma.Plugs.LegacyAuthenticationPlug)
583 plug(Pleroma.Plugs.AuthenticationPlug)
584 plug(Pleroma.Plugs.UserEnabledPlug)
585 plug(Pleroma.Plugs.SetUserSessionIdPlug)
586 plug(Pleroma.Plugs.EnsureUserKeyPlug)
589 scope "/", Pleroma.Web.ActivityPub do
590 pipe_through([:activitypub_client])
592 get("/api/ap/whoami", ActivityPubController, :whoami)
593 get("/users/:nickname/inbox", ActivityPubController, :read_inbox)
595 post("/users/:nickname/outbox", ActivityPubController, :update_outbox)
596 post("/api/ap/upload_media", ActivityPubController, :upload_media)
598 get("/users/:nickname/followers", ActivityPubController, :followers)
599 get("/users/:nickname/following", ActivityPubController, :following)
602 scope "/", Pleroma.Web.ActivityPub do
603 pipe_through(:activitypub)
604 post("/inbox", ActivityPubController, :inbox)
605 post("/users/:nickname/inbox", ActivityPubController, :inbox)
608 scope "/relay", Pleroma.Web.ActivityPub do
609 pipe_through(:ap_service_actor)
611 get("/", ActivityPubController, :relay)
614 pipe_through(:http_signature)
615 post("/inbox", ActivityPubController, :inbox)
618 get("/following", ActivityPubController, :relay_following)
619 get("/followers", ActivityPubController, :relay_followers)
622 scope "/internal/fetch", Pleroma.Web.ActivityPub do
623 pipe_through(:ap_service_actor)
625 get("/", ActivityPubController, :internal_fetch)
626 post("/inbox", ActivityPubController, :inbox)
629 scope "/.well-known", Pleroma.Web do
630 pipe_through(:well_known)
632 get("/host-meta", WebFinger.WebFingerController, :host_meta)
633 get("/webfinger", WebFinger.WebFingerController, :webfinger)
634 get("/nodeinfo", Nodeinfo.NodeinfoController, :schemas)
637 scope "/nodeinfo", Pleroma.Web do
638 get("/:version", Nodeinfo.NodeinfoController, :nodeinfo)
641 scope "/", Pleroma.Web do
644 get("/web/manifest.json", MastoFEController, :manifest)
647 scope "/", Pleroma.Web do
648 pipe_through(:mastodon_html)
650 get("/web/login", MastodonAPI.AuthController, :login)
651 delete("/auth/sign_out", MastodonAPI.AuthController, :logout)
653 post("/auth/password", MastodonAPI.AuthController, :password_reset)
655 get("/web/*path", MastoFEController, :index)
658 pipeline :remote_media do
661 scope "/proxy/", Pleroma.Web.MediaProxy do
662 pipe_through(:remote_media)
664 get("/:sig/:url", MediaProxyController, :remote)
665 get("/:sig/:url/:filename", MediaProxyController, :remote)
668 if Pleroma.Config.get(:env) == :dev do
670 pipe_through([:mailbox_preview])
672 forward("/mailbox", Plug.Swoosh.MailboxPreview, base_path: "/dev/mailbox")
676 # Test-only routes needed to test action dispatching and plug chain execution
677 if Pleroma.Config.get(:env) == :test do
678 scope "/test/authenticated_api", Pleroma.Tests do
679 pipe_through(:authenticated_api)
681 for action <- [:skipped_oauth, :performed_oauth, :missed_oauth] do
682 get("/#{action}", OAuthTestController, action)
687 scope "/", Pleroma.Web.MongooseIM do
688 get("/user_exists", MongooseIMController, :user_exists)
689 get("/check_password", MongooseIMController, :check_password)
692 scope "/", Fallback do
693 get("/registration/:token", RedirectController, :registration_page)
694 get("/:maybe_nickname_or_id", RedirectController, :redirector_with_meta)
695 get("/api*path", RedirectController, :api_not_implemented)
696 get("/*path", RedirectController, :redirector)
698 options("/*path", RedirectController, :empty)