593da01fd555666fa28d0c7aaa1925ba4cd57a47
[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 end
114
115 scope "/api/pleroma", Pleroma.Web.TwitterAPI do
116 pipe_through(:pleroma_api)
117
118 get("/password_reset/:token", PasswordController, :reset, as: :reset_password)
119 post("/password_reset", PasswordController, :do_reset, as: :reset_password)
120 get("/emoji", UtilController, :emoji)
121 get("/captcha", UtilController, :captcha)
122 get("/healthcheck", UtilController, :healthcheck)
123 end
124
125 scope "/api/pleroma", Pleroma.Web do
126 pipe_through(:pleroma_api)
127 post("/uploader_callback/:upload_path", UploaderController, :callback)
128 end
129
130 scope "/api/pleroma/admin", Pleroma.Web.AdminAPI do
131 pipe_through(:admin_api)
132
133 get("/reports", AdminAPIController, :list_reports)
134 get("/reports/:id", AdminAPIController, :report_show)
135 put("/reports/:id", AdminAPIController, :report_update_state)
136 post("/reports/:id/respond", AdminAPIController, :report_respond)
137
138 post("/users/follow", AdminAPIController, :user_follow)
139 post("/users/unfollow", AdminAPIController, :user_unfollow)
140
141 delete("/users", AdminAPIController, :user_delete)
142 post("/users", AdminAPIController, :users_create)
143 patch("/users/:nickname/toggle_activation", AdminAPIController, :user_toggle_activation)
144 put("/users/tag", AdminAPIController, :tag_users)
145 delete("/users/tag", AdminAPIController, :untag_users)
146
147 get("/users/:nickname/permission_group", AdminAPIController, :right_get)
148 get("/users/:nickname/permission_group/:permission_group", AdminAPIController, :right_get)
149 post("/users/:nickname/permission_group/:permission_group", AdminAPIController, :right_add)
150
151 delete(
152 "/users/:nickname/permission_group/:permission_group",
153 AdminAPIController,
154 :right_delete
155 )
156
157 put("/users/:nickname/activation_status", AdminAPIController, :set_activation_status)
158
159 post("/relay", AdminAPIController, :relay_follow)
160 delete("/relay", AdminAPIController, :relay_unfollow)
161
162 get("/users/invite_token", AdminAPIController, :get_invite_token)
163 get("/users/invites", AdminAPIController, :invites)
164 post("/users/revoke_invite", AdminAPIController, :revoke_invite)
165 post("/users/email_invite", AdminAPIController, :email_invite)
166
167 get("/users/:nickname/password_reset", AdminAPIController, :get_password_reset)
168
169 get("/users", AdminAPIController, :list_users)
170 get("/users/:nickname", AdminAPIController, :user_show)
171
172 get("/config", AdminAPIController, :config_show)
173 post("/config", AdminAPIController, :config_update)
174 get("/config/migrate_to_db", AdminAPIController, :migrate_to_db)
175 get("/config/migrate_from_db", AdminAPIController, :migrate_from_db)
176
177 get("/moderation_log", AdminAPIController, :list_log)
178
179 get("/users/:nickname/statuses", AdminAPIController, :list_user_statuses)
180 put("/statuses/:id", AdminAPIController, :status_update)
181 delete("/statuses/:id", AdminAPIController, :status_delete)
182 end
183
184 scope "/", Pleroma.Web.TwitterAPI do
185 pipe_through(:pleroma_html)
186
187 post("/main/ostatus", UtilController, :remote_subscribe)
188 get("/ostatus_subscribe", UtilController, :remote_follow)
189 post("/ostatus_subscribe", UtilController, :do_remote_follow)
190 end
191
192 scope "/api/pleroma", Pleroma.Web.TwitterAPI do
193 pipe_through(:authenticated_api)
194
195 post("/change_password", UtilController, :change_password)
196 post("/delete_account", UtilController, :delete_account)
197 put("/notification_settings", UtilController, :update_notificaton_settings)
198 post("/disable_account", UtilController, :disable_account)
199
200 post("/blocks_import", UtilController, :blocks_import)
201 post("/follow_import", UtilController, :follow_import)
202 end
203
204 scope "/oauth", Pleroma.Web.OAuth do
205 scope [] do
206 pipe_through(:oauth)
207 get("/authorize", OAuthController, :authorize)
208 end
209
210 post("/authorize", OAuthController, :create_authorization)
211 post("/token", OAuthController, :token_exchange)
212 post("/revoke", OAuthController, :token_revoke)
213 get("/registration_details", OAuthController, :registration_details)
214
215 scope [] do
216 pipe_through(:browser)
217
218 get("/prepare_request", OAuthController, :prepare_request)
219 get("/:provider", OAuthController, :request)
220 get("/:provider/callback", OAuthController, :callback)
221 post("/register", OAuthController, :register)
222 end
223 end
224
225 scope "/api/v1/pleroma", Pleroma.Web.PleromaAPI do
226 pipe_through(:authenticated_api)
227
228 get("/conversations/:id/statuses", PleromaAPIController, :conversation_statuses)
229 get("/conversations/:id", PleromaAPIController, :conversation)
230 patch("/conversations/:id", PleromaAPIController, :update_conversation)
231 post("/notifications/read", PleromaAPIController, :read_notification)
232 end
233
234 scope "/api/v1", Pleroma.Web.MastodonAPI do
235 pipe_through(:authenticated_api)
236
237 get("/blocks", MastodonAPIController, :blocks)
238 get("/mutes", MastodonAPIController, :mutes)
239 get("/domain_blocks", MastodonAPIController, :domain_blocks)
240
241 get("/accounts/:id/lists", MastodonAPIController, :account_lists)
242 get("/lists", ListController, :index)
243 get("/lists/:id", ListController, :show)
244 get("/lists/:id/accounts", ListController, :list_accounts)
245
246 post("/notifications/clear", MastodonAPIController, :clear_notifications)
247 post("/notifications/dismiss", MastodonAPIController, :dismiss_notification)
248 get("/notifications", MastodonAPIController, :notifications)
249 get("/notifications/:id", MastodonAPIController, :get_notification)
250
251 delete(
252 "/notifications/destroy_multiple",
253 MastodonAPIController,
254 :destroy_multiple_notifications
255 )
256
257 # Note: not present in Mastodon
258 get("/bookmarks", MastodonAPIController, :bookmarks)
259
260 get("/accounts/:id/identity_proofs", MastodonAPIController, :empty_array)
261
262 get("/favourites", MastodonAPIController, :favourites)
263
264 get("/accounts/relationships", MastodonAPIController, :relationships)
265
266 get("/accounts/verify_credentials", MastodonAPIController, :verify_credentials)
267
268 get("/timelines/home", MastodonAPIController, :home_timeline)
269 get("/timelines/direct", MastodonAPIController, :dm_timeline)
270
271 get("/suggestions", MastodonAPIController, :suggestions)
272 get("/scheduled_statuses", MastodonAPIController, :scheduled_statuses)
273 get("/scheduled_statuses/:id", MastodonAPIController, :show_scheduled_status)
274 get("/follow_requests", MastodonAPIController, :follow_requests)
275 get("/filters", MastodonAPIController, :get_filters)
276 get("/endorsements", MastodonAPIController, :endorsements)
277 get("/conversations", MastodonAPIController, :conversations)
278 post("/conversations/:id/read", MastodonAPIController, :conversation_read)
279
280 delete("/lists/:id", ListController, :delete)
281 post("/lists", ListController, :create)
282 put("/lists/:id", ListController, :update)
283
284 post("/lists/:id/accounts", ListController, :add_to_list)
285 delete("/lists/:id/accounts", ListController, :remove_from_list)
286
287 post("/reports", MastodonAPIController, :create_report)
288
289 patch("/pleroma/accounts/update_avatar", MastodonAPIController, :update_avatar)
290 patch("/pleroma/accounts/update_banner", MastodonAPIController, :update_banner)
291 patch("/pleroma/accounts/update_background", MastodonAPIController, :update_background)
292
293 get("/pleroma/mascot", MastodonAPIController, :get_mascot)
294 put("/pleroma/mascot", MastodonAPIController, :set_mascot)
295
296 post("/media", MastodonAPIController, :upload)
297 put("/media/:id", MastodonAPIController, :update_media)
298
299 patch("/accounts/update_credentials", MastodonAPIController, :update_credentials)
300
301 post("/polls/:id/votes", MastodonAPIController, :poll_vote)
302
303 post("/statuses/:id/reblog", MastodonAPIController, :reblog_status)
304 post("/statuses/:id/unreblog", MastodonAPIController, :unreblog_status)
305
306 post("/statuses/:id/pin", MastodonAPIController, :pin_status)
307 post("/statuses/:id/unpin", MastodonAPIController, :unpin_status)
308
309 post("/statuses/:id/mute", MastodonAPIController, :mute_conversation)
310 post("/statuses/:id/unmute", MastodonAPIController, :unmute_conversation)
311
312 post("/statuses/:id/favourite", MastodonAPIController, :fav_status)
313 post("/statuses/:id/unfavourite", MastodonAPIController, :unfav_status)
314
315 post("/statuses", MastodonAPIController, :post_status)
316 delete("/statuses/:id", MastodonAPIController, :delete_status)
317
318 put("/scheduled_statuses/:id", MastodonAPIController, :update_scheduled_status)
319 delete("/scheduled_statuses/:id", MastodonAPIController, :delete_scheduled_status)
320
321 post("/filters", MastodonAPIController, :create_filter)
322 get("/filters/:id", MastodonAPIController, :get_filter)
323 put("/filters/:id", MastodonAPIController, :update_filter)
324 delete("/filters/:id", MastodonAPIController, :delete_filter)
325
326 post("/follows", MastodonAPIController, :follow)
327 post("/accounts/:id/follow", MastodonAPIController, :follow)
328
329 post("/accounts/:id/unfollow", MastodonAPIController, :unfollow)
330 post("/accounts/:id/block", MastodonAPIController, :block)
331 post("/accounts/:id/unblock", MastodonAPIController, :unblock)
332 post("/accounts/:id/mute", MastodonAPIController, :mute)
333 post("/accounts/:id/unmute", MastodonAPIController, :unmute)
334
335 post("/follow_requests/:id/authorize", MastodonAPIController, :authorize_follow_request)
336 post("/follow_requests/:id/reject", MastodonAPIController, :reject_follow_request)
337
338 post("/domain_blocks", MastodonAPIController, :block_domain)
339 delete("/domain_blocks", MastodonAPIController, :unblock_domain)
340
341 post("/pleroma/accounts/:id/subscribe", MastodonAPIController, :subscribe)
342 post("/pleroma/accounts/:id/unsubscribe", MastodonAPIController, :unsubscribe)
343
344 post("/push/subscription", SubscriptionController, :create)
345 get("/push/subscription", SubscriptionController, :get)
346 put("/push/subscription", SubscriptionController, :update)
347 delete("/push/subscription", SubscriptionController, :delete)
348
349 # Note: not present in Mastodon: bookmark, unbookmark
350 post("/statuses/:id/bookmark", MastodonAPIController, :bookmark_status)
351 post("/statuses/:id/unbookmark", MastodonAPIController, :unbookmark_status)
352 end
353
354 scope "/api/web", Pleroma.Web.MastodonAPI do
355 pipe_through(:authenticated_api)
356
357 put("/settings", MastodonAPIController, :put_settings)
358 end
359
360 scope "/api/v1", Pleroma.Web.MastodonAPI do
361 pipe_through(:api)
362
363 post("/accounts", MastodonAPIController, :account_register)
364
365 get("/instance", MastodonAPIController, :masto_instance)
366 get("/instance/peers", MastodonAPIController, :peers)
367 post("/apps", MastodonAPIController, :create_app)
368 get("/apps/verify_credentials", MastodonAPIController, :verify_app_credentials)
369 get("/custom_emojis", MastodonAPIController, :custom_emojis)
370
371 get("/statuses/:id/card", MastodonAPIController, :status_card)
372
373 get("/statuses/:id/favourited_by", MastodonAPIController, :favourited_by)
374 get("/statuses/:id/reblogged_by", MastodonAPIController, :reblogged_by)
375
376 get("/trends", MastodonAPIController, :empty_array)
377
378 get("/accounts/search", SearchController, :account_search)
379
380 post(
381 "/pleroma/accounts/confirmation_resend",
382 MastodonAPIController,
383 :account_confirmation_resend
384 )
385
386 get("/timelines/public", MastodonAPIController, :public_timeline)
387 get("/timelines/tag/:tag", MastodonAPIController, :hashtag_timeline)
388
389 get("/pleroma/accounts/:id/favourites", MastodonAPIController, :user_favourites)
390
391 get("/search", SearchController, :search)
392
393 get("/polls/:id", MastodonAPIController, :get_poll)
394
395 get("/accounts/:id/followers", MastodonAPIController, :followers)
396 get("/accounts/:id/following", MastodonAPIController, :following)
397
398 get("/timelines/list/:list_id", MastodonAPIController, :list_timeline)
399
400 get("/accounts/:id", MastodonAPIController, :user)
401
402 get("/accounts/:id/statuses", MastodonAPIController, :user_statuses)
403 get("/statuses/:id", MastodonAPIController, :get_status)
404 get("/statuses/:id/context", MastodonAPIController, :get_context)
405 end
406
407 scope "/api/v2", Pleroma.Web.MastodonAPI do
408 pipe_through(:api)
409 get("/search", SearchController, :search2)
410 end
411
412 scope "/api", Pleroma.Web do
413 pipe_through(:config)
414
415 get("/help/test", TwitterAPI.UtilController, :help_test)
416 post("/help/test", TwitterAPI.UtilController, :help_test)
417 get("/statusnet/config", TwitterAPI.UtilController, :config)
418 get("/statusnet/version", TwitterAPI.UtilController, :version)
419 get("/pleroma/frontend_configurations", TwitterAPI.UtilController, :frontend_configurations)
420 end
421
422 scope "/api", Pleroma.Web do
423 pipe_through(:api)
424
425 get(
426 "/account/confirm_email/:user_id/:token",
427 TwitterAPI.Controller,
428 :confirm_email,
429 as: :confirm_email
430 )
431 end
432
433 scope "/api", Pleroma.Web, as: :authenticated_twitter_api do
434 pipe_through(:authenticated_api)
435
436 get("/oauth_tokens", TwitterAPI.Controller, :oauth_tokens)
437 delete("/oauth_tokens/:id", TwitterAPI.Controller, :revoke_token)
438 post("/qvitter/statuses/notifications/read", TwitterAPI.Controller, :notifications_read)
439 end
440
441 pipeline :ap_service_actor do
442 plug(:accepts, ["activity+json", "json"])
443 end
444
445 pipeline :ostatus do
446 plug(:accepts, ["html", "xml", "atom", "activity+json", "json"])
447 end
448
449 pipeline :oembed do
450 plug(:accepts, ["json", "xml"])
451 end
452
453 scope "/", Pleroma.Web do
454 pipe_through(:ostatus)
455
456 get("/objects/:uuid", OStatus.OStatusController, :object)
457 get("/activities/:uuid", OStatus.OStatusController, :activity)
458 get("/notice/:id", OStatus.OStatusController, :notice)
459 get("/notice/:id/embed_player", OStatus.OStatusController, :notice_player)
460 get("/users/:nickname/feed", OStatus.OStatusController, :feed)
461 get("/users/:nickname", OStatus.OStatusController, :feed_redirect)
462
463 post("/users/:nickname/salmon", OStatus.OStatusController, :salmon_incoming)
464 post("/push/hub/:nickname", Websub.WebsubController, :websub_subscription_request)
465 get("/push/subscriptions/:id", Websub.WebsubController, :websub_subscription_confirmation)
466 post("/push/subscriptions/:id", Websub.WebsubController, :websub_incoming)
467
468 get("/mailer/unsubscribe/:token", Mailer.SubscriptionController, :unsubscribe)
469 end
470
471 pipeline :activitypub do
472 plug(:accepts, ["activity+json", "json"])
473 plug(Pleroma.Web.Plugs.HTTPSignaturePlug)
474 plug(Pleroma.Web.Plugs.MappedSignatureToIdentityPlug)
475 end
476
477 scope "/", Pleroma.Web.ActivityPub do
478 # XXX: not really ostatus
479 pipe_through(:ostatus)
480
481 get("/users/:nickname/outbox", ActivityPubController, :outbox)
482 get("/objects/:uuid/likes", ActivityPubController, :object_likes)
483 end
484
485 pipeline :activitypub_client do
486 plug(:accepts, ["activity+json", "json"])
487 plug(:fetch_session)
488 plug(Pleroma.Plugs.OAuthPlug)
489 plug(Pleroma.Plugs.BasicAuthDecoderPlug)
490 plug(Pleroma.Plugs.UserFetcherPlug)
491 plug(Pleroma.Plugs.SessionAuthenticationPlug)
492 plug(Pleroma.Plugs.LegacyAuthenticationPlug)
493 plug(Pleroma.Plugs.AuthenticationPlug)
494 plug(Pleroma.Plugs.UserEnabledPlug)
495 plug(Pleroma.Plugs.SetUserSessionIdPlug)
496 plug(Pleroma.Plugs.EnsureUserKeyPlug)
497 end
498
499 scope "/", Pleroma.Web.ActivityPub do
500 pipe_through([:activitypub_client])
501
502 get("/api/ap/whoami", ActivityPubController, :whoami)
503 get("/users/:nickname/inbox", ActivityPubController, :read_inbox)
504 post("/users/:nickname/outbox", ActivityPubController, :update_outbox)
505 get("/users/:nickname/followers", ActivityPubController, :followers)
506 get("/users/:nickname/following", ActivityPubController, :following)
507 end
508
509 scope "/", Pleroma.Web.ActivityPub do
510 pipe_through(:activitypub)
511
512 post("/inbox", ActivityPubController, :inbox)
513 post("/users/:nickname/inbox", ActivityPubController, :inbox)
514 end
515
516 scope "/relay", Pleroma.Web.ActivityPub do
517 pipe_through(:ap_service_actor)
518
519 get("/", ActivityPubController, :relay)
520
521 scope [] do
522 pipe_through(:http_signature)
523 post("/inbox", ActivityPubController, :inbox)
524 end
525
526 get("/following", ActivityPubController, :following, assigns: %{relay: true})
527 get("/followers", ActivityPubController, :followers, assigns: %{relay: true})
528 end
529
530 scope "/internal/fetch", Pleroma.Web.ActivityPub do
531 pipe_through(:ap_service_actor)
532
533 get("/", ActivityPubController, :internal_fetch)
534 post("/inbox", ActivityPubController, :inbox)
535 end
536
537 scope "/.well-known", Pleroma.Web do
538 pipe_through(:well_known)
539
540 get("/host-meta", WebFinger.WebFingerController, :host_meta)
541 get("/webfinger", WebFinger.WebFingerController, :webfinger)
542 get("/nodeinfo", Nodeinfo.NodeinfoController, :schemas)
543 end
544
545 scope "/nodeinfo", Pleroma.Web do
546 get("/:version", Nodeinfo.NodeinfoController, :nodeinfo)
547 end
548
549 scope "/", Pleroma.Web.MastodonAPI do
550 pipe_through(:mastodon_html)
551
552 get("/web/login", MastodonAPIController, :login)
553 delete("/auth/sign_out", MastodonAPIController, :logout)
554
555 post("/auth/password", MastodonAPIController, :password_reset)
556
557 get("/web/*path", MastodonAPIController, :index)
558 end
559
560 pipeline :remote_media do
561 end
562
563 scope "/proxy/", Pleroma.Web.MediaProxy do
564 pipe_through(:remote_media)
565
566 get("/:sig/:url", MediaProxyController, :remote)
567 get("/:sig/:url/:filename", MediaProxyController, :remote)
568 end
569
570 if Pleroma.Config.get(:env) == :dev do
571 scope "/dev" do
572 pipe_through([:mailbox_preview])
573
574 forward("/mailbox", Plug.Swoosh.MailboxPreview, base_path: "/dev/mailbox")
575 end
576 end
577
578 scope "/", Pleroma.Web.MongooseIM do
579 get("/user_exists", MongooseIMController, :user_exists)
580 get("/check_password", MongooseIMController, :check_password)
581 end
582
583 scope "/", Fallback do
584 get("/registration/:token", RedirectController, :registration_page)
585 get("/:maybe_nickname_or_id", RedirectController, :redirector_with_meta)
586 get("/api*path", RedirectController, :api_not_implemented)
587 get("/*path", RedirectController, :redirector)
588
589 options("/*path", RedirectController, :empty)
590 end
591 end