Merge branch 'main' of gitlab.com:bashrc2/epicyon

merge-requests/30/head
Bob Mottram 2022-02-16 14:32:29 +00:00
commit a65439826c
5 changed files with 20 additions and 14 deletions

View File

@ -1199,9 +1199,8 @@ class PubServer(BaseHTTPRequestHandler):
accept_str = 'text/vcard'
else:
accept_str = self.headers['Accept']
if 'text/vcard' not in accept_str:
return False
if 'application/' in accept_str:
if 'text/vcard' not in accept_str and \
'application/vcard+xml' not in accept_str:
return False
if path.startswith('/@'):
path = path.replace('/@', '/users/', 1)
@ -1228,9 +1227,9 @@ class PubServer(BaseHTTPRequestHandler):
self._404()
self.server.vcard_is_active = False
return True
if 'vcard+xml' in accept_str:
if 'application/vcard+xml' in accept_str:
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:
vcard_str = actor_to_vcard(actor_json, domain)
header_type = 'text/vcard; charset=utf-8'

View File

@ -519,7 +519,8 @@ def xml_podcast_to_dict(base_dir: str, xml_item: str, xml_str: str) -> {}:
'owner', 'srcset', 'img', 'role', 'address', 'suggested',
'startTime', 'duration', 'href', 'name', 'pubdate',
'length', 'season', 'email', 'platform', 'protocol',
'accountId', 'priority'
'accountId', 'priority', 'podcastAccountId',
'podcastAccountUrl'
)
pod_entry = {}
for pod_field in pod_fields:

12
pgp.py
View File

@ -652,25 +652,25 @@ def actor_to_vcard(actor: {}, domain: str) -> str:
email_address = get_email_address(actor)
if email_address:
vcard_str += 'EMAIL;TYPE=internet:' + email_address + '\n'
vcard_str += 'IMPP;TYPE=fediverse:' + \
vcard_str += 'IMPP:fediverse:' + \
actor['preferredUsername'] + '@' + domain + '\n'
xmpp_address = get_xmpp_address(actor)
if xmpp_address:
vcard_str += 'IMPP;TYPE=xmpp:' + xmpp_address + '\n'
vcard_str += 'IMPP:xmpp:' + xmpp_address + '\n'
jami_address = get_jami_address(actor)
if jami_address:
vcard_str += 'IMPP;TYPE=jami:' + jami_address + '\n'
vcard_str += 'IMPP:jami:' + jami_address + '\n'
matrix_address = get_matrix_address(actor)
if matrix_address:
vcard_str += 'IMPP;TYPE=matrix:' + matrix_address + '\n'
vcard_str += 'IMPP:matrix:' + matrix_address + '\n'
briar_address = get_briar_address(actor)
if briar_address:
if briar_address.startswith('briar://'):
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)
if cwtch_address:
vcard_str += 'IMPP;TYPE=cwtch:' + cwtch_address + '\n'
vcard_str += 'IMPP:cwtch:' + cwtch_address + '\n'
if actor.get('hasOccupation'):
if len(actor['hasOccupation']) > 0:
if actor['hasOccupation'][0].get('name'):

View File

@ -260,7 +260,7 @@ def get_vcard(xml_format: bool,
'Accept': 'text/vcard'
}
if xml_format:
headers['Accept'] = 'text/vcard+xml'
headers['Accept'] = 'application/vcard+xml'
session_params = {}
session_headers = {}
if headers:

View File

@ -34,8 +34,14 @@ def _html_podcast_social_interactions(podcast_properties: {},
return ''
episode_post_url = podcast_properties['socialInteract']['text']
actor_str = ''
podcast_account_id = None
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('@'):
actor_handle = actor_handle[1:]
actor_str = '?actor=' + actor_handle