projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'restricted-relations-embedding' into 'develop'
[akkoma]
/
lib
/
pleroma
/
plugs
/
http_signature.ex
diff --git
a/lib/pleroma/plugs/http_signature.ex
b/lib/pleroma/plugs/http_signature.ex
index ecd7a55bf26898d3d4ec0eb4c287bd404d8fb6dd..036e2a7739e0ca16fb05412d15249fa6594c2ab3 100644
(file)
--- a/
lib/pleroma/plugs/http_signature.ex
+++ b/
lib/pleroma/plugs/http_signature.ex
@@
-1,9
+1,10
@@
# Pleroma: A lightweight social networking server
# Pleroma: A lightweight social networking server
-# Copyright © 2017-20
19
Pleroma Authors <https://pleroma.social/>
+# Copyright © 2017-20
20
Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.Plugs.HTTPSignaturePlug do
import Plug.Conn
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.Plugs.HTTPSignaturePlug do
import Plug.Conn
+ import Phoenix.Controller, only: [get_format: 1, text: 2]
require Logger
def init(options) do
require Logger
def init(options) do
@@
-15,9
+16,13
@@
defmodule Pleroma.Web.Plugs.HTTPSignaturePlug do
end
def call(conn, _opts) do
end
def call(conn, _opts) do
- conn
- |> maybe_assign_valid_signature()
- |> maybe_require_signature()
+ if get_format(conn) == "activity+json" do
+ conn
+ |> maybe_assign_valid_signature()
+ |> maybe_require_signature()
+ else
+ conn
+ end
end
defp maybe_assign_valid_signature(conn) do
end
defp maybe_assign_valid_signature(conn) do
@@
-51,7
+56,7
@@
defmodule Pleroma.Web.Plugs.HTTPSignaturePlug do
if Pleroma.Config.get([:activitypub, :authorized_fetch_mode], false) do
conn
|> put_status(:unauthorized)
if Pleroma.Config.get([:activitypub, :authorized_fetch_mode], false) do
conn
|> put_status(:unauthorized)
- |>
Phoenix.Controller.
text("Request not signed")
+ |> text("Request not signed")
|> halt()
else
conn
|> halt()
else
conn