projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
activitypub: represent relay actor at instance root
[akkoma]
/
lib
/
pleroma
/
web
/
activity_pub
/
activity_pub.ex
diff --git
a/lib/pleroma/web/activity_pub/activity_pub.ex
b/lib/pleroma/web/activity_pub/activity_pub.ex
index 93219d76ab6e0cce29f93cefd2c25ebfcc658a15..ec605b694f49557b0f7dcfb472618ae98d324439 100644
(file)
--- a/
lib/pleroma/web/activity_pub/activity_pub.ex
+++ b/
lib/pleroma/web/activity_pub/activity_pub.ex
@@
-30,7
+30,7
@@
defmodule Pleroma.Web.ActivityPub.ActivityPub do
end
def insert(map, local \\ true) when is_map(map) do
end
def insert(map, local \\ true) when is_map(map) do
- with nil <- Activity.
get_by_ap_id(map["id"]
),
+ with nil <- Activity.
normalize(map
),
map <- lazy_put_activity_defaults(map),
:ok <- check_actor_is_active(map["actor"]),
{:ok, map} <- MRF.filter(map),
map <- lazy_put_activity_defaults(map),
:ok <- check_actor_is_active(map["actor"]),
{:ok, map} <- MRF.filter(map),
@@
-641,13
+641,23
@@
defmodule Pleroma.Web.ActivityPub.ActivityPub do
Logger.info("Federating #{id} to #{inbox}")
host = URI.parse(inbox).host
Logger.info("Federating #{id} to #{inbox}")
host = URI.parse(inbox).host
+ digest = "SHA-256=" <> (:crypto.hash(:sha256, json) |> Base.encode64())
+
signature =
signature =
- Pleroma.Web.HTTPSignatures.sign(actor, %{host: host, "content-length": byte_size(json)})
+ Pleroma.Web.HTTPSignatures.sign(actor, %{
+ host: host,
+ "content-length": byte_size(json),
+ digest: digest
+ })
@httpoison.post(
inbox,
json,
@httpoison.post(
inbox,
json,
- [{"Content-Type", "application/activity+json"}, {"signature", signature}],
+ [
+ {"Content-Type", "application/activity+json"},
+ {"signature", signature},
+ {"digest", digest}
+ ],
hackney: [pool: :default]
)
end
hackney: [pool: :default]
)
end