mirror of https://gitlab.com/bashrc2/epicyon
Add vcard to webfinger
parent
346d11f77a
commit
41f1818cda
26
webfinger.py
26
webfinger.py
|
@ -171,6 +171,11 @@ def create_webfinger_endpoint(nickname: str, domain: str, port: int,
|
|||
"rel": "http://webfinger.net/rel/profile-page",
|
||||
"type": "text/html"
|
||||
},
|
||||
{
|
||||
"href": profile_page_href,
|
||||
"rel": "http://webfinger.net/rel/profile-page",
|
||||
"type": "text/vcard"
|
||||
},
|
||||
{
|
||||
"href": person_id,
|
||||
"rel": "self",
|
||||
|
@ -280,7 +285,7 @@ def webfinger_lookup(path: str, base_dir: str,
|
|||
return wf_json
|
||||
|
||||
|
||||
def _webfinger_updateAvatar(wf_json: {}, actor_json: {}) -> bool:
|
||||
def _webfinger_update_avatar(wf_json: {}, actor_json: {}) -> bool:
|
||||
"""Updates the avatar image link
|
||||
"""
|
||||
found = False
|
||||
|
@ -307,6 +312,20 @@ def _webfinger_updateAvatar(wf_json: {}, actor_json: {}) -> bool:
|
|||
return True
|
||||
|
||||
|
||||
def _webfinger_update_vcard(wf_json: {}, actor_json: {}) -> bool:
|
||||
"""Updates the vcard link
|
||||
"""
|
||||
for link in wf_json['links']:
|
||||
if link['type'] == 'text/vcard':
|
||||
return False
|
||||
wf_json['links'].append({
|
||||
"href": actor_json['url'],
|
||||
"rel": "http://webfinger.net/rel/profile-page",
|
||||
"type": "text/vcard"
|
||||
})
|
||||
return True
|
||||
|
||||
|
||||
def _webfinger_add_blog_link(wf_json: {}, actor_json: {}) -> bool:
|
||||
"""Adds a blog link to webfinger if needed
|
||||
"""
|
||||
|
@ -412,7 +431,10 @@ def _webfinger_updateFromProfile(wf_json: {}, actor_json: {}) -> bool:
|
|||
wf_json['aliases'].remove(full_alias)
|
||||
changed = True
|
||||
|
||||
if _webfinger_updateAvatar(wf_json, actor_json):
|
||||
if _webfinger_update_avatar(wf_json, actor_json):
|
||||
changed = True
|
||||
|
||||
if _webfinger_update_vcard(wf_json, actor_json):
|
||||
changed = True
|
||||
|
||||
if _webfinger_add_blog_link(wf_json, actor_json):
|
||||
|
|
Loading…
Reference in New Issue