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