mirror of https://gitlab.com/bashrc2/epicyon
Add extra fields to Person
parent
a289db1799
commit
8c4de821e4
|
|
@ -54,6 +54,7 @@ from src.utils import acct_handle_dir
|
||||||
from src.utils import safe_system_string
|
from src.utils import safe_system_string
|
||||||
from src.utils import get_attachment_property_value
|
from src.utils import get_attachment_property_value
|
||||||
from src.utils import get_nickname_from_actor
|
from src.utils import get_nickname_from_actor
|
||||||
|
from src.utils import get_domain_from_actor
|
||||||
from src.utils import remove_html
|
from src.utils import remove_html
|
||||||
from src.utils import contains_invalid_chars
|
from src.utils import contains_invalid_chars
|
||||||
from src.utils import contains_invalid_actor_url_chars
|
from src.utils import contains_invalid_actor_url_chars
|
||||||
|
|
@ -510,6 +511,7 @@ def _create_person_base(base_dir: str, nickname: str, domain: str, port: int,
|
||||||
person_id + '/avatar' + \
|
person_id + '/avatar' + \
|
||||||
str(randint(10000000000000, 99999999999999)) + '.png' # nosec
|
str(randint(10000000000000, 99999999999999)) + '.png' # nosec
|
||||||
|
|
||||||
|
full_domain = get_full_domain(domain, port)
|
||||||
_, published = get_status_number()
|
_, published = get_status_number()
|
||||||
new_person = {
|
new_person = {
|
||||||
'@context': [
|
'@context': [
|
||||||
|
|
@ -531,6 +533,7 @@ def _create_person_base(base_dir: str, nickname: str, domain: str, port: int,
|
||||||
'pendingFollowers': person_id + '/pendingFollowers'
|
'pendingFollowers': person_id + '/pendingFollowers'
|
||||||
},
|
},
|
||||||
'featured': person_id + '/collections/featured',
|
'featured': person_id + '/collections/featured',
|
||||||
|
'featuredCollections': person_id + '/featured_collections',
|
||||||
'featuredTags': person_id + '/collections/tags',
|
'featuredTags': person_id + '/collections/tags',
|
||||||
'followers': person_id + '/followers',
|
'followers': person_id + '/followers',
|
||||||
'following': person_id + '/following',
|
'following': person_id + '/following',
|
||||||
|
|
@ -582,8 +585,12 @@ def _create_person_base(base_dir: str, nickname: str, domain: str, port: int,
|
||||||
'tag': [],
|
'tag': [],
|
||||||
'type': person_type,
|
'type': person_type,
|
||||||
'url': person_url,
|
'url': person_url,
|
||||||
|
'webfinger': nickname + '@' + full_domain,
|
||||||
'vcard:Address': '',
|
'vcard:Address': '',
|
||||||
'vcard:bday': ''
|
'vcard:bday': '',
|
||||||
|
'showFeatured': False,
|
||||||
|
'showMedia': False,
|
||||||
|
'showRepliesInMedia': False
|
||||||
}
|
}
|
||||||
|
|
||||||
# extra fields used only by groups
|
# extra fields used only by groups
|
||||||
|
|
@ -927,6 +934,31 @@ def person_upgrade_actor(base_dir: str, person_json: {},
|
||||||
person_json['searchableBy']: list[str] = []
|
person_json['searchableBy']: list[str] = []
|
||||||
update_actor = True
|
update_actor = True
|
||||||
|
|
||||||
|
if 'showFeatured' not in person_json:
|
||||||
|
person_json['showFeatured']: bool = False
|
||||||
|
update_actor = True
|
||||||
|
|
||||||
|
if 'showMedia' not in person_json:
|
||||||
|
person_json['showMedia']: bool = False
|
||||||
|
update_actor = True
|
||||||
|
|
||||||
|
if 'showRepliesInMedia' not in person_json:
|
||||||
|
person_json['showRepliesInMedia']: bool = False
|
||||||
|
update_actor = True
|
||||||
|
|
||||||
|
if 'featuredCollections' not in person_json:
|
||||||
|
person_json['featuredCollections']: str = \
|
||||||
|
person_json['id'] + '/featured_collections'
|
||||||
|
update_actor = True
|
||||||
|
|
||||||
|
if 'webfinger' not in person_json:
|
||||||
|
nickname = get_nickname_from_actor(person_json['id'])
|
||||||
|
domain, port = get_domain_from_actor(person_json['id'])
|
||||||
|
if nickname and domain:
|
||||||
|
full_domain = get_full_domain(domain, port)
|
||||||
|
person_json['webfinger']: str = nickname + '@' + full_domain
|
||||||
|
update_actor = True
|
||||||
|
|
||||||
# add a speaker endpoint
|
# add a speaker endpoint
|
||||||
if not person_json.get('tts'):
|
if not person_json.get('tts'):
|
||||||
person_json['tts'] = person_json['id'] + '/speaker'
|
person_json['tts'] = person_json['id'] + '/speaker'
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue