2020-02-18 04:12:19 +00:00
|
|
|
''' actor serializer '''
|
|
|
|
|
|
|
|
def get_actor(user):
|
|
|
|
''' activitypub actor from db User '''
|
|
|
|
return {
|
|
|
|
'@context': [
|
|
|
|
'https://www.w3.org/ns/activitystreams',
|
2020-03-13 23:15:07 +00:00
|
|
|
'https://w3id.org/security/v1',
|
|
|
|
{
|
|
|
|
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
|
|
|
|
"schema": "http://schema.org#",
|
|
|
|
"PropertyValue": "schema:PropertyValue",
|
|
|
|
"value": "schema:value",
|
|
|
|
},
|
2020-02-18 04:12:19 +00:00
|
|
|
],
|
|
|
|
|
|
|
|
'id': user.actor,
|
|
|
|
'type': 'Person',
|
|
|
|
'preferredUsername': user.localname,
|
|
|
|
'name': user.name,
|
|
|
|
'inbox': user.inbox,
|
2020-02-19 19:33:00 +00:00
|
|
|
'outbox': '%s/outbox' % user.actor,
|
2020-02-18 04:12:19 +00:00
|
|
|
'followers': '%s/followers' % user.actor,
|
|
|
|
'following': '%s/following' % user.actor,
|
|
|
|
'summary': user.summary,
|
|
|
|
'publicKey': {
|
|
|
|
'id': '%s/#main-key' % user.actor,
|
|
|
|
'owner': user.actor,
|
|
|
|
'publicKeyPem': user.public_key,
|
|
|
|
},
|
|
|
|
'endpoints': {
|
|
|
|
'sharedInbox': user.shared_inbox,
|
2020-02-19 19:33:00 +00:00
|
|
|
},
|
|
|
|
'fedireadsUser': True,
|
2020-03-13 23:15:07 +00:00
|
|
|
'manuallyApprovesFollowers': user.manually_approves_followers,
|
2020-02-18 04:12:19 +00:00
|
|
|
}
|
|
|
|
|