aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/plugs
diff options
context:
space:
mode:
authorrinpatch <rinpatch@sdf.org>2019-12-14 15:01:09 +0000
committerrinpatch <rinpatch@sdf.org>2019-12-14 15:01:09 +0000
commitecb3386f939de3ffba16f9419994a009f2e59ded (patch)
treefebe52f1b2cf59be4530ebc4f223f06e342c207c /lib/pleroma/plugs
parent0ba3f1ffb28792c21809fa9a30fc03a7a52d9361 (diff)
parent3b407a9a295da3f6c2fc91982088f066f2c3c711 (diff)
downloadpleroma-1.1.7.tar.gz
Merge branch 'release/1.1.7' into 'stable'v1.1.7
Release/1.1.7 See merge request pleroma/pleroma!2065
Diffstat (limited to 'lib/pleroma/plugs')
-rw-r--r--lib/pleroma/plugs/parsers_plug.ex21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/pleroma/plugs/parsers_plug.ex b/lib/pleroma/plugs/parsers_plug.ex
new file mode 100644
index 000000000..2e493ce0e
--- /dev/null
+++ b/lib/pleroma/plugs/parsers_plug.ex
@@ -0,0 +1,21 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
+defmodule Pleroma.Plugs.Parsers do
+ @moduledoc "Initializes Plug.Parsers with upload limit set at boot time"
+
+ @behaviour Plug
+
+ def init(_opts) do
+ Plug.Parsers.init(
+ parsers: [:urlencoded, :multipart, :json],
+ pass: ["*/*"],
+ json_decoder: Jason,
+ length: Pleroma.Config.get([:instance, :upload_limit]),
+ body_reader: {Pleroma.Web.Plugs.DigestPlug, :read_body, []}
+ )
+ end
+
+ defdelegate call(conn, opts), to: Plug.Parsers
+end