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