1 defmodule Pleroma.Web.Pipelines do
4 pipeline :accepts_html do
5 plug(:accepts, ["html"])
8 pipeline :accepts_html_xml do
9 plug(:accepts, ["html", "xml", "rss", "atom"])
12 pipeline :accepts_html_json do
13 plug(:accepts, ["html", "activity+json", "json"])
16 pipeline :accepts_html_xml_json do
17 plug(:accepts, ["html", "xml", "rss", "atom", "activity+json", "json"])
20 pipeline :accepts_xml_rss_atom do
21 plug(:accepts, ["xml", "rss", "atom"])
25 plug(:accepts, ["html"])
31 plug(Pleroma.Web.Plugs.OAuthPlug)
32 plug(Pleroma.Web.Plugs.UserEnabledPlug)
33 plug(Pleroma.Web.Plugs.EnsureUserTokenAssignsPlug)
36 # Note: expects _user_ authentication (user-unbound app-bound tokens don't qualify)
37 pipeline :expect_user_authentication do
38 plug(Pleroma.Web.Plugs.ExpectAuthenticatedCheckPlug)
41 # Note: expects public instance or _user_ authentication (user-unbound tok ens don't qualify)
42 pipeline :expect_public_instance_or_user_authentication do
43 plug(Pleroma.Web.Plugs.ExpectPublicOrAuthenticatedCheckPlug)
46 pipeline :authenticate do
47 plug(Pleroma.Web.Plugs.OAuthPlug)
48 plug(Pleroma.Web.Plugs.BasicAuthDecoderPlug)
49 plug(Pleroma.Web.Plugs.UserFetcherPlug)
50 plug(Pleroma.Web.Plugs.AuthenticationPlug)
53 pipeline :after_auth do
54 plug(Pleroma.Web.Plugs.UserEnabledPlug)
55 plug(Pleroma.Web.Plugs.SetUserSessionIdPlug)
56 plug(Pleroma.Web.Plugs.EnsureUserTokenAssignsPlug)
57 plug(Pleroma.Web.Plugs.UserTrackingPlug)
61 plug(:accepts, ["json"])
64 plug(OpenApiSpex.Plug.PutApiSpec, module: Pleroma.Web.ApiSpec)
67 pipeline :no_auth_or_privacy_expectations_api do
70 plug(Pleroma.Web.Plugs.IdempotencyPlug)
73 # Pipeline for app-related endpoints (no user auth checks — app-bound toke ns must be supported)
75 plug(:no_auth_or_privacy_expectations_api)
79 plug(:expect_public_instance_or_user_authentication)
80 plug(:no_auth_or_privacy_expectations_api)
83 pipeline :authenticated_api do
84 plug(:expect_user_authentication)
85 plug(:no_auth_or_privacy_expectations_api)
86 plug(Pleroma.Web.Plugs.EnsureAuthenticatedPlug)
89 pipeline :admin_api do
90 plug(:expect_user_authentication)
92 plug(Pleroma.Web.Plugs.AdminSecretAuthenticationPlug)
94 plug(Pleroma.Web.Plugs.EnsureAuthenticatedPlug)
95 plug(Pleroma.Web.Plugs.UserIsStaffPlug)
96 plug(Pleroma.Web.Plugs.IdempotencyPlug)
99 pipeline :require_privileged_staff do
100 plug(Pleroma.Web.Plugs.EnsureStaffPrivilegedPlug)
103 pipeline :require_admin do
104 plug(Pleroma.Web.Plugs.UserIsAdminPlug)
107 pipeline :pleroma_html do
110 plug(Pleroma.Web.Plugs.EnsureUserTokenAssignsPlug)
113 pipeline :well_known do
114 plug(:accepts, ["json", "jrd+json", "xml", "xrd+xml"])
118 plug(:accepts, ["json", "xml"])
119 plug(OpenApiSpex.Plug.PutApiSpec, module: Pleroma.Web.ApiSpec)
122 pipeline :pleroma_api do
123 plug(:accepts, ["html", "json"])
124 plug(OpenApiSpex.Plug.PutApiSpec, module: Pleroma.Web.ApiSpec)
127 pipeline :mailbox_preview do
128 plug(:accepts, ["html"])
130 plug(:put_secure_browser_headers, %{
131 "content-security-policy" =>
132 "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline' 'unsafe-eval'"
136 pipeline :http_signature do
137 plug(Pleroma.Web.Plugs.HTTPSignaturePlug)
138 plug(Pleroma.Web.Plugs.MappedSignatureToIdentityPlug)
141 pipeline :static_fe do
142 plug(Pleroma.Web.Plugs.StaticFEPlug)
147 defmacro __using__(which) when is_atom(which) do
148 apply(__MODULE__, which, [])