Merge branch 'develop' into feature/reports-groups-and-multiple-state-update
[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("/grouped_reports", AdminAPIController, :list_grouped_reports)
182 get("/reports/:id", AdminAPIController, :report_show)
183 patch("/reports", AdminAPIController, :reports_update)
184 post("/reports/:id/respond", AdminAPIController, :report_respond)
185
186 put("/statuses/:id", AdminAPIController, :status_update)
187 delete("/statuses/:id", AdminAPIController, :status_delete)
188
189 get("/config", AdminAPIController, :config_show)
190 post("/config", AdminAPIController, :config_update)
191 get("/config/migrate_to_db", AdminAPIController, :migrate_to_db)
192 get("/config/migrate_from_db", AdminAPIController, :migrate_from_db)
193
194 get("/moderation_log", AdminAPIController, :list_log)
195
196 post("/reload_emoji", AdminAPIController, :reload_emoji)
197 end
198
199 scope "/api/pleroma/emoji", Pleroma.Web.PleromaAPI do
200 scope "/packs" do
201 # Modifying packs
202 pipe_through(:admin_api)
203
204 post("/import_from_fs", EmojiAPIController, :import_from_fs)
205
206 post("/:pack_name/update_file", EmojiAPIController, :update_file)
207 post("/:pack_name/update_metadata", EmojiAPIController, :update_metadata)
208 put("/:name", EmojiAPIController, :create)
209 delete("/:name", EmojiAPIController, :delete)
210 post("/download_from", EmojiAPIController, :download_from)
211 post("/list_from", EmojiAPIController, :list_from)
212 end
213
214 scope "/packs" do
215 # Pack info / downloading
216 get("/", EmojiAPIController, :list_packs)
217 get("/:name/download_shared/", EmojiAPIController, :download_shared)
218 end
219 end
220
221 scope "/", Pleroma.Web.TwitterAPI do
222 pipe_through(:pleroma_html)
223
224 post("/main/ostatus", UtilController, :remote_subscribe)
225 get("/ostatus_subscribe", UtilController, :remote_follow)
226
227 post("/ostatus_subscribe", UtilController, :do_remote_follow)
228 end
229
230 scope "/api/pleroma", Pleroma.Web.TwitterAPI do
231 pipe_through(:authenticated_api)
232
233 post("/change_email", UtilController, :change_email)
234 post("/change_password", UtilController, :change_password)
235 post("/delete_account", UtilController, :delete_account)
236 put("/notification_settings", UtilController, :update_notificaton_settings)
237 post("/disable_account", UtilController, :disable_account)
238
239 post("/blocks_import", UtilController, :blocks_import)
240 post("/follow_import", UtilController, :follow_import)
241 end
242
243 scope "/oauth", Pleroma.Web.OAuth do
244 scope [] do
245 pipe_through(:oauth)
246 get("/authorize", OAuthController, :authorize)
247 end
248
249 post("/authorize", OAuthController, :create_authorization)
250 post("/token", OAuthController, :token_exchange)
251 post("/revoke", OAuthController, :token_revoke)
252 get("/registration_details", OAuthController, :registration_details)
253
254 scope [] do
255 pipe_through(:browser)
256
257 get("/prepare_request", OAuthController, :prepare_request)
258 get("/:provider", OAuthController, :request)
259 get("/:provider/callback", OAuthController, :callback)
260 post("/register", OAuthController, :register)
261 end
262 end
263
264 scope "/api/v1/pleroma", Pleroma.Web.PleromaAPI do
265 scope [] do
266 pipe_through(:authenticated_api)
267
268 get("/conversations/:id/statuses", PleromaAPIController, :conversation_statuses)
269 get("/conversations/:id", PleromaAPIController, :conversation)
270 post("/conversations/read", PleromaAPIController, :read_conversations)
271 end
272
273 scope [] do
274 pipe_through(:authenticated_api)
275
276 patch("/conversations/:id", PleromaAPIController, :update_conversation)
277 post("/notifications/read", PleromaAPIController, :read_notification)
278
279 patch("/accounts/update_avatar", AccountController, :update_avatar)
280 patch("/accounts/update_banner", AccountController, :update_banner)
281 patch("/accounts/update_background", AccountController, :update_background)
282
283 get("/mascot", MascotController, :show)
284 put("/mascot", MascotController, :update)
285
286 post("/scrobble", ScrobbleController, :new_scrobble)
287 end
288
289 scope [] do
290 pipe_through(:api)
291 get("/accounts/:id/favourites", AccountController, :favourites)
292 end
293
294 scope [] do
295 pipe_through(:authenticated_api)
296
297 post("/accounts/:id/subscribe", AccountController, :subscribe)
298 post("/accounts/:id/unsubscribe", AccountController, :unsubscribe)
299 end
300
301 post("/accounts/confirmation_resend", AccountController, :confirmation_resend)
302 end
303
304 scope "/api/v1/pleroma", Pleroma.Web.PleromaAPI do
305 pipe_through(:api)
306 get("/accounts/:id/scrobbles", ScrobbleController, :user_scrobbles)
307 end
308
309 scope "/api/v1", Pleroma.Web.MastodonAPI do
310 pipe_through(:authenticated_api)
311
312 get("/accounts/verify_credentials", AccountController, :verify_credentials)
313
314 get("/accounts/relationships", AccountController, :relationships)
315
316 get("/accounts/:id/lists", AccountController, :lists)
317 get("/accounts/:id/identity_proofs", MastodonAPIController, :empty_array)
318
319 get("/follow_requests", FollowRequestController, :index)
320 get("/blocks", AccountController, :blocks)
321 get("/mutes", AccountController, :mutes)
322
323 get("/timelines/home", TimelineController, :home)
324 get("/timelines/direct", TimelineController, :direct)
325
326 get("/favourites", StatusController, :favourites)
327 get("/bookmarks", StatusController, :bookmarks)
328
329 get("/notifications", NotificationController, :index)
330 get("/notifications/:id", NotificationController, :show)
331 post("/notifications/clear", NotificationController, :clear)
332 post("/notifications/dismiss", NotificationController, :dismiss)
333 delete("/notifications/destroy_multiple", NotificationController, :destroy_multiple)
334
335 get("/scheduled_statuses", ScheduledActivityController, :index)
336 get("/scheduled_statuses/:id", ScheduledActivityController, :show)
337
338 get("/lists", ListController, :index)
339 get("/lists/:id", ListController, :show)
340 get("/lists/:id/accounts", ListController, :list_accounts)
341
342 get("/domain_blocks", DomainBlockController, :index)
343
344 get("/filters", FilterController, :index)
345
346 get("/suggestions", SuggestionController, :index)
347
348 get("/conversations", ConversationController, :index)
349 post("/conversations/:id/read", ConversationController, :read)
350
351 get("/endorsements", AccountController, :endorsements)
352
353 patch("/accounts/update_credentials", AccountController, :update_credentials)
354
355 post("/statuses", StatusController, :create)
356 delete("/statuses/:id", StatusController, :delete)
357
358 post("/statuses/:id/reblog", StatusController, :reblog)
359 post("/statuses/:id/unreblog", StatusController, :unreblog)
360 post("/statuses/:id/favourite", StatusController, :favourite)
361 post("/statuses/:id/unfavourite", StatusController, :unfavourite)
362 post("/statuses/:id/pin", StatusController, :pin)
363 post("/statuses/:id/unpin", StatusController, :unpin)
364 post("/statuses/:id/bookmark", StatusController, :bookmark)
365 post("/statuses/:id/unbookmark", StatusController, :unbookmark)
366 post("/statuses/:id/mute", StatusController, :mute_conversation)
367 post("/statuses/:id/unmute", StatusController, :unmute_conversation)
368
369 put("/scheduled_statuses/:id", ScheduledActivityController, :update)
370 delete("/scheduled_statuses/:id", ScheduledActivityController, :delete)
371
372 post("/polls/:id/votes", PollController, :vote)
373
374 post("/media", MediaController, :create)
375 put("/media/:id", MediaController, :update)
376
377 delete("/lists/:id", ListController, :delete)
378 post("/lists", ListController, :create)
379 put("/lists/:id", ListController, :update)
380
381 post("/lists/:id/accounts", ListController, :add_to_list)
382 delete("/lists/:id/accounts", ListController, :remove_from_list)
383
384 post("/filters", FilterController, :create)
385 get("/filters/:id", FilterController, :show)
386 put("/filters/:id", FilterController, :update)
387 delete("/filters/:id", FilterController, :delete)
388
389 post("/reports", ReportController, :create)
390
391 post("/follows", AccountController, :follows)
392 post("/accounts/:id/follow", AccountController, :follow)
393 post("/accounts/:id/unfollow", AccountController, :unfollow)
394 post("/accounts/:id/block", AccountController, :block)
395 post("/accounts/:id/unblock", AccountController, :unblock)
396 post("/accounts/:id/mute", AccountController, :mute)
397 post("/accounts/:id/unmute", AccountController, :unmute)
398
399 post("/follow_requests/:id/authorize", FollowRequestController, :authorize)
400 post("/follow_requests/:id/reject", FollowRequestController, :reject)
401
402 post("/domain_blocks", DomainBlockController, :create)
403 delete("/domain_blocks", DomainBlockController, :delete)
404
405 post("/push/subscription", SubscriptionController, :create)
406 get("/push/subscription", SubscriptionController, :get)
407 put("/push/subscription", SubscriptionController, :update)
408 delete("/push/subscription", SubscriptionController, :delete)
409
410 get("/markers", MarkerController, :index)
411 post("/markers", MarkerController, :upsert)
412 end
413
414 scope "/api/web", Pleroma.Web do
415 pipe_through(:authenticated_api)
416
417 put("/settings", MastoFEController, :put_settings)
418 end
419
420 scope "/api/v1", Pleroma.Web.MastodonAPI do
421 pipe_through(:api)
422
423 post("/accounts", AccountController, :create)
424 get("/accounts/search", SearchController, :account_search)
425
426 get("/instance", InstanceController, :show)
427 get("/instance/peers", InstanceController, :peers)
428
429 post("/apps", AppController, :create)
430 get("/apps/verify_credentials", AppController, :verify_credentials)
431
432 get("/statuses/:id/card", StatusController, :card)
433 get("/statuses/:id/favourited_by", StatusController, :favourited_by)
434 get("/statuses/:id/reblogged_by", StatusController, :reblogged_by)
435
436 get("/custom_emojis", CustomEmojiController, :index)
437
438 get("/trends", MastodonAPIController, :empty_array)
439
440 get("/timelines/public", TimelineController, :public)
441 get("/timelines/tag/:tag", TimelineController, :hashtag)
442 get("/timelines/list/:list_id", TimelineController, :list)
443
444 get("/statuses", StatusController, :index)
445 get("/statuses/:id", StatusController, :show)
446 get("/statuses/:id/context", StatusController, :context)
447
448 get("/polls/:id", PollController, :show)
449
450 get("/accounts/:id/statuses", AccountController, :statuses)
451 get("/accounts/:id/followers", AccountController, :followers)
452 get("/accounts/:id/following", AccountController, :following)
453 get("/accounts/:id", AccountController, :show)
454
455 get("/search", SearchController, :search)
456 end
457
458 scope "/api/v2", Pleroma.Web.MastodonAPI do
459 pipe_through(:api)
460 get("/search", SearchController, :search2)
461 end
462
463 scope "/api", Pleroma.Web do
464 pipe_through(:config)
465
466 get("/help/test", TwitterAPI.UtilController, :help_test)
467 post("/help/test", TwitterAPI.UtilController, :help_test)
468 get("/statusnet/config", TwitterAPI.UtilController, :config)
469 get("/statusnet/version", TwitterAPI.UtilController, :version)
470 get("/pleroma/frontend_configurations", TwitterAPI.UtilController, :frontend_configurations)
471 end
472
473 scope "/api", Pleroma.Web do
474 pipe_through(:api)
475
476 get(
477 "/account/confirm_email/:user_id/:token",
478 TwitterAPI.Controller,
479 :confirm_email,
480 as: :confirm_email
481 )
482 end
483
484 scope "/api", Pleroma.Web, as: :authenticated_twitter_api do
485 pipe_through(:authenticated_api)
486
487 get("/oauth_tokens", TwitterAPI.Controller, :oauth_tokens)
488 delete("/oauth_tokens/:id", TwitterAPI.Controller, :revoke_token)
489
490 post("/qvitter/statuses/notifications/read", TwitterAPI.Controller, :notifications_read)
491 end
492
493 pipeline :ap_service_actor do
494 plug(:accepts, ["activity+json", "json"])
495 end
496
497 pipeline :ostatus do
498 plug(:accepts, ["html", "xml", "atom", "activity+json", "json"])
499 end
500
501 pipeline :oembed do
502 plug(:accepts, ["json", "xml"])
503 end
504
505 scope "/", Pleroma.Web do
506 pipe_through(:ostatus)
507 pipe_through(:http_signature)
508
509 get("/objects/:uuid", OStatus.OStatusController, :object)
510 get("/activities/:uuid", OStatus.OStatusController, :activity)
511 get("/notice/:id", OStatus.OStatusController, :notice)
512 get("/notice/:id/embed_player", OStatus.OStatusController, :notice_player)
513
514 get("/users/:nickname/feed", Feed.FeedController, :feed)
515 get("/users/:nickname", Feed.FeedController, :feed_redirect)
516
517 get("/mailer/unsubscribe/:token", Mailer.SubscriptionController, :unsubscribe)
518 end
519
520 pipeline :activitypub do
521 plug(:accepts, ["activity+json", "json"])
522 plug(Pleroma.Web.Plugs.HTTPSignaturePlug)
523 plug(Pleroma.Web.Plugs.MappedSignatureToIdentityPlug)
524 end
525
526 scope "/", Pleroma.Web.ActivityPub do
527 # XXX: not really ostatus
528 pipe_through(:ostatus)
529
530 get("/users/:nickname/outbox", ActivityPubController, :outbox)
531 end
532
533 pipeline :activitypub_client do
534 plug(:accepts, ["activity+json", "json"])
535 plug(:fetch_session)
536 plug(Pleroma.Plugs.OAuthPlug)
537 plug(Pleroma.Plugs.BasicAuthDecoderPlug)
538 plug(Pleroma.Plugs.UserFetcherPlug)
539 plug(Pleroma.Plugs.SessionAuthenticationPlug)
540 plug(Pleroma.Plugs.LegacyAuthenticationPlug)
541 plug(Pleroma.Plugs.AuthenticationPlug)
542 plug(Pleroma.Plugs.UserEnabledPlug)
543 plug(Pleroma.Plugs.SetUserSessionIdPlug)
544 plug(Pleroma.Plugs.EnsureUserKeyPlug)
545 end
546
547 scope "/", Pleroma.Web.ActivityPub do
548 pipe_through([:activitypub_client])
549
550 get("/api/ap/whoami", ActivityPubController, :whoami)
551 get("/users/:nickname/inbox", ActivityPubController, :read_inbox)
552
553 post("/users/:nickname/outbox", ActivityPubController, :update_outbox)
554 post("/api/ap/upload_media", ActivityPubController, :upload_media)
555
556 get("/users/:nickname/followers", ActivityPubController, :followers)
557 get("/users/:nickname/following", ActivityPubController, :following)
558 end
559
560 scope "/", Pleroma.Web.ActivityPub do
561 pipe_through(:activitypub)
562 post("/inbox", ActivityPubController, :inbox)
563 post("/users/:nickname/inbox", ActivityPubController, :inbox)
564 end
565
566 scope "/relay", Pleroma.Web.ActivityPub do
567 pipe_through(:ap_service_actor)
568
569 get("/", ActivityPubController, :relay)
570
571 scope [] do
572 pipe_through(:http_signature)
573 post("/inbox", ActivityPubController, :inbox)
574 end
575
576 get("/following", ActivityPubController, :following, assigns: %{relay: true})
577 get("/followers", ActivityPubController, :followers, assigns: %{relay: true})
578 end
579
580 scope "/internal/fetch", Pleroma.Web.ActivityPub do
581 pipe_through(:ap_service_actor)
582
583 get("/", ActivityPubController, :internal_fetch)
584 post("/inbox", ActivityPubController, :inbox)
585 end
586
587 scope "/.well-known", Pleroma.Web do
588 pipe_through(:well_known)
589
590 get("/host-meta", WebFinger.WebFingerController, :host_meta)
591 get("/webfinger", WebFinger.WebFingerController, :webfinger)
592 get("/nodeinfo", Nodeinfo.NodeinfoController, :schemas)
593 end
594
595 scope "/nodeinfo", Pleroma.Web do
596 get("/:version", Nodeinfo.NodeinfoController, :nodeinfo)
597 end
598
599 scope "/", Pleroma.Web do
600 pipe_through(:api)
601
602 get("/web/manifest.json", MastoFEController, :manifest)
603 end
604
605 scope "/", Pleroma.Web do
606 pipe_through(:mastodon_html)
607
608 get("/web/login", MastodonAPI.AuthController, :login)
609 delete("/auth/sign_out", MastodonAPI.AuthController, :logout)
610
611 post("/auth/password", MastodonAPI.AuthController, :password_reset)
612
613 get("/web/*path", MastoFEController, :index)
614 end
615
616 pipeline :remote_media do
617 end
618
619 scope "/proxy/", Pleroma.Web.MediaProxy do
620 pipe_through(:remote_media)
621
622 get("/:sig/:url", MediaProxyController, :remote)
623 get("/:sig/:url/:filename", MediaProxyController, :remote)
624 end
625
626 if Pleroma.Config.get(:env) == :dev do
627 scope "/dev" do
628 pipe_through([:mailbox_preview])
629
630 forward("/mailbox", Plug.Swoosh.MailboxPreview, base_path: "/dev/mailbox")
631 end
632 end
633
634 scope "/", Pleroma.Web.MongooseIM do
635 get("/user_exists", MongooseIMController, :user_exists)
636 get("/check_password", MongooseIMController, :check_password)
637 end
638
639 scope "/", Fallback do
640 get("/registration/:token", RedirectController, :registration_page)
641 get("/:maybe_nickname_or_id", RedirectController, :redirector_with_meta)
642 get("/api*path", RedirectController, :api_not_implemented)
643 get("/*path", RedirectController, :redirector)
644
645 options("/*path", RedirectController, :empty)
646 end
647 end