1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2019 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)
19 plug(:accepts, ["json"])
21 plug(Pleroma.Plugs.OAuthPlug)
22 plug(Pleroma.Plugs.BasicAuthDecoderPlug)
23 plug(Pleroma.Plugs.UserFetcherPlug)
24 plug(Pleroma.Plugs.SessionAuthenticationPlug)
25 plug(Pleroma.Plugs.LegacyAuthenticationPlug)
26 plug(Pleroma.Plugs.AuthenticationPlug)
27 plug(Pleroma.Plugs.UserEnabledPlug)
28 plug(Pleroma.Plugs.SetUserSessionIdPlug)
29 plug(Pleroma.Plugs.EnsureUserKeyPlug)
30 plug(Pleroma.Plugs.IdempotencyPlug)
33 pipeline :authenticated_api do
34 plug(:accepts, ["json"])
36 plug(Pleroma.Plugs.OAuthPlug)
37 plug(Pleroma.Plugs.BasicAuthDecoderPlug)
38 plug(Pleroma.Plugs.UserFetcherPlug)
39 plug(Pleroma.Plugs.SessionAuthenticationPlug)
40 plug(Pleroma.Plugs.LegacyAuthenticationPlug)
41 plug(Pleroma.Plugs.AuthenticationPlug)
42 plug(Pleroma.Plugs.UserEnabledPlug)
43 plug(Pleroma.Plugs.SetUserSessionIdPlug)
44 plug(Pleroma.Plugs.EnsureAuthenticatedPlug)
45 plug(Pleroma.Plugs.IdempotencyPlug)
48 pipeline :admin_api do
49 plug(:accepts, ["json"])
51 plug(Pleroma.Plugs.OAuthPlug)
52 plug(Pleroma.Plugs.BasicAuthDecoderPlug)
53 plug(Pleroma.Plugs.UserFetcherPlug)
54 plug(Pleroma.Plugs.SessionAuthenticationPlug)
55 plug(Pleroma.Plugs.LegacyAuthenticationPlug)
56 plug(Pleroma.Plugs.AuthenticationPlug)
57 plug(Pleroma.Plugs.AdminSecretAuthenticationPlug)
58 plug(Pleroma.Plugs.UserEnabledPlug)
59 plug(Pleroma.Plugs.SetUserSessionIdPlug)
60 plug(Pleroma.Plugs.EnsureAuthenticatedPlug)
61 plug(Pleroma.Plugs.UserIsAdminPlug)
62 plug(Pleroma.Plugs.IdempotencyPlug)
65 pipeline :mastodon_html do
66 plug(:accepts, ["html"])
68 plug(Pleroma.Plugs.OAuthPlug)
69 plug(Pleroma.Plugs.BasicAuthDecoderPlug)
70 plug(Pleroma.Plugs.UserFetcherPlug)
71 plug(Pleroma.Plugs.SessionAuthenticationPlug)
72 plug(Pleroma.Plugs.LegacyAuthenticationPlug)
73 plug(Pleroma.Plugs.AuthenticationPlug)
74 plug(Pleroma.Plugs.UserEnabledPlug)
75 plug(Pleroma.Plugs.SetUserSessionIdPlug)
76 plug(Pleroma.Plugs.EnsureUserKeyPlug)
79 pipeline :pleroma_html do
80 plug(:accepts, ["html"])
82 plug(Pleroma.Plugs.OAuthPlug)
83 plug(Pleroma.Plugs.BasicAuthDecoderPlug)
84 plug(Pleroma.Plugs.UserFetcherPlug)
85 plug(Pleroma.Plugs.SessionAuthenticationPlug)
86 plug(Pleroma.Plugs.AuthenticationPlug)
87 plug(Pleroma.Plugs.EnsureUserKeyPlug)
90 pipeline :oauth_read_or_public do
91 plug(Pleroma.Plugs.OAuthScopesPlug, %{
93 fallback: :proceed_unauthenticated
96 plug(Pleroma.Plugs.EnsurePublicOrAuthenticatedPlug)
99 pipeline :oauth_read do
100 plug(Pleroma.Plugs.OAuthScopesPlug, %{scopes: ["read"]})
103 pipeline :oauth_write do
104 plug(Pleroma.Plugs.OAuthScopesPlug, %{scopes: ["write"]})
107 pipeline :oauth_follow do
108 plug(Pleroma.Plugs.OAuthScopesPlug, %{scopes: ["follow"]})
111 pipeline :oauth_push do
112 plug(Pleroma.Plugs.OAuthScopesPlug, %{scopes: ["push"]})
115 pipeline :well_known do
116 plug(:accepts, ["json", "jrd+json", "xml", "xrd+xml"])
120 plug(:accepts, ["json", "xml"])
123 pipeline :pleroma_api do
124 plug(:accepts, ["html", "json"])
127 pipeline :mailbox_preview do
128 plug(:accepts, ["html"])
130 plug(:put_secure_browser_headers, %{
131 "content-security-policy" =>
132 "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline' 'unsafe-eval'"
136 pipeline :http_signature do
137 plug(Pleroma.Web.Plugs.HTTPSignaturePlug)
140 scope "/api/pleroma", Pleroma.Web.TwitterAPI do
141 pipe_through(:pleroma_api)
143 get("/password_reset/:token", PasswordController, :reset, as: :reset_password)
144 post("/password_reset", PasswordController, :do_reset, as: :reset_password)
145 get("/emoji", UtilController, :emoji)
146 get("/captcha", UtilController, :captcha)
147 get("/healthcheck", UtilController, :healthcheck)
150 scope "/api/pleroma", Pleroma.Web do
151 pipe_through(:pleroma_api)
152 post("/uploader_callback/:upload_path", UploaderController, :callback)
155 scope "/api/pleroma/admin", Pleroma.Web.AdminAPI do
156 pipe_through([:admin_api, :oauth_write])
158 post("/users/follow", AdminAPIController, :user_follow)
159 post("/users/unfollow", AdminAPIController, :user_unfollow)
161 delete("/users", AdminAPIController, :user_delete)
162 post("/users", AdminAPIController, :users_create)
163 patch("/users/:nickname/toggle_activation", AdminAPIController, :user_toggle_activation)
164 put("/users/tag", AdminAPIController, :tag_users)
165 delete("/users/tag", AdminAPIController, :untag_users)
167 get("/users/:nickname/permission_group", AdminAPIController, :right_get)
168 get("/users/:nickname/permission_group/:permission_group", AdminAPIController, :right_get)
169 post("/users/:nickname/permission_group/:permission_group", AdminAPIController, :right_add)
172 "/users/:nickname/permission_group/:permission_group",
177 put("/users/:nickname/activation_status", AdminAPIController, :set_activation_status)
179 post("/relay", AdminAPIController, :relay_follow)
180 delete("/relay", AdminAPIController, :relay_unfollow)
182 get("/users/invite_token", AdminAPIController, :get_invite_token)
183 get("/users/invites", AdminAPIController, :invites)
184 post("/users/revoke_invite", AdminAPIController, :revoke_invite)
185 post("/users/email_invite", AdminAPIController, :email_invite)
187 get("/users/:nickname/password_reset", AdminAPIController, :get_password_reset)
189 get("/users", AdminAPIController, :list_users)
190 get("/users/:nickname", AdminAPIController, :user_show)
191 get("/users/:nickname/statuses", AdminAPIController, :list_user_statuses)
193 get("/reports", AdminAPIController, :list_reports)
194 get("/reports/:id", AdminAPIController, :report_show)
195 put("/reports/:id", AdminAPIController, :report_update_state)
196 post("/reports/:id/respond", AdminAPIController, :report_respond)
198 put("/statuses/:id", AdminAPIController, :status_update)
199 delete("/statuses/:id", AdminAPIController, :status_delete)
201 get("/config", AdminAPIController, :config_show)
202 post("/config", AdminAPIController, :config_update)
203 get("/config/migrate_to_db", AdminAPIController, :migrate_to_db)
204 get("/config/migrate_from_db", AdminAPIController, :migrate_from_db)
206 get("/moderation_log", AdminAPIController, :list_log)
209 scope "/", Pleroma.Web.TwitterAPI do
210 pipe_through(:pleroma_html)
212 post("/main/ostatus", UtilController, :remote_subscribe)
213 get("/ostatus_subscribe", UtilController, :remote_follow)
216 pipe_through(:oauth_follow)
217 post("/ostatus_subscribe", UtilController, :do_remote_follow)
221 scope "/api/pleroma", Pleroma.Web.TwitterAPI do
222 pipe_through(:authenticated_api)
225 pipe_through(:oauth_write)
227 post("/change_password", UtilController, :change_password)
228 post("/delete_account", UtilController, :delete_account)
229 put("/notification_settings", UtilController, :update_notificaton_settings)
230 post("/disable_account", UtilController, :disable_account)
234 pipe_through(:oauth_follow)
236 post("/blocks_import", UtilController, :blocks_import)
237 post("/follow_import", UtilController, :follow_import)
241 pipe_through(:oauth_read)
243 post("/notifications/read", UtilController, :notifications_read)
247 scope "/oauth", Pleroma.Web.OAuth do
250 get("/authorize", OAuthController, :authorize)
253 post("/authorize", OAuthController, :create_authorization)
254 post("/token", OAuthController, :token_exchange)
255 post("/revoke", OAuthController, :token_revoke)
256 get("/registration_details", OAuthController, :registration_details)
259 pipe_through(:browser)
261 get("/prepare_request", OAuthController, :prepare_request)
262 get("/:provider", OAuthController, :request)
263 get("/:provider/callback", OAuthController, :callback)
264 post("/register", OAuthController, :register)
268 scope "/api/v1/pleroma", Pleroma.Web.PleromaAPI do
269 pipe_through(:authenticated_api)
272 pipe_through(:oauth_read)
273 get("/conversations/:id/statuses", PleromaAPIController, :conversation_statuses)
274 get("/conversations/:id", PleromaAPIController, :conversation)
278 pipe_through(:oauth_write)
279 patch("/conversations/:id", PleromaAPIController, :update_conversation)
280 post("/statuses/:id/react_with_emoji", PleromaAPIController, :react_with_emoji)
284 scope "/api/v1", Pleroma.Web.MastodonAPI do
285 pipe_through(:authenticated_api)
288 pipe_through(:oauth_read)
290 get("/accounts/verify_credentials", MastodonAPIController, :verify_credentials)
292 get("/accounts/relationships", MastodonAPIController, :relationships)
294 get("/accounts/:id/lists", MastodonAPIController, :account_lists)
295 get("/accounts/:id/identity_proofs", MastodonAPIController, :empty_array)
297 get("/follow_requests", MastodonAPIController, :follow_requests)
298 get("/blocks", MastodonAPIController, :blocks)
299 get("/mutes", MastodonAPIController, :mutes)
301 get("/timelines/home", MastodonAPIController, :home_timeline)
302 get("/timelines/direct", MastodonAPIController, :dm_timeline)
304 get("/favourites", MastodonAPIController, :favourites)
305 get("/bookmarks", MastodonAPIController, :bookmarks)
307 post("/notifications/clear", MastodonAPIController, :clear_notifications)
308 post("/notifications/dismiss", MastodonAPIController, :dismiss_notification)
309 get("/notifications", MastodonAPIController, :notifications)
310 get("/notifications/:id", MastodonAPIController, :get_notification)
311 delete("/notifications/destroy_multiple", MastodonAPIController, :destroy_multiple)
313 get("/scheduled_statuses", MastodonAPIController, :scheduled_statuses)
314 get("/scheduled_statuses/:id", MastodonAPIController, :show_scheduled_status)
316 get("/lists", ListController, :index)
317 get("/lists/:id", ListController, :show)
318 get("/lists/:id/accounts", ListController, :list_accounts)
320 get("/domain_blocks", MastodonAPIController, :domain_blocks)
322 get("/filters", MastodonAPIController, :get_filters)
324 get("/suggestions", MastodonAPIController, :suggestions)
326 get("/conversations", MastodonAPIController, :conversations)
327 post("/conversations/:id/read", MastodonAPIController, :conversation_read)
329 get("/endorsements", MastodonAPIController, :empty_array)
333 pipe_through(:oauth_write)
335 patch("/accounts/update_credentials", MastodonAPIController, :update_credentials)
337 post("/statuses", MastodonAPIController, :post_status)
338 delete("/statuses/:id", MastodonAPIController, :delete_status)
340 post("/statuses/:id/reblog", MastodonAPIController, :reblog_status)
341 post("/statuses/:id/unreblog", MastodonAPIController, :unreblog_status)
342 post("/statuses/:id/favourite", MastodonAPIController, :fav_status)
343 post("/statuses/:id/unfavourite", MastodonAPIController, :unfav_status)
344 post("/statuses/:id/pin", MastodonAPIController, :pin_status)
345 post("/statuses/:id/unpin", MastodonAPIController, :unpin_status)
346 post("/statuses/:id/bookmark", MastodonAPIController, :bookmark_status)
347 post("/statuses/:id/unbookmark", MastodonAPIController, :unbookmark_status)
348 post("/statuses/:id/mute", MastodonAPIController, :mute_conversation)
349 post("/statuses/:id/unmute", MastodonAPIController, :unmute_conversation)
351 put("/scheduled_statuses/:id", MastodonAPIController, :update_scheduled_status)
352 delete("/scheduled_statuses/:id", MastodonAPIController, :delete_scheduled_status)
354 post("/polls/:id/votes", MastodonAPIController, :poll_vote)
356 post("/media", MastodonAPIController, :upload)
357 put("/media/:id", MastodonAPIController, :update_media)
359 delete("/lists/:id", ListController, :delete)
360 post("/lists", ListController, :create)
361 put("/lists/:id", ListController, :update)
363 post("/lists/:id/accounts", ListController, :add_to_list)
364 delete("/lists/:id/accounts", ListController, :remove_from_list)
366 post("/filters", MastodonAPIController, :create_filter)
367 get("/filters/:id", MastodonAPIController, :get_filter)
368 put("/filters/:id", MastodonAPIController, :update_filter)
369 delete("/filters/:id", MastodonAPIController, :delete_filter)
371 patch("/pleroma/accounts/update_avatar", MastodonAPIController, :update_avatar)
372 patch("/pleroma/accounts/update_banner", MastodonAPIController, :update_banner)
373 patch("/pleroma/accounts/update_background", MastodonAPIController, :update_background)
375 get("/pleroma/mascot", MastodonAPIController, :get_mascot)
376 put("/pleroma/mascot", MastodonAPIController, :set_mascot)
378 post("/reports", MastodonAPIController, :reports)
382 pipe_through(:oauth_follow)
384 post("/follows", MastodonAPIController, :follow)
385 post("/accounts/:id/follow", MastodonAPIController, :follow)
387 post("/accounts/:id/unfollow", MastodonAPIController, :unfollow)
388 post("/accounts/:id/block", MastodonAPIController, :block)
389 post("/accounts/:id/unblock", MastodonAPIController, :unblock)
390 post("/accounts/:id/mute", MastodonAPIController, :mute)
391 post("/accounts/:id/unmute", MastodonAPIController, :unmute)
393 post("/follow_requests/:id/authorize", MastodonAPIController, :authorize_follow_request)
394 post("/follow_requests/:id/reject", MastodonAPIController, :reject_follow_request)
396 post("/domain_blocks", MastodonAPIController, :block_domain)
397 delete("/domain_blocks", MastodonAPIController, :unblock_domain)
399 post("/pleroma/accounts/:id/subscribe", MastodonAPIController, :subscribe)
400 post("/pleroma/accounts/:id/unsubscribe", MastodonAPIController, :unsubscribe)
404 pipe_through(:oauth_push)
406 post("/push/subscription", SubscriptionController, :create)
407 get("/push/subscription", SubscriptionController, :get)
408 put("/push/subscription", SubscriptionController, :update)
409 delete("/push/subscription", SubscriptionController, :delete)
413 scope "/api/web", Pleroma.Web.MastodonAPI do
414 pipe_through([:authenticated_api, :oauth_write])
416 put("/settings", MastodonAPIController, :put_settings)
419 scope "/api/v1", Pleroma.Web.MastodonAPI do
422 post("/accounts", MastodonAPIController, :account_register)
424 get("/instance", MastodonAPIController, :masto_instance)
425 get("/instance/peers", MastodonAPIController, :peers)
426 post("/apps", MastodonAPIController, :create_app)
427 get("/apps/verify_credentials", MastodonAPIController, :verify_app_credentials)
428 get("/custom_emojis", MastodonAPIController, :custom_emojis)
430 get("/statuses/:id/card", MastodonAPIController, :status_card)
432 get("/statuses/:id/favourited_by", MastodonAPIController, :favourited_by)
433 get("/statuses/:id/reblogged_by", MastodonAPIController, :reblogged_by)
435 get("/trends", MastodonAPIController, :empty_array)
437 get("/accounts/search", SearchController, :account_search)
440 "/pleroma/accounts/confirmation_resend",
441 MastodonAPIController,
442 :account_confirmation_resend
446 pipe_through(:oauth_read_or_public)
448 get("/timelines/public", MastodonAPIController, :public_timeline)
449 get("/timelines/tag/:tag", MastodonAPIController, :hashtag_timeline)
450 get("/timelines/list/:list_id", MastodonAPIController, :list_timeline)
452 get("/statuses/:id", MastodonAPIController, :get_status)
453 get("/statuses/:id/context", MastodonAPIController, :get_context)
455 get("/polls/:id", MastodonAPIController, :get_poll)
457 get("/accounts/:id/statuses", MastodonAPIController, :user_statuses)
458 get("/accounts/:id/followers", MastodonAPIController, :followers)
459 get("/accounts/:id/following", MastodonAPIController, :following)
460 get("/accounts/:id", MastodonAPIController, :user)
462 get("/search", SearchController, :search)
464 get("/pleroma/accounts/:id/favourites", MastodonAPIController, :user_favourites)
468 scope "/api/v2", Pleroma.Web.MastodonAPI do
469 pipe_through([:api, :oauth_read_or_public])
470 get("/search", SearchController, :search2)
473 scope "/api", Pleroma.Web do
474 pipe_through(:config)
476 get("/help/test", TwitterAPI.UtilController, :help_test)
477 post("/help/test", TwitterAPI.UtilController, :help_test)
478 get("/statusnet/config", TwitterAPI.UtilController, :config)
479 get("/statusnet/version", TwitterAPI.UtilController, :version)
480 get("/pleroma/frontend_configurations", TwitterAPI.UtilController, :frontend_configurations)
483 scope "/api", Pleroma.Web do
486 post("/account/register", TwitterAPI.Controller, :register)
487 post("/account/password_reset", TwitterAPI.Controller, :password_reset)
489 post("/account/resend_confirmation_email", TwitterAPI.Controller, :resend_confirmation_email)
492 "/account/confirm_email/:user_id/:token",
493 TwitterAPI.Controller,
499 pipe_through(:oauth_read_or_public)
501 get("/statuses/user_timeline", TwitterAPI.Controller, :user_timeline)
502 get("/qvitter/statuses/user_timeline", TwitterAPI.Controller, :user_timeline)
503 get("/users/show", TwitterAPI.Controller, :show_user)
505 get("/statuses/followers", TwitterAPI.Controller, :followers)
506 get("/statuses/friends", TwitterAPI.Controller, :friends)
507 get("/statuses/blocks", TwitterAPI.Controller, :blocks)
508 get("/statuses/show/:id", TwitterAPI.Controller, :fetch_status)
509 get("/statusnet/conversation/:id", TwitterAPI.Controller, :fetch_conversation)
511 get("/search", TwitterAPI.Controller, :search)
512 get("/statusnet/tags/timeline/:tag", TwitterAPI.Controller, :public_and_external_timeline)
516 scope "/api", Pleroma.Web do
517 pipe_through([:api, :oauth_read_or_public])
519 get("/statuses/public_timeline", TwitterAPI.Controller, :public_timeline)
522 "/statuses/public_and_external_timeline",
523 TwitterAPI.Controller,
524 :public_and_external_timeline
527 get("/statuses/networkpublic_timeline", TwitterAPI.Controller, :public_and_external_timeline)
530 scope "/api", Pleroma.Web, as: :twitter_api_search do
531 pipe_through([:api, :oauth_read_or_public])
532 get("/pleroma/search_user", TwitterAPI.Controller, :search_user)
535 scope "/api", Pleroma.Web, as: :authenticated_twitter_api do
536 pipe_through(:authenticated_api)
538 get("/oauth_tokens", TwitterAPI.Controller, :oauth_tokens)
539 delete("/oauth_tokens/:id", TwitterAPI.Controller, :revoke_token)
542 pipe_through(:oauth_read)
544 get("/account/verify_credentials", TwitterAPI.Controller, :verify_credentials)
545 post("/account/verify_credentials", TwitterAPI.Controller, :verify_credentials)
547 get("/statuses/home_timeline", TwitterAPI.Controller, :friends_timeline)
548 get("/statuses/friends_timeline", TwitterAPI.Controller, :friends_timeline)
549 get("/statuses/mentions", TwitterAPI.Controller, :mentions_timeline)
550 get("/statuses/mentions_timeline", TwitterAPI.Controller, :mentions_timeline)
551 get("/statuses/dm_timeline", TwitterAPI.Controller, :dm_timeline)
552 get("/qvitter/statuses/notifications", TwitterAPI.Controller, :notifications)
554 get("/pleroma/friend_requests", TwitterAPI.Controller, :friend_requests)
556 get("/friends/ids", TwitterAPI.Controller, :friends_ids)
557 get("/friendships/no_retweets/ids", TwitterAPI.Controller, :empty_array)
559 get("/mutes/users/ids", TwitterAPI.Controller, :empty_array)
560 get("/qvitter/mutes", TwitterAPI.Controller, :raw_empty_array)
562 get("/externalprofile/show", TwitterAPI.Controller, :external_profile)
564 post("/qvitter/statuses/notifications/read", TwitterAPI.Controller, :notifications_read)
568 pipe_through(:oauth_write)
570 post("/account/update_profile", TwitterAPI.Controller, :update_profile)
571 post("/account/update_profile_banner", TwitterAPI.Controller, :update_banner)
572 post("/qvitter/update_background_image", TwitterAPI.Controller, :update_background)
574 post("/statuses/update", TwitterAPI.Controller, :status_update)
575 post("/statuses/retweet/:id", TwitterAPI.Controller, :retweet)
576 post("/statuses/unretweet/:id", TwitterAPI.Controller, :unretweet)
577 post("/statuses/destroy/:id", TwitterAPI.Controller, :delete_post)
579 post("/statuses/pin/:id", TwitterAPI.Controller, :pin)
580 post("/statuses/unpin/:id", TwitterAPI.Controller, :unpin)
582 post("/statusnet/media/upload", TwitterAPI.Controller, :upload)
583 post("/media/upload", TwitterAPI.Controller, :upload_json)
584 post("/media/metadata/create", TwitterAPI.Controller, :update_media)
586 post("/favorites/create/:id", TwitterAPI.Controller, :favorite)
587 post("/favorites/create", TwitterAPI.Controller, :favorite)
588 post("/favorites/destroy/:id", TwitterAPI.Controller, :unfavorite)
590 post("/qvitter/update_avatar", TwitterAPI.Controller, :update_avatar)
594 pipe_through(:oauth_follow)
596 post("/pleroma/friendships/approve", TwitterAPI.Controller, :approve_friend_request)
597 post("/pleroma/friendships/deny", TwitterAPI.Controller, :deny_friend_request)
599 post("/friendships/create", TwitterAPI.Controller, :follow)
600 post("/friendships/destroy", TwitterAPI.Controller, :unfollow)
602 post("/blocks/create", TwitterAPI.Controller, :block)
603 post("/blocks/destroy", TwitterAPI.Controller, :unblock)
607 pipeline :ap_service_actor do
608 plug(:accepts, ["activity+json", "json"])
612 plug(:accepts, ["html", "xml", "atom", "activity+json", "json"])
616 plug(:accepts, ["json", "xml"])
619 scope "/", Pleroma.Web do
620 pipe_through(:ostatus)
622 get("/objects/:uuid", OStatus.OStatusController, :object)
623 get("/activities/:uuid", OStatus.OStatusController, :activity)
624 get("/notice/:id", OStatus.OStatusController, :notice)
625 get("/notice/:id/embed_player", OStatus.OStatusController, :notice_player)
626 get("/users/:nickname/feed", OStatus.OStatusController, :feed)
627 get("/users/:nickname", OStatus.OStatusController, :feed_redirect)
629 post("/users/:nickname/salmon", OStatus.OStatusController, :salmon_incoming)
630 post("/push/hub/:nickname", Websub.WebsubController, :websub_subscription_request)
631 get("/push/subscriptions/:id", Websub.WebsubController, :websub_subscription_confirmation)
632 post("/push/subscriptions/:id", Websub.WebsubController, :websub_incoming)
634 get("/mailer/unsubscribe/:token", Mailer.SubscriptionController, :unsubscribe)
637 pipeline :activitypub do
638 plug(:accepts, ["activity+json", "json"])
639 plug(Pleroma.Web.Plugs.HTTPSignaturePlug)
640 plug(Pleroma.Web.Plugs.MappedSignatureToIdentityPlug)
643 scope "/", Pleroma.Web.ActivityPub do
644 # XXX: not really ostatus
645 pipe_through(:ostatus)
647 get("/users/:nickname/outbox", ActivityPubController, :outbox)
648 get("/objects/:uuid/likes", ActivityPubController, :object_likes)
651 pipeline :activitypub_client do
652 plug(:accepts, ["activity+json", "json"])
654 plug(Pleroma.Plugs.OAuthPlug)
655 plug(Pleroma.Plugs.BasicAuthDecoderPlug)
656 plug(Pleroma.Plugs.UserFetcherPlug)
657 plug(Pleroma.Plugs.SessionAuthenticationPlug)
658 plug(Pleroma.Plugs.LegacyAuthenticationPlug)
659 plug(Pleroma.Plugs.AuthenticationPlug)
660 plug(Pleroma.Plugs.UserEnabledPlug)
661 plug(Pleroma.Plugs.SetUserSessionIdPlug)
662 plug(Pleroma.Plugs.EnsureUserKeyPlug)
665 scope "/", Pleroma.Web.ActivityPub do
666 pipe_through([:activitypub_client])
669 pipe_through(:oauth_read)
670 get("/api/ap/whoami", ActivityPubController, :whoami)
671 get("/users/:nickname/inbox", ActivityPubController, :read_inbox)
675 pipe_through(:oauth_write)
676 post("/users/:nickname/outbox", ActivityPubController, :update_outbox)
680 pipe_through(:oauth_read_or_public)
681 get("/users/:nickname/followers", ActivityPubController, :followers)
682 get("/users/:nickname/following", ActivityPubController, :following)
686 scope "/", Pleroma.Web.ActivityPub do
687 pipe_through(:activitypub)
688 post("/inbox", ActivityPubController, :inbox)
689 post("/users/:nickname/inbox", ActivityPubController, :inbox)
692 scope "/relay", Pleroma.Web.ActivityPub do
693 pipe_through(:ap_service_actor)
695 get("/", ActivityPubController, :relay)
698 pipe_through(:http_signature)
699 post("/inbox", ActivityPubController, :inbox)
702 get("/following", ActivityPubController, :following, assigns: %{relay: true})
703 get("/followers", ActivityPubController, :followers, assigns: %{relay: true})
706 scope "/internal/fetch", Pleroma.Web.ActivityPub do
707 pipe_through(:ap_service_actor)
709 get("/", ActivityPubController, :internal_fetch)
710 post("/inbox", ActivityPubController, :inbox)
713 scope "/.well-known", Pleroma.Web do
714 pipe_through(:well_known)
716 get("/host-meta", WebFinger.WebFingerController, :host_meta)
717 get("/webfinger", WebFinger.WebFingerController, :webfinger)
718 get("/nodeinfo", Nodeinfo.NodeinfoController, :schemas)
721 scope "/nodeinfo", Pleroma.Web do
722 get("/:version", Nodeinfo.NodeinfoController, :nodeinfo)
725 scope "/", Pleroma.Web.MastodonAPI do
726 pipe_through(:mastodon_html)
728 get("/web/login", MastodonAPIController, :login)
729 delete("/auth/sign_out", MastodonAPIController, :logout)
731 post("/auth/password", MastodonAPIController, :password_reset)
734 pipe_through(:oauth_read)
735 get("/web/*path", MastodonAPIController, :index)
739 pipeline :remote_media do
742 scope "/proxy/", Pleroma.Web.MediaProxy do
743 pipe_through(:remote_media)
745 get("/:sig/:url", MediaProxyController, :remote)
746 get("/:sig/:url/:filename", MediaProxyController, :remote)
749 if Pleroma.Config.get(:env) == :dev do
751 pipe_through([:mailbox_preview])
753 forward("/mailbox", Plug.Swoosh.MailboxPreview, base_path: "/dev/mailbox")
757 scope "/", Pleroma.Web.MongooseIM do
758 get("/user_exists", MongooseIMController, :user_exists)
759 get("/check_password", MongooseIMController, :check_password)
762 scope "/", Fallback do
763 get("/registration/:token", RedirectController, :registration_page)
764 get("/:maybe_nickname_or_id", RedirectController, :redirector_with_meta)
765 get("/api*path", RedirectController, :api_not_implemented)
766 get("/*path", RedirectController, :redirector)
768 options("/*path", RedirectController, :empty)