.activity_pub
cattle_grid.activity_pub
get_async_api_schema()
Returns the async api schema for cattle_grid ActivityPub processing
get_fastapi_app()
Returns the fast api app for ActivityPub processing
get_mock_faststream_app()
Creates a mock faststream app for ActivityPub processing
Source code in cattle_grid/activity_pub/__init__.py
cattle_grid.activity_pub.activity
actor_deletes_themselves(activity)
Checks if activity is self delete of actor
>>> actor_deletes_themselves({"type": "Delete",
... "actor": "http://actor.test/",
... "object": "http://actor.test/"})
True
>>> actor_deletes_themselves({"type": "Delete",
... "actor": "http://actor.test/",
... "object": "http://other.test/"})
False
Source code in cattle_grid/activity_pub/activity.py
cattle_grid.activity_pub.actor
actor_to_object(actor)
Transform the actor to an object
Parameters:
Name | Type | Description | Default |
---|---|---|---|
actor
|
Actor
|
|
required |
Returns:
Type | Description |
---|---|
dict
|
|
Source code in cattle_grid/activity_pub/actor.py
bovine_actor_for_actor_id(actor_id)
async
Uses the information stored in Credential to construct a bovine actor
Parameters:
Name | Type | Description | Default |
---|---|---|---|
actor_id
|
str
|
|
required |
Returns:
Type | Description |
---|---|
BovineActor | None
|
|
Source code in cattle_grid/activity_pub/actor.py
compute_acct_uri(base_url, preferred_username)
Computes the acct uri
Source code in cattle_grid/activity_pub/actor.py
create_actor(base_url, preferred_username=None, identifiers={}, profile={})
async
Creates a new actor in the database
Source code in cattle_grid/activity_pub/actor.py
delete_actor(actor)
async
Deletes an actor
Parameters:
Name | Type | Description | Default |
---|---|---|---|
actor
|
Actor
|
Actor to be deleted |
required |
Source code in cattle_grid/activity_pub/actor.py
delete_for_actor_profile(actor)
Creates a delete activity for the Actor
Source code in cattle_grid/activity_pub/actor.py
determine_preferred_username(identifiers, actor_id)
Determine the preferred username from the sorted identifiers
Source code in cattle_grid/activity_pub/actor.py
followers_for_actor(actor)
async
following_for_actor(actor)
async
is_valid_requester(requester, actor, obj)
async
Checks if the requested is allowed to view the object
Source code in cattle_grid/activity_pub/actor.py
remove_from_followers_following(actor_id_to_remove)
async
Removes actor_id from all occurring followers and following
Source code in cattle_grid/activity_pub/actor.py
update_for_actor_profile(actor)
Creates an update for the Actor
Source code in cattle_grid/activity_pub/actor.py
update_recipients_for_actor(actor, recipients, self_delete=False)
async
Updates set of recipients by removing the followers and following collections, and replacing them with the actual sets.
The following collecting is only allowed for self delete activities.
Source code in cattle_grid/activity_pub/actor.py
cattle_grid.activity_pub.enqueuer
determine_activity_type(activity)
Determines the type of an activity
In the case of multiple types, these are concatenated. This means that they are probably missed by processing, but don’t get ignored.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
activity
|
dict
|
|
required |
Returns:
Type | Description |
---|---|
str | None
|
|
Source code in cattle_grid/activity_pub/enqueuer.py
enqueue_from_inbox(broker, exchange, receiving_actor_id, content)
async
Enqueues a new message arrived from the inbox
The routing key will be incoming.${activity_type}