Webfinger in actor context

main
bashrc 2026-08-07 17:06:50 +01:00
parent 629e8dd606
commit e38a940e8c
1 changed files with 7 additions and 0 deletions

View File

@ -244,6 +244,9 @@ def get_actor_update_json(actor_json: {}) -> {}:
if isinstance(actor_json['searchableBy'], list): if isinstance(actor_json['searchableBy'], list):
searchable_by = actor_json['searchableBy'] searchable_by = actor_json['searchableBy']
actor_url = get_url_from_post(actor_json['url']) actor_url = get_url_from_post(actor_json['url'])
nickname = get_nickname_from_actor(actor_url)
domain, port = get_domain_from_actor(actor_url)
full_domain = get_full_domain(domain, port)
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] = [] attribution_domains: list[str] = []
@ -254,6 +257,7 @@ def get_actor_update_json(actor_json: {}) -> {}:
'@context': [ '@context': [
"https://www.w3.org/ns/activitystreams", "https://www.w3.org/ns/activitystreams",
"https://w3id.org/security/v1", "https://w3id.org/security/v1",
"https://purl.archive.org/socialweb/webfinger",
{ {
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers", "manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
"indexable": "toot:indexable", "indexable": "toot:indexable",
@ -363,6 +367,7 @@ def get_actor_update_json(actor_json: {}) -> {}:
'published': actor_json['published'], 'published': actor_json['published'],
'searchableBy': searchable_by, 'searchableBy': searchable_by,
'devices': actor_json['devices'], 'devices': actor_json['devices'],
'webfinger': nickname + '@' + full_domain,
"publicKey": actor_json['publicKey'] "publicKey": actor_json['publicKey']
} }
} }
@ -521,6 +526,7 @@ def _create_person_base(base_dir: str, nickname: str, domain: str, port: int,
'@context': [ '@context': [
'https://www.w3.org/ns/activitystreams', 'https://www.w3.org/ns/activitystreams',
'https://w3id.org/security/v1', 'https://w3id.org/security/v1',
'https://purl.archive.org/socialweb/webfinger',
get_default_person_context() get_default_person_context()
], ],
'published': published, 'published': published,
@ -1084,6 +1090,7 @@ def person_upgrade_actor(base_dir: str, person_json: {},
person_json['@context'] = [ person_json['@context'] = [
'https://www.w3.org/ns/activitystreams', 'https://www.w3.org/ns/activitystreams',
'https://w3id.org/security/v1', 'https://w3id.org/security/v1',
'https://purl.archive.org/socialweb/webfinger',
get_default_person_context() get_default_person_context()
] ]