searchableBy field

main
Bob Mottram 2024-01-06 11:53:05 +00:00
parent c1a74d7ca9
commit 5a3389e115
1 changed files with 21 additions and 3 deletions

View File

@ -232,6 +232,10 @@ def get_actor_update_json(actor_json: {}) -> {}:
indexable = False indexable = False
if actor_json.get('indexable'): if actor_json.get('indexable'):
indexable = True indexable = True
searchable_by = []
if actor_json.get('searchableBy'):
if isinstance(actor_json['searchableBy'], list):
searchable_by = actor_json['searchableBy']
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'])
@ -242,6 +246,10 @@ def get_actor_update_json(actor_json: {}) -> {}:
{ {
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers", "manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
"indexable": "toot:indexable", "indexable": "toot:indexable",
"searchableBy": {
"@id": "fedibird:searchableBy",
"@type": "@id"
},
"memorial": "toot:memorial", "memorial": "toot:memorial",
"toot": "http://joinmastodon.org/ns#", "toot": "http://joinmastodon.org/ns#",
"featured": "featured":
@ -339,6 +347,7 @@ def get_actor_update_json(actor_json: {}) -> {}:
'memorial': memorial, 'memorial': memorial,
'indexable': indexable, 'indexable': indexable,
'published': actor_json['published'], 'published': actor_json['published'],
'searchableBy': searchable_by,
'devices': actor_json['devices'], 'devices': actor_json['devices'],
"publicKey": actor_json['publicKey'] "publicKey": actor_json['publicKey']
} }
@ -394,6 +403,10 @@ def get_default_person_context() -> str:
'identityKey': {'@id': 'toot:identityKey', '@type': '@id'}, 'identityKey': {'@id': 'toot:identityKey', '@type': '@id'},
'manuallyApprovesFollowers': 'as:manuallyApprovesFollowers', 'manuallyApprovesFollowers': 'as:manuallyApprovesFollowers',
'indexable': 'toot:indexable', 'indexable': 'toot:indexable',
'searchableBy': {
'@id': 'fedibird:searchableBy',
'@type': '@id'
},
'memorial': 'toot:memorial', 'memorial': 'toot:memorial',
'messageFranking': 'toot:messageFranking', 'messageFranking': 'toot:messageFranking',
'messageType': 'toot:messageType', 'messageType': 'toot:messageType',
@ -520,6 +533,7 @@ def _create_person_base(base_dir: str, nickname: str, domain: str, port: int,
'manuallyApprovesFollowers': approve_followers, 'manuallyApprovesFollowers': approve_followers,
'discoverable': True, 'discoverable': True,
'indexable': False, 'indexable': False,
'searchableBy': [],
'memorial': False, 'memorial': False,
'hideFollows': False, 'hideFollows': False,
'name': person_name, 'name': person_name,
@ -847,18 +861,22 @@ 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 not person_json.get('memorial'): if 'memorial' not in person_json:
person_json['memorial'] = False person_json['memorial'] = False
update_actor = True update_actor = True
if not person_json.get('hideFollows'): if 'hideFollows' not in person_json:
person_json['hideFollows'] = False person_json['hideFollows'] = False
update_actor = True update_actor = True
if not person_json.get('indexable'): if 'indexable' not in person_json:
person_json['indexable'] = False person_json['indexable'] = False
update_actor = True update_actor = True
if 'searchableBy' not in person_json:
person_json['searchableBy'] = []
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'