From 0b7072e576af7b5d3be09cb921824daf5a5a8244 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 16 Feb 2022 12:38:06 +0000 Subject: [PATCH 1/3] impp type --- pgp.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pgp.py b/pgp.py index 6a84784a9..563155b1e 100644 --- a/pgp.py +++ b/pgp.py @@ -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'): From 5b7cc67720ce3b1c754e0a2ac638d56a6bbc604d Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 16 Feb 2022 12:44:26 +0000 Subject: [PATCH 2/3] Application mime type --- daemon.py | 9 ++++----- session.py | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/daemon.py b/daemon.py index 81c112e24..33b497c4f 100644 --- a/daemon.py +++ b/daemon.py @@ -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' diff --git a/session.py b/session.py index 35671d5d6..398c89328 100644 --- a/session.py +++ b/session.py @@ -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: From 08e5f5ba8f250640b398f3b0900ab3b812621f5d Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 16 Feb 2022 13:27:11 +0000 Subject: [PATCH 3/3] Additional fields for podcast interaction --- newswire.py | 3 ++- webapp_podcast.py | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/newswire.py b/newswire.py index 9994efde5..36097404d 100644 --- a/newswire.py +++ b/newswire.py @@ -514,7 +514,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: diff --git a/webapp_podcast.py b/webapp_podcast.py index bdfc85df6..cac8fcf23 100644 --- a/webapp_podcast.py +++ b/webapp_podcast.py @@ -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