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