mirror of https://gitlab.com/bashrc2/epicyon
Merge branch 'main' of gitlab.com:bashrc2/epicyon
commit
a65439826c
|
|
@ -1199,9 +1199,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
accept_str = 'text/vcard'
|
accept_str = 'text/vcard'
|
||||||
else:
|
else:
|
||||||
accept_str = self.headers['Accept']
|
accept_str = self.headers['Accept']
|
||||||
if 'text/vcard' not in accept_str:
|
if 'text/vcard' not in accept_str and \
|
||||||
return False
|
'application/vcard+xml' not in accept_str:
|
||||||
if 'application/' in accept_str:
|
|
||||||
return False
|
return False
|
||||||
if path.startswith('/@'):
|
if path.startswith('/@'):
|
||||||
path = path.replace('/@', '/users/', 1)
|
path = path.replace('/@', '/users/', 1)
|
||||||
|
|
@ -1228,9 +1227,9 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self._404()
|
self._404()
|
||||||
self.server.vcard_is_active = False
|
self.server.vcard_is_active = False
|
||||||
return True
|
return True
|
||||||
if 'vcard+xml' in accept_str:
|
if 'application/vcard+xml' in accept_str:
|
||||||
vcard_str = actor_to_vcard_xml(actor_json, domain)
|
vcard_str = actor_to_vcard_xml(actor_json, domain)
|
||||||
header_type = 'text/vcard+xml; charset=utf-8'
|
header_type = 'application/vcard+xml; charset=utf-8'
|
||||||
else:
|
else:
|
||||||
vcard_str = actor_to_vcard(actor_json, domain)
|
vcard_str = actor_to_vcard(actor_json, domain)
|
||||||
header_type = 'text/vcard; charset=utf-8'
|
header_type = 'text/vcard; charset=utf-8'
|
||||||
|
|
|
||||||
|
|
@ -519,7 +519,8 @@ def xml_podcast_to_dict(base_dir: str, xml_item: str, xml_str: str) -> {}:
|
||||||
'owner', 'srcset', 'img', 'role', 'address', 'suggested',
|
'owner', 'srcset', 'img', 'role', 'address', 'suggested',
|
||||||
'startTime', 'duration', 'href', 'name', 'pubdate',
|
'startTime', 'duration', 'href', 'name', 'pubdate',
|
||||||
'length', 'season', 'email', 'platform', 'protocol',
|
'length', 'season', 'email', 'platform', 'protocol',
|
||||||
'accountId', 'priority'
|
'accountId', 'priority', 'podcastAccountId',
|
||||||
|
'podcastAccountUrl'
|
||||||
)
|
)
|
||||||
pod_entry = {}
|
pod_entry = {}
|
||||||
for pod_field in pod_fields:
|
for pod_field in pod_fields:
|
||||||
|
|
|
||||||
12
pgp.py
12
pgp.py
|
|
@ -652,25 +652,25 @@ def actor_to_vcard(actor: {}, domain: str) -> str:
|
||||||
email_address = get_email_address(actor)
|
email_address = get_email_address(actor)
|
||||||
if email_address:
|
if email_address:
|
||||||
vcard_str += 'EMAIL;TYPE=internet:' + email_address + '\n'
|
vcard_str += 'EMAIL;TYPE=internet:' + email_address + '\n'
|
||||||
vcard_str += 'IMPP;TYPE=fediverse:' + \
|
vcard_str += 'IMPP:fediverse:' + \
|
||||||
actor['preferredUsername'] + '@' + domain + '\n'
|
actor['preferredUsername'] + '@' + domain + '\n'
|
||||||
xmpp_address = get_xmpp_address(actor)
|
xmpp_address = get_xmpp_address(actor)
|
||||||
if xmpp_address:
|
if xmpp_address:
|
||||||
vcard_str += 'IMPP;TYPE=xmpp:' + xmpp_address + '\n'
|
vcard_str += 'IMPP:xmpp:' + xmpp_address + '\n'
|
||||||
jami_address = get_jami_address(actor)
|
jami_address = get_jami_address(actor)
|
||||||
if jami_address:
|
if jami_address:
|
||||||
vcard_str += 'IMPP;TYPE=jami:' + jami_address + '\n'
|
vcard_str += 'IMPP:jami:' + jami_address + '\n'
|
||||||
matrix_address = get_matrix_address(actor)
|
matrix_address = get_matrix_address(actor)
|
||||||
if matrix_address:
|
if matrix_address:
|
||||||
vcard_str += 'IMPP;TYPE=matrix:' + matrix_address + '\n'
|
vcard_str += 'IMPP:matrix:' + matrix_address + '\n'
|
||||||
briar_address = get_briar_address(actor)
|
briar_address = get_briar_address(actor)
|
||||||
if briar_address:
|
if briar_address:
|
||||||
if briar_address.startswith('briar://'):
|
if briar_address.startswith('briar://'):
|
||||||
briar_address = briar_address.split('briar://')[1]
|
briar_address = briar_address.split('briar://')[1]
|
||||||
vcard_str += 'IMPP;TYPE=briar:' + briar_address + '\n'
|
vcard_str += 'IMPP:briar:' + briar_address + '\n'
|
||||||
cwtch_address = get_cwtch_address(actor)
|
cwtch_address = get_cwtch_address(actor)
|
||||||
if cwtch_address:
|
if cwtch_address:
|
||||||
vcard_str += 'IMPP;TYPE=cwtch:' + cwtch_address + '\n'
|
vcard_str += 'IMPP:cwtch:' + cwtch_address + '\n'
|
||||||
if actor.get('hasOccupation'):
|
if actor.get('hasOccupation'):
|
||||||
if len(actor['hasOccupation']) > 0:
|
if len(actor['hasOccupation']) > 0:
|
||||||
if actor['hasOccupation'][0].get('name'):
|
if actor['hasOccupation'][0].get('name'):
|
||||||
|
|
|
||||||
|
|
@ -260,7 +260,7 @@ def get_vcard(xml_format: bool,
|
||||||
'Accept': 'text/vcard'
|
'Accept': 'text/vcard'
|
||||||
}
|
}
|
||||||
if xml_format:
|
if xml_format:
|
||||||
headers['Accept'] = 'text/vcard+xml'
|
headers['Accept'] = 'application/vcard+xml'
|
||||||
session_params = {}
|
session_params = {}
|
||||||
session_headers = {}
|
session_headers = {}
|
||||||
if headers:
|
if headers:
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,14 @@ def _html_podcast_social_interactions(podcast_properties: {},
|
||||||
return ''
|
return ''
|
||||||
episode_post_url = podcast_properties['socialInteract']['text']
|
episode_post_url = podcast_properties['socialInteract']['text']
|
||||||
actor_str = ''
|
actor_str = ''
|
||||||
|
podcast_account_id = None
|
||||||
if podcast_properties['socialInteract'].get('accountId'):
|
if podcast_properties['socialInteract'].get('accountId'):
|
||||||
actor_handle = podcast_properties['socialInteract']['accountId']
|
podcast_account_id = podcast_properties['socialInteract']['accountId']
|
||||||
|
elif podcast_properties['socialInteract'].get('podcastAccountUrl'):
|
||||||
|
podcast_account_id = \
|
||||||
|
podcast_properties['socialInteract']['podcastAccountUrl']
|
||||||
|
if podcast_account_id:
|
||||||
|
actor_handle = podcast_account_id
|
||||||
if actor_handle.startswith('@'):
|
if actor_handle.startswith('@'):
|
||||||
actor_handle = actor_handle[1:]
|
actor_handle = actor_handle[1:]
|
||||||
actor_str = '?actor=' + actor_handle
|
actor_str = '?actor=' + actor_handle
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue