View Source Mobilizon.Federation.ActivityPub.Utils (Mobilizon v4.1.0-alpha.1)
Various ActivityPub related utils.
Summary
Functions
Adds an id and a published data if they aren't there, also adds it to an included object
Adds an id and published date if they aren't there.
Make accept join activity data
Make add activity data
Make announce activity data for the given actor and object
Make create activity data
Return AS Link data from
Make move activity data
Make unannounce activity data for the given actor and object
Make update activity data
Add the Date header to the request if we sign object fetches
Enqueues an activity for federation if it's local
Applies to activities sent by group members from outside this instance to a group of this instance,
we then need to relay (Announce
) the object to other members on other instances.
Checks that an incoming AP object's actor matches the domain it came from.
Converts PEM encoded keys to a public key representation
Sign a request with an actor.
Functions
@spec create_activity(map(), boolean()) :: {:ok, Mobilizon.Federation.ActivityPub.Activity.t()}
Adds an id and a published data if they aren't there, also adds it to an included object
Adds an id and published date if they aren't there.
Make accept join activity data
Make add activity data
Make announce activity data for the given actor and object
Make create activity data
@spec make_date() :: String.t()
@spec make_json_ld_header() :: map()
Return AS Link data from
- a
Plug.Upload
struct, stored an returned - a
Media
, directly returned - a map containing media information, stored, saved and returned
Save media data from %Plug.Upload{} and return AS Link data.
Make move activity data
Make unannounce activity data for the given actor and object
@spec make_unfollow_data( Mobilizon.Actors.Actor.t(), Mobilizon.Actors.Actor.t(), map(), String.t() ) :: map()
Make update activity data
Add the Date header to the request if we sign object fetches
@spec maybe_federate(activity :: Mobilizon.Federation.ActivityPub.Activity.t()) :: :ok
Enqueues an activity for federation if it's local
@spec maybe_relay_if_group_activity( Mobilizon.Federation.ActivityPub.Activity.t(), Mobilizon.Actors.Actor.t() | nil | [Mobilizon.Actors.Actor.t()] ) :: :ok
Applies to activities sent by group members from outside this instance to a group of this instance,
we then need to relay (Announce
) the object to other members on other instances.
Checks that an incoming AP object's actor matches the domain it came from.
Takes the actor or attributedTo attributes (considers only the first elem if they're an array)
Converts PEM encoded keys to a public key representation
@spec recipient_in_message( Mobilizon.Actors.Actor.t(), Mobilizon.Actors.Actor.t(), map() ) :: boolean()
@spec remote_actors([String.t()]) :: [Mobilizon.Actors.Actor.t()]
@spec sign_fetch( Enum.t(), Mobilizon.Actors.Actor.t(), String.t(), String.t(), Keyword.t() ) :: Enum.t()
Sign a request with an actor.