mirror of https://gitlab.com/bashrc2/epicyon
Attribution domains
parent
8be5878dba
commit
27cca72d76
13
person.py
13
person.py
|
|
@ -229,6 +229,10 @@ def get_actor_update_json(actor_json: {}) -> {}:
|
||||||
actor_url = get_url_from_post(actor_json['url'])
|
actor_url = get_url_from_post(actor_json['url'])
|
||||||
icon_url = get_url_from_post(actor_json['icon']['url'])
|
icon_url = get_url_from_post(actor_json['icon']['url'])
|
||||||
image_url = get_url_from_post(actor_json['image']['url'])
|
image_url = get_url_from_post(actor_json['image']['url'])
|
||||||
|
attribution_domains: list[str] = []
|
||||||
|
if actor_json.get('attributionDomains'):
|
||||||
|
if isinstance(actor_json['attributionDomains'], list):
|
||||||
|
attribution_domains = actor_json['attributionDomains']
|
||||||
return {
|
return {
|
||||||
'@context': [
|
'@context': [
|
||||||
"https://www.w3.org/ns/activitystreams",
|
"https://www.w3.org/ns/activitystreams",
|
||||||
|
|
@ -322,6 +326,7 @@ def get_actor_update_json(actor_json: {}) -> {}:
|
||||||
'url': image_url
|
'url': image_url
|
||||||
},
|
},
|
||||||
'attachment': actor_json['attachment'],
|
'attachment': actor_json['attachment'],
|
||||||
|
'attributionDomains': attribution_domains,
|
||||||
'following': actor_json['id'] + '/following',
|
'following': actor_json['id'] + '/following',
|
||||||
'followers': actor_json['id'] + '/followers',
|
'followers': actor_json['id'] + '/followers',
|
||||||
'inbox': actor_json['id'] + '/inbox',
|
'inbox': actor_json['id'] + '/inbox',
|
||||||
|
|
@ -464,6 +469,8 @@ def _create_person_base(base_dir: str, nickname: str, domain: str, port: int,
|
||||||
approve_followers = True
|
approve_followers = True
|
||||||
person_type = 'Application'
|
person_type = 'Application'
|
||||||
|
|
||||||
|
attribution_domains: list[str] = []
|
||||||
|
|
||||||
# NOTE: these image files don't need to have
|
# NOTE: these image files don't need to have
|
||||||
# cryptographically secure names
|
# cryptographically secure names
|
||||||
|
|
||||||
|
|
@ -485,6 +492,7 @@ def _create_person_base(base_dir: str, nickname: str, domain: str, port: int,
|
||||||
'published': published,
|
'published': published,
|
||||||
'alsoKnownAs': [],
|
'alsoKnownAs': [],
|
||||||
'attachment': [],
|
'attachment': [],
|
||||||
|
'attributionDomains': attribution_domains,
|
||||||
'devices': person_id + '/collections/devices',
|
'devices': person_id + '/collections/devices',
|
||||||
'endpoints': {
|
'endpoints': {
|
||||||
'id': person_id + '/endpoints',
|
'id': person_id + '/endpoints',
|
||||||
|
|
@ -570,6 +578,7 @@ def _create_person_base(base_dir: str, nickname: str, domain: str, port: int,
|
||||||
del new_person['followers']
|
del new_person['followers']
|
||||||
del new_person['following']
|
del new_person['following']
|
||||||
del new_person['attachment']
|
del new_person['attachment']
|
||||||
|
del new_person['attributionDomains']
|
||||||
|
|
||||||
if save_to_file:
|
if save_to_file:
|
||||||
# save person to file
|
# save person to file
|
||||||
|
|
@ -868,6 +877,10 @@ def person_upgrade_actor(base_dir: str, person_json: {},
|
||||||
person_json['moderators'] = person_id + '/moderators'
|
person_json['moderators'] = person_id + '/moderators'
|
||||||
update_actor = True
|
update_actor = True
|
||||||
|
|
||||||
|
if 'attributionDomains' not in person_json:
|
||||||
|
person_json['attributionDomains'] = []
|
||||||
|
update_actor = True
|
||||||
|
|
||||||
if 'capabilities' not in person_json:
|
if 'capabilities' not in person_json:
|
||||||
person_json['capabilities'] = {
|
person_json['capabilities'] = {
|
||||||
'acceptsChatMessages': False,
|
'acceptsChatMessages': False,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue