Merge remote-tracking branch 'upstream/develop' into feature/move-activity
[akkoma] / lib / pleroma / web / router.ex
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Web.Router do
6 use Pleroma.Web, :router
7
8 pipeline :browser do
9 plug(:accepts, ["html"])
10 plug(:fetch_session)
11 end
12
13 pipeline :oauth do
14 plug(:fetch_session)
15 plug(Pleroma.Plugs.OAuthPlug)
16 end
17
18 pipeline :api do
19 plug(:accepts, ["json"])
20 plug(:fetch_session)
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)
31 end
32
33 pipeline :authenticated_api do
34 plug(:accepts, ["json"])
35 plug(:fetch_session)
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)
46 end
47
48 pipeline :admin_api do
49 plug(:accepts, ["json"])
50 plug(:fetch_session)
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)
63 end
64
65 pipeline :mastodon_html do
66 plug(:accepts, ["html"])
67 plug(:fetch_session)
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)
77 end
78
79 pipeline :pleroma_html do
80 plug(:accepts, ["html"])
81 plug(:fetch_session)
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)
88 end
89
90 pipeline :well_known do
91 plug(:accepts, ["json", "jrd+json", "xml", "xrd+xml"])
92 end
93
94 pipeline :config do
95 plug(:accepts, ["json", "xml"])
96 end
97
98 pipeline :pleroma_api do
99 plug(:accepts, ["html", "json"])
100 end
101
102 pipeline :mailbox_preview do
103 plug(:accepts, ["html"])
104
105 plug(:put_secure_browser_headers, %{
106 "content-security-policy" =>
107 "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline' 'unsafe-eval'"
108 })
109 end
110
111 pipeline :http_signature do
112 plug(Pleroma.Web.Plugs.HTTPSignaturePlug)
113 plug(Pleroma.Web.Plugs.MappedSignatureToIdentityPlug)
114 end
115
116 scope "/api/pleroma", Pleroma.Web.TwitterAPI do
117 pipe_through(:pleroma_api)
118
119 get("/password_reset/:token", PasswordController, :reset, as: :reset_password)
120 post("/password_reset", PasswordController, :do_reset, as: :reset_password)
121 get("/emoji", UtilController, :emoji)
122 get("/captcha", UtilController, :captcha)
123 get("/healthcheck", UtilController, :healthcheck)
124 end
125
126 scope "/api/pleroma", Pleroma.Web do
127 pipe_through(:pleroma_api)
128 post("/uploader_callback/:upload_path", UploaderController, :callback)
129 end
130
131 scope "/api/pleroma/admin", Pleroma.Web.AdminAPI do
132 pipe_through(:admin_api)
133
134 post("/users/follow", AdminAPIController, :user_follow)
135 post("/users/unfollow", AdminAPIController, :user_unfollow)
136
137 delete("/users", AdminAPIController, :user_delete)
138 post("/users", AdminAPIController, :users_create)
139 patch("/users/:nickname/toggle_activation", AdminAPIController, :user_toggle_activation)
140 patch("/users/activate", AdminAPIController, :user_activate)
141 patch("/users/deactivate", AdminAPIController, :user_deactivate)
142 put("/users/tag", AdminAPIController, :tag_users)
143 delete("/users/tag", AdminAPIController, :untag_users)
144
145 get("/users/:nickname/permission_group", AdminAPIController, :right_get)
146 get("/users/:nickname/permission_group/:permission_group", AdminAPIController, :right_get)
147
148 post("/users/:nickname/permission_group/:permission_group", AdminAPIController, :right_add)
149
150 delete(
151 "/users/:nickname/permission_group/:permission_group",
152 AdminAPIController,
153 :right_delete
154 )
155
156 post("/users/permission_group/:permission_group", AdminAPIController, :right_add_multiple)
157
158 delete(
159 "/users/permission_group/:permission_group",
160 AdminAPIController,
161 :right_delete_multiple
162 )
163
164 get("/relay", AdminAPIController, :relay_list)
165 post("/relay", AdminAPIController, :relay_follow)
166 delete("/relay", AdminAPIController, :relay_unfollow)
167
168 post("/users/invite_token", AdminAPIController, :create_invite_token)
169 get("/users/invites", AdminAPIController, :invites)
170 post("/users/revoke_invite", AdminAPIController, :revoke_invite)
171 post("/users/email_invite", AdminAPIController, :email_invite)
172
173 get("/users/:nickname/password_reset", AdminAPIController, :get_password_reset)
174 patch("/users/force_password_reset", AdminAPIController, :force_password_reset)
175
176 get("/users", AdminAPIController, :list_users)
177 get("/users/:nickname", AdminAPIController, :user_show)
178 get("/users/:nickname/statuses", AdminAPIController, :list_user_statuses)
179
180 get("/reports", AdminAPIController, :list_reports)
181 get("/reports/:id", AdminAPIController, :report_show)
182 put("/reports/:id", AdminAPIController, :report_update_state)
183 post("/reports/:id/respond", AdminAPIController, :report_respond)
184
185 put("/statuses/:id", AdminAPIController, :status_update)
186 delete("/statuses/:id", AdminAPIController, :status_delete)
187
188 get("/config", AdminAPIController, :config_show)
189 post("/config", AdminAPIController, :config_update)
190 get("/config/migrate_to_db", AdminAPIController, :migrate_to_db)
191 get("/config/migrate_from_db", AdminAPIController, :migrate_from_db)
192
193 get("/moderation_log", AdminAPIController, :list_log)
194
195 post("/reload_emoji", AdminAPIController, :reload_emoji)
196 end
197
198 scope "/api/pleroma/emoji", Pleroma.Web.PleromaAPI do
199 scope "/packs" do
200 # Modifying packs
201 pipe_through(:admin_api)
202
203 post("/import_from_fs", EmojiAPIController, :import_from_fs)
204
205 post("/:pack_name/update_file", EmojiAPIController, :update_file)
206 post("/:pack_name/update_metadata", EmojiAPIController, :update_metadata)
207 put("/:name", EmojiAPIController, :create)
208 delete("/:name", EmojiAPIController, :delete)
209 post("/download_from", EmojiAPIController, :download_from)
210 post("/list_from", EmojiAPIController, :list_from)
211 end
212
213 scope "/packs" do
214 # Pack info / downloading
215 get("/", EmojiAPIController, :list_packs)
216 get("/:name/download_shared/", EmojiAPIController, :download_shared)
217 end
218 end
219
220 scope "/", Pleroma.Web.TwitterAPI do
221 pipe_through(:pleroma_html)
222
223 post("/main/ostatus", UtilController, :remote_subscribe)
224 get("/ostatus_subscribe", UtilController, :remote_follow)
225
226 post("/ostatus_subscribe", UtilController, :do_remote_follow)
227 end
228
229 scope "/api/pleroma", Pleroma.Web.TwitterAPI do
230 pipe_through(:authenticated_api)
231
232 post("/change_email", UtilController, :change_email)
233 post("/change_password", UtilController, :change_password)
234 post("/delete_account", UtilController, :delete_account)
235 put("/notification_settings", UtilController, :update_notificaton_settings)
236 post("/disable_account", UtilController, :disable_account)
237
238 post("/blocks_import", UtilController, :blocks_import)
239 post("/follow_import", UtilController, :follow_import)
240 end
241
242 scope "/oauth", Pleroma.Web.OAuth do
243 scope [] do
244 pipe_through(:oauth)
245 get("/authorize", OAuthController, :authorize)
246 end
247
248 post("/authorize", OAuthController, :create_authorization)
249 post("/token", OAuthController, :token_exchange)
250 post("/revoke", OAuthController, :token_revoke)
251 get("/registration_details", OAuthController, :registration_details)
252
253 scope [] do
254 pipe_through(:browser)
255
256 get("/prepare_request", OAuthController, :prepare_request)
257 get("/:provider", OAuthController, :request)
258 get("/:provider/callback", OAuthController, :callback)
259 post("/register", OAuthController, :register)
260 end
261 end
262
263 scope "/api/v1/pleroma", Pleroma.Web.PleromaAPI do
264 pipe_through(:api)
265
266 get("/statuses/:id/emoji_reactions_by", PleromaAPIController, :emoji_reactions_by)
267 end
268
269 scope "/api/v1/pleroma", Pleroma.Web.PleromaAPI do
270 scope [] do
271 pipe_through(:authenticated_api)
272
273 get("/conversations/:id/statuses", PleromaAPIController, :conversation_statuses)
274 get("/conversations/:id", PleromaAPIController, :conversation)
275 post("/conversations/read", PleromaAPIController, :read_conversations)
276 end
277
278 scope [] do
279 pipe_through(:authenticated_api)
280
281 patch("/conversations/:id", PleromaAPIController, :update_conversation)
282 post("/statuses/:id/react_with_emoji", PleromaAPIController, :react_with_emoji)
283 post("/statuses/:id/unreact_with_emoji", PleromaAPIController, :unreact_with_emoji)
284 post("/notifications/read", PleromaAPIController, :read_notification)
285
286 patch("/accounts/update_avatar", AccountController, :update_avatar)
287 patch("/accounts/update_banner", AccountController, :update_banner)
288 patch("/accounts/update_background", AccountController, :update_background)
289
290 get("/mascot", MascotController, :show)
291 put("/mascot", MascotController, :update)
292
293 post("/scrobble", ScrobbleController, :new_scrobble)
294 end
295
296 scope [] do
297 pipe_through(:api)
298 get("/accounts/:id/favourites", AccountController, :favourites)
299 end
300
301 scope [] do
302 pipe_through(:authenticated_api)
303
304 post("/accounts/:id/subscribe", AccountController, :subscribe)
305 post("/accounts/:id/unsubscribe", AccountController, :unsubscribe)
306 end
307
308 post("/accounts/confirmation_resend", AccountController, :confirmation_resend)
309 end
310
311 scope "/api/v1/pleroma", Pleroma.Web.PleromaAPI do
312 pipe_through(:api)
313 get("/accounts/:id/scrobbles", ScrobbleController, :user_scrobbles)
314 end
315
316 scope "/api/v1", Pleroma.Web.MastodonAPI do
317 pipe_through(:authenticated_api)
318
319 get("/accounts/verify_credentials", AccountController, :verify_credentials)
320
321 get("/accounts/relationships", AccountController, :relationships)
322
323 get("/accounts/:id/lists", AccountController, :lists)
324 get("/accounts/:id/identity_proofs", MastodonAPIController, :empty_array)
325
326 get("/follow_requests", FollowRequestController, :index)
327 get("/blocks", AccountController, :blocks)
328 get("/mutes", AccountController, :mutes)
329
330 get("/timelines/home", TimelineController, :home)
331 get("/timelines/direct", TimelineController, :direct)
332
333 get("/favourites", StatusController, :favourites)
334 get("/bookmarks", StatusController, :bookmarks)
335
336 get("/notifications", NotificationController, :index)
337 get("/notifications/:id", NotificationController, :show)
338 post("/notifications/clear", NotificationController, :clear)
339 post("/notifications/dismiss", NotificationController, :dismiss)
340 delete("/notifications/destroy_multiple", NotificationController, :destroy_multiple)
341
342 get("/scheduled_statuses", ScheduledActivityController, :index)
343 get("/scheduled_statuses/:id", ScheduledActivityController, :show)
344
345 get("/lists", ListController, :index)
346 get("/lists/:id", ListController, :show)
347 get("/lists/:id/accounts", ListController, :list_accounts)
348
349 get("/domain_blocks", DomainBlockController, :index)
350
351 get("/filters", FilterController, :index)
352
353 get("/suggestions", SuggestionController, :index)
354
355 get("/conversations", ConversationController, :index)
356 post("/conversations/:id/read", ConversationController, :read)
357
358 get("/endorsements", AccountController, :endorsements)
359
360 patch("/accounts/update_credentials", AccountController, :update_credentials)
361
362 post("/statuses", StatusController, :create)
363 delete("/statuses/:id", StatusController, :delete)
364
365 post("/statuses/:id/reblog", StatusController, :reblog)
366 post("/statuses/:id/unreblog", StatusController, :unreblog)
367 post("/statuses/:id/favourite", StatusController, :favourite)
368 post("/statuses/:id/unfavourite", StatusController, :unfavourite)
369 post("/statuses/:id/pin", StatusController, :pin)
370 post("/statuses/:id/unpin", StatusController, :unpin)
371 post("/statuses/:id/bookmark", StatusController, :bookmark)
372 post("/statuses/:id/unbookmark", StatusController, :unbookmark)
373 post("/statuses/:id/mute", StatusController, :mute_conversation)
374 post("/statuses/:id/unmute", StatusController, :unmute_conversation)
375
376 put("/scheduled_statuses/:id", ScheduledActivityController, :update)
377 delete("/scheduled_statuses/:id", ScheduledActivityController, :delete)
378
379 post("/polls/:id/votes", PollController, :vote)
380
381 post("/media", MediaController, :create)
382 put("/media/:id", MediaController, :update)
383
384 delete("/lists/:id", ListController, :delete)
385 post("/lists", ListController, :create)
386 put("/lists/:id", ListController, :update)
387
388 post("/lists/:id/accounts", ListController, :add_to_list)
389 delete("/lists/:id/accounts", ListController, :remove_from_list)
390
391 post("/filters", FilterController, :create)
392 get("/filters/:id", FilterController, :show)
393 put("/filters/:id", FilterController, :update)
394 delete("/filters/:id", FilterController, :delete)
395
396 post("/reports", ReportController, :create)
397
398 post("/follows", AccountController, :follows)
399 post("/accounts/:id/follow", AccountController, :follow)
400 post("/accounts/:id/unfollow", AccountController, :unfollow)
401 post("/accounts/:id/block", AccountController, :block)
402 post("/accounts/:id/unblock", AccountController, :unblock)
403 post("/accounts/:id/mute", AccountController, :mute)
404 post("/accounts/:id/unmute", AccountController, :unmute)
405
406 post("/follow_requests/:id/authorize", FollowRequestController, :authorize)
407 post("/follow_requests/:id/reject", FollowRequestController, :reject)
408
409 post("/domain_blocks", DomainBlockController, :create)
410 delete("/domain_blocks", DomainBlockController, :delete)
411
412 post("/push/subscription", SubscriptionController, :create)
413 get("/push/subscription", SubscriptionController, :get)
414 put("/push/subscription", SubscriptionController, :update)
415 delete("/push/subscription", SubscriptionController, :delete)
416
417 get("/markers", MarkerController, :index)
418 post("/markers", MarkerController, :upsert)
419 end
420
421 scope "/api/web", Pleroma.Web do
422 pipe_through(:authenticated_api)
423
424 put("/settings", MastoFEController, :put_settings)
425 end
426
427 scope "/api/v1", Pleroma.Web.MastodonAPI do
428 pipe_through(:api)
429
430 post("/accounts", AccountController, :create)
431 get("/accounts/search", SearchController, :account_search)
432
433 get("/instance", InstanceController, :show)
434 get("/instance/peers", InstanceController, :peers)
435
436 post("/apps", AppController, :create)
437 get("/apps/verify_credentials", AppController, :verify_credentials)
438
439 get("/statuses/:id/card", StatusController, :card)
440 get("/statuses/:id/favourited_by", StatusController, :favourited_by)
441 get("/statuses/:id/reblogged_by", StatusController, :reblogged_by)
442
443 get("/custom_emojis", CustomEmojiController, :index)
444
445 get("/trends", MastodonAPIController, :empty_array)
446
447 get("/timelines/public", TimelineController, :public)
448 get("/timelines/tag/:tag", TimelineController, :hashtag)
449 get("/timelines/list/:list_id", TimelineController, :list)
450
451 get("/statuses", StatusController, :index)
452 get("/statuses/:id", StatusController, :show)
453 get("/statuses/:id/context", StatusController, :context)
454
455 get("/polls/:id", PollController, :show)
456
457 get("/accounts/:id/statuses", AccountController, :statuses)
458 get("/accounts/:id/followers", AccountController, :followers)
459 get("/accounts/:id/following", AccountController, :following)
460 get("/accounts/:id", AccountController, :show)
461
462 get("/search", SearchController, :search)
463 end
464
465 scope "/api/v2", Pleroma.Web.MastodonAPI do
466 pipe_through(:api)
467 get("/search", SearchController, :search2)
468 end
469
470 scope "/api", Pleroma.Web do
471 pipe_through(:config)
472
473 get("/help/test", TwitterAPI.UtilController, :help_test)
474 post("/help/test", TwitterAPI.UtilController, :help_test)
475 get("/statusnet/config", TwitterAPI.UtilController, :config)
476 get("/statusnet/version", TwitterAPI.UtilController, :version)
477 get("/pleroma/frontend_configurations", TwitterAPI.UtilController, :frontend_configurations)
478 end
479
480 scope "/api", Pleroma.Web do
481 pipe_through(:api)
482
483 get(
484 "/account/confirm_email/:user_id/:token",
485 TwitterAPI.Controller,
486 :confirm_email,
487 as: :confirm_email
488 )
489 end
490
491 scope "/api", Pleroma.Web, as: :authenticated_twitter_api do
492 pipe_through(:authenticated_api)
493
494 get("/oauth_tokens", TwitterAPI.Controller, :oauth_tokens)
495 delete("/oauth_tokens/:id", TwitterAPI.Controller, :revoke_token)
496
497 post("/qvitter/statuses/notifications/read", TwitterAPI.Controller, :notifications_read)
498 end
499
500 pipeline :ap_service_actor do
501 plug(:accepts, ["activity+json", "json"])
502 end
503
504 pipeline :ostatus do
505 plug(:accepts, ["html", "xml", "atom", "activity+json", "json"])
506 plug(Pleroma.Plugs.StaticFEPlug)
507 end
508
509 pipeline :oembed do
510 plug(:accepts, ["json", "xml"])
511 end
512
513 scope "/", Pleroma.Web do
514 pipe_through(:ostatus)
515 pipe_through(:http_signature)
516
517 get("/objects/:uuid", OStatus.OStatusController, :object)
518 get("/activities/:uuid", OStatus.OStatusController, :activity)
519 get("/notice/:id", OStatus.OStatusController, :notice)
520 get("/notice/:id/embed_player", OStatus.OStatusController, :notice_player)
521
522 get("/users/:nickname/feed", Feed.FeedController, :feed)
523 get("/users/:nickname", Feed.FeedController, :feed_redirect)
524
525 get("/mailer/unsubscribe/:token", Mailer.SubscriptionController, :unsubscribe)
526 end
527
528 pipeline :activitypub do
529 plug(:accepts, ["activity+json", "json"])
530 plug(Pleroma.Web.Plugs.HTTPSignaturePlug)
531 plug(Pleroma.Web.Plugs.MappedSignatureToIdentityPlug)
532 end
533
534 scope "/", Pleroma.Web.ActivityPub do
535 # XXX: not really ostatus
536 pipe_through(:ostatus)
537
538 get("/users/:nickname/outbox", ActivityPubController, :outbox)
539 end
540
541 pipeline :activitypub_client do
542 plug(:accepts, ["activity+json", "json"])
543 plug(:fetch_session)
544 plug(Pleroma.Plugs.OAuthPlug)
545 plug(Pleroma.Plugs.BasicAuthDecoderPlug)
546 plug(Pleroma.Plugs.UserFetcherPlug)
547 plug(Pleroma.Plugs.SessionAuthenticationPlug)
548 plug(Pleroma.Plugs.LegacyAuthenticationPlug)
549 plug(Pleroma.Plugs.AuthenticationPlug)
550 plug(Pleroma.Plugs.UserEnabledPlug)
551 plug(Pleroma.Plugs.SetUserSessionIdPlug)
552 plug(Pleroma.Plugs.EnsureUserKeyPlug)
553 end
554
555 scope "/", Pleroma.Web.ActivityPub do
556 pipe_through([:activitypub_client])
557
558 get("/api/ap/whoami", ActivityPubController, :whoami)
559 get("/users/:nickname/inbox", ActivityPubController, :read_inbox)
560
561 post("/users/:nickname/outbox", ActivityPubController, :update_outbox)
562 post("/api/ap/upload_media", ActivityPubController, :upload_media)
563
564 get("/users/:nickname/followers", ActivityPubController, :followers)
565 get("/users/:nickname/following", ActivityPubController, :following)
566 end
567
568 scope "/", Pleroma.Web.ActivityPub do
569 pipe_through(:activitypub)
570 post("/inbox", ActivityPubController, :inbox)
571 post("/users/:nickname/inbox", ActivityPubController, :inbox)
572 end
573
574 scope "/relay", Pleroma.Web.ActivityPub do
575 pipe_through(:ap_service_actor)
576
577 get("/", ActivityPubController, :relay)
578
579 scope [] do
580 pipe_through(:http_signature)
581 post("/inbox", ActivityPubController, :inbox)
582 end
583
584 get("/following", ActivityPubController, :following, assigns: %{relay: true})
585 get("/followers", ActivityPubController, :followers, assigns: %{relay: true})
586 end
587
588 scope "/internal/fetch", Pleroma.Web.ActivityPub do
589 pipe_through(:ap_service_actor)
590
591 get("/", ActivityPubController, :internal_fetch)
592 post("/inbox", ActivityPubController, :inbox)
593 end
594
595 scope "/.well-known", Pleroma.Web do
596 pipe_through(:well_known)
597
598 get("/host-meta", WebFinger.WebFingerController, :host_meta)
599 get("/webfinger", WebFinger.WebFingerController, :webfinger)
600 get("/nodeinfo", Nodeinfo.NodeinfoController, :schemas)
601 end
602
603 scope "/nodeinfo", Pleroma.Web do
604 get("/:version", Nodeinfo.NodeinfoController, :nodeinfo)
605 end
606
607 scope "/", Pleroma.Web do
608 pipe_through(:api)
609
610 get("/web/manifest.json", MastoFEController, :manifest)
611 end
612
613 scope "/", Pleroma.Web do
614 pipe_through(:mastodon_html)
615
616 get("/web/login", MastodonAPI.AuthController, :login)
617 delete("/auth/sign_out", MastodonAPI.AuthController, :logout)
618
619 post("/auth/password", MastodonAPI.AuthController, :password_reset)
620
621 get("/web/*path", MastoFEController, :index)
622 end
623
624 pipeline :remote_media do
625 end
626
627 scope "/proxy/", Pleroma.Web.MediaProxy do
628 pipe_through(:remote_media)
629
630 get("/:sig/:url", MediaProxyController, :remote)
631 get("/:sig/:url/:filename", MediaProxyController, :remote)
632 end
633
634 if Pleroma.Config.get(:env) == :dev do
635 scope "/dev" do
636 pipe_through([:mailbox_preview])
637
638 forward("/mailbox", Plug.Swoosh.MailboxPreview, base_path: "/dev/mailbox")
639 end
640 end
641
642 scope "/", Pleroma.Web.MongooseIM do
643 get("/user_exists", MongooseIMController, :user_exists)
644 get("/check_password", MongooseIMController, :check_password)
645 end
646
647 scope "/", Fallback do
648 get("/registration/:token", RedirectController, :registration_page)
649 get("/:maybe_nickname_or_id", RedirectController, :redirector_with_meta)
650 get("/api*path", RedirectController, :api_not_implemented)
651 get("/*path", RedirectController, :redirector)
652
653 options("/*path", RedirectController, :empty)
654 end
655 end