2e493ce0e87d02ca580295b5ebfa41e2eecd4a64
[akkoma] / lib / pleroma / plugs / parsers_plug.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.Plugs.Parsers do
6 @moduledoc "Initializes Plug.Parsers with upload limit set at boot time"
7
8 @behaviour Plug
9
10 def init(_opts) do
11 Plug.Parsers.init(
12 parsers: [:urlencoded, :multipart, :json],
13 pass: ["*/*"],
14 json_decoder: Jason,
15 length: Pleroma.Config.get([:instance, :upload_limit]),
16 body_reader: {Pleroma.Web.Plugs.DigestPlug, :read_body, []}
17 )
18 end
19
20 defdelegate call(conn, opts), to: Plug.Parsers
21 end