mirror of https://gitlab.com/bashrc2/epicyon
Check that actor attachments are dicts
parent
535dd39f60
commit
9fd0a820c3
9
art.py
9
art.py
|
@ -54,6 +54,9 @@ def get_art_site_url(actor_json: {}) -> str:
|
|||
if not isinstance(actor_json['attachment'], list):
|
||||
return ''
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
if not property_value.get('type'):
|
||||
continue
|
||||
if not isinstance(property_value['type'], str):
|
||||
|
@ -86,6 +89,9 @@ def set_art_site_url(actor_json: {}, art_site_url: str) -> None:
|
|||
# remove any existing value
|
||||
property_found = None
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name'].lower()
|
||||
|
@ -104,6 +110,9 @@ def set_art_site_url(actor_json: {}, art_site_url: str) -> None:
|
|||
actor_json['attachment'].remove(property_found)
|
||||
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name']
|
||||
|
|
9
briar.py
9
briar.py
|
@ -20,6 +20,9 @@ def get_briar_address(actor_json: {}) -> str:
|
|||
if not isinstance(actor_json['attachment'], list):
|
||||
return ''
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name']
|
||||
|
@ -85,6 +88,9 @@ def set_briar_address(actor_json: {}, briar_address: str) -> None:
|
|||
# remove any existing value
|
||||
property_found = None
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name']
|
||||
|
@ -104,6 +110,9 @@ def set_briar_address(actor_json: {}, briar_address: str) -> None:
|
|||
return
|
||||
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name']
|
||||
|
|
9
cwtch.py
9
cwtch.py
|
@ -20,6 +20,9 @@ def get_cwtch_address(actor_json: {}) -> str:
|
|||
if not isinstance(actor_json['attachment'], list):
|
||||
return ''
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name']
|
||||
|
@ -71,6 +74,9 @@ def set_cwtch_address(actor_json: {}, cwtch_address: str) -> None:
|
|||
# remove any existing value
|
||||
property_found = None
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name']
|
||||
|
@ -90,6 +96,9 @@ def set_cwtch_address(actor_json: {}, cwtch_address: str) -> None:
|
|||
return
|
||||
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name']
|
||||
|
|
|
@ -23,6 +23,9 @@ def get_discord(actor_json: {}) -> str:
|
|||
if not isinstance(actor_json['attachment'], list):
|
||||
return ''
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name'].lower()
|
||||
|
@ -54,6 +57,9 @@ def set_discord(actor_json: {}, discord: str) -> None:
|
|||
# remove any existing value
|
||||
property_found = None
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name'].lower()
|
||||
|
@ -72,6 +78,9 @@ def set_discord(actor_json: {}, discord: str) -> None:
|
|||
actor_json['attachment'].remove(property_found)
|
||||
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name']
|
||||
|
|
|
@ -33,6 +33,9 @@ def get_donation_url(actor_json: {}) -> str:
|
|||
return ''
|
||||
donation_type_list = _get_donation_types()
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name']
|
||||
|
@ -102,6 +105,9 @@ def set_donation_url(actor_json: {}, donate_url: str) -> None:
|
|||
# remove any existing value
|
||||
property_found = None
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name']
|
||||
|
@ -126,6 +132,9 @@ def set_donation_url(actor_json: {}, donate_url: str) -> None:
|
|||
donate_url + '</a>'
|
||||
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name']
|
||||
|
|
|
@ -20,6 +20,9 @@ def get_enigma_pub_key(actor_json: {}) -> str:
|
|||
if not isinstance(actor_json['attachment'], list):
|
||||
return ''
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name']
|
||||
|
@ -54,6 +57,9 @@ def set_enigma_pub_key(actor_json: {}, enigma_pub_key: str) -> None:
|
|||
# remove any existing value
|
||||
property_found = None
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name']
|
||||
|
@ -73,6 +79,9 @@ def set_enigma_pub_key(actor_json: {}, enigma_pub_key: str) -> None:
|
|||
return
|
||||
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name']
|
||||
|
|
6
git.py
6
git.py
|
@ -237,6 +237,9 @@ def get_repo_url(actor_json: {}) -> str:
|
|||
repo_type = ('github', 'ghub', 'gitlab', 'glab', 'codeberg', 'launchpad',
|
||||
'sourceforge', 'bitbucket', 'gitea')
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name']
|
||||
|
@ -268,6 +271,9 @@ def get_repo_url(actor_json: {}) -> str:
|
|||
repo_sites = ('github.com', 'gitlab.com', 'codeberg.org')
|
||||
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
if not property_value.get('type'):
|
||||
continue
|
||||
prop_value_name, prop_value = \
|
||||
|
|
|
@ -77,6 +77,9 @@ def set_actor_languages(actor_json: {}, languages_str: str) -> None:
|
|||
# remove any existing value
|
||||
property_found = None
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name']
|
||||
|
|
|
@ -20,6 +20,9 @@ def get_matrix_address(actor_json: {}) -> str:
|
|||
if not isinstance(actor_json['attachment'], list):
|
||||
return ''
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name']
|
||||
|
@ -76,6 +79,9 @@ def set_matrix_address(actor_json: {}, matrix_address: str) -> None:
|
|||
# remove any existing value
|
||||
property_found = None
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name']
|
||||
|
@ -106,6 +112,9 @@ def set_matrix_address(actor_json: {}, matrix_address: str) -> None:
|
|||
return
|
||||
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name']
|
||||
|
|
9
music.py
9
music.py
|
@ -30,6 +30,9 @@ def get_music_site_url(actor_json: {}) -> str:
|
|||
if not isinstance(actor_json['attachment'], list):
|
||||
return ''
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
if not property_value.get('type'):
|
||||
continue
|
||||
if not isinstance(property_value['type'], str):
|
||||
|
@ -62,6 +65,9 @@ def set_music_site_url(actor_json: {}, music_site_url: str) -> None:
|
|||
# remove any existing value
|
||||
property_found = None
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name'].lower()
|
||||
|
@ -80,6 +86,9 @@ def set_music_site_url(actor_json: {}, music_site_url: str) -> None:
|
|||
actor_json['attachment'].remove(property_found)
|
||||
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name']
|
||||
|
|
12
peertube.py
12
peertube.py
|
@ -23,6 +23,9 @@ def get_peertube(actor_json: {}) -> str:
|
|||
if not isinstance(actor_json['attachment'], list):
|
||||
return ''
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name'].lower()
|
||||
|
@ -44,6 +47,9 @@ def get_peertube(actor_json: {}) -> str:
|
|||
return remove_html(peertube_text)
|
||||
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
if not property_value.get('type'):
|
||||
continue
|
||||
prop_value_name, _ = \
|
||||
|
@ -68,6 +74,9 @@ def set_peertube(actor_json: {}, peertube: str) -> None:
|
|||
# remove any existing value
|
||||
property_found = None
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name'].lower()
|
||||
|
@ -86,6 +95,9 @@ def set_peertube(actor_json: {}, peertube: str) -> None:
|
|||
actor_json['attachment'].remove(property_found)
|
||||
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name']
|
||||
|
|
33
pgp.py
33
pgp.py
|
@ -52,6 +52,9 @@ def get_email_address(actor_json: {}) -> str:
|
|||
if not isinstance(actor_json['attachment'], list):
|
||||
return ''
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name']
|
||||
|
@ -95,6 +98,9 @@ def get_deltachat_invite(actor_json: {}, translate: {}) -> str:
|
|||
match_strings = _get_deltachat_strings()
|
||||
match_strings.append(translate['DeltaChat'].lower())
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name']
|
||||
|
@ -131,6 +137,9 @@ def get_pgp_pub_key(actor_json: {}) -> str:
|
|||
if not actor_json.get('attachment'):
|
||||
return ''
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name']
|
||||
|
@ -160,6 +169,9 @@ def get_pgp_fingerprint(actor_json: {}) -> str:
|
|||
if not actor_json.get('attachment'):
|
||||
return ''
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name']
|
||||
|
@ -202,6 +214,9 @@ def set_email_address(actor_json: {}, email_address: str) -> None:
|
|||
# remove any existing value
|
||||
property_found = None
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name']
|
||||
|
@ -221,6 +236,9 @@ def set_email_address(actor_json: {}, email_address: str) -> None:
|
|||
return
|
||||
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name']
|
||||
|
@ -273,6 +291,9 @@ def set_deltachat_invite(actor_json: {}, invite_link: str,
|
|||
# remove any existing value
|
||||
property_found = None
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
if not property_value.get('name'):
|
||||
continue
|
||||
if not property_value.get('type'):
|
||||
|
@ -312,6 +333,9 @@ def set_pgp_pub_key(actor_json: {}, pgp_pub_key: str) -> None:
|
|||
# remove any existing value
|
||||
property_found = None
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name']
|
||||
|
@ -331,6 +355,9 @@ def set_pgp_pub_key(actor_json: {}, pgp_pub_key: str) -> None:
|
|||
return
|
||||
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name']
|
||||
|
@ -375,6 +402,9 @@ def set_pgp_fingerprint(actor_json: {}, fingerprint: str) -> None:
|
|||
# remove any existing value
|
||||
property_found = None
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name']
|
||||
|
@ -394,6 +424,9 @@ def set_pgp_fingerprint(actor_json: {}, fingerprint: str) -> None:
|
|||
return
|
||||
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name']
|
||||
|
|
12
pixelfed.py
12
pixelfed.py
|
@ -27,6 +27,9 @@ def get_pixelfed(actor_json: {}) -> str:
|
|||
if not isinstance(actor_json['attachment'], list):
|
||||
return ''
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name'].lower()
|
||||
|
@ -65,6 +68,9 @@ def get_pixelfed(actor_json: {}) -> str:
|
|||
return pixelfed_text
|
||||
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
if not property_value.get('type'):
|
||||
continue
|
||||
prop_value_name, _ = \
|
||||
|
@ -91,6 +97,9 @@ def set_pixelfed(actor_json: {}, pixelfed: str) -> None:
|
|||
# remove any existing value
|
||||
property_found = None
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name'].lower()
|
||||
|
@ -109,6 +118,9 @@ def set_pixelfed(actor_json: {}, pixelfed: str) -> None:
|
|||
actor_json['attachment'].remove(property_found)
|
||||
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name']
|
||||
|
|
|
@ -23,6 +23,9 @@ def get_pronouns(actor_json: {}) -> str:
|
|||
if not isinstance(actor_json['attachment'], list):
|
||||
return ''
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name'].lower()
|
||||
|
@ -54,6 +57,9 @@ def set_pronouns(actor_json: {}, pronouns: str) -> None:
|
|||
# remove any existing value
|
||||
property_found = None
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name'].lower()
|
||||
|
@ -72,6 +78,9 @@ def set_pronouns(actor_json: {}, pronouns: str) -> None:
|
|||
actor_json['attachment'].remove(property_found)
|
||||
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name']
|
||||
|
|
9
ssb.py
9
ssb.py
|
@ -20,6 +20,9 @@ def get_ssb_address(actor_json: {}) -> str:
|
|||
if not isinstance(actor_json['attachment'], list):
|
||||
return ''
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name']
|
||||
|
@ -76,6 +79,9 @@ def set_ssb_address(actor_json: {}, ssb_address: str) -> None:
|
|||
# remove any existing value
|
||||
property_found = None
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name']
|
||||
|
@ -95,6 +101,9 @@ def set_ssb_address(actor_json: {}, ssb_address: str) -> None:
|
|||
return
|
||||
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name']
|
||||
|
|
2
tests.py
2
tests.py
|
@ -6828,6 +6828,8 @@ def test_update_actor(base_dir: str):
|
|||
assert len(actor_json['attachment']) > 0
|
||||
property_found = False
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
continue
|
||||
if property_value['name'] == 'PGP':
|
||||
print('PGP property set within attachment')
|
||||
assert pub_key in property_value['value']
|
||||
|
|
9
tox.py
9
tox.py
|
@ -20,6 +20,9 @@ def get_tox_address(actor_json: {}) -> str:
|
|||
if not isinstance(actor_json['attachment'], list):
|
||||
return ''
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name']
|
||||
|
@ -82,6 +85,9 @@ def set_tox_address(actor_json: {}, tox_address: str) -> None:
|
|||
# remove any existing value
|
||||
property_found = None
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name']
|
||||
|
@ -101,6 +107,9 @@ def set_tox_address(actor_json: {}, tox_address: str) -> None:
|
|||
return
|
||||
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name']
|
||||
|
|
6
utils.py
6
utils.py
|
@ -171,6 +171,9 @@ def get_actor_languages_list(actor_json: {}) -> []:
|
|||
if not actor_json.get('attachment'):
|
||||
return []
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name']
|
||||
|
@ -2703,6 +2706,9 @@ def get_actor_property_url(actor_json: {}, property_name: str) -> str:
|
|||
return ''
|
||||
property_name = property_name.lower()
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: Actor attachment is not dict: " + str(property_value))
|
||||
|
|
|
@ -291,6 +291,9 @@ def _set_actor_property_url(actor_json: {},
|
|||
# remove any existing value
|
||||
property_found = None
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name']
|
||||
|
@ -323,6 +326,9 @@ def _set_actor_property_url(actor_json: {},
|
|||
return
|
||||
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name']
|
||||
|
|
|
@ -533,6 +533,9 @@ def _webfinger_update_from_profile(wf_json: {}, actor_json: {}) -> bool:
|
|||
aliases_not_found.append(alias)
|
||||
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name']
|
||||
|
|
15
website.py
15
website.py
|
@ -30,6 +30,9 @@ def get_website(actor_json: {}, translate: {}) -> str:
|
|||
match_strings = _get_website_strings()
|
||||
match_strings.append(website_str)
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name']
|
||||
|
@ -72,6 +75,9 @@ def get_gemini_link(actor_json: {}) -> str:
|
|||
return ''
|
||||
match_strings = _get_gemini_strings()
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name']
|
||||
|
@ -93,6 +99,9 @@ def get_gemini_link(actor_json: {}) -> str:
|
|||
return remove_link_tracking(url)
|
||||
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
if not property_value.get('type'):
|
||||
continue
|
||||
prop_value_name, _ = \
|
||||
|
@ -131,6 +140,9 @@ def set_website(actor_json: {}, website_url: str, translate: {}) -> None:
|
|||
# remove any existing value
|
||||
property_found = None
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
if not property_value.get('name'):
|
||||
continue
|
||||
if not property_value.get('type'):
|
||||
|
@ -174,6 +186,9 @@ def set_gemini_link(actor_json: {}, gemini_link: str) -> None:
|
|||
# remove any existing value
|
||||
property_found = None
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
if not property_value.get('name'):
|
||||
continue
|
||||
if not property_value.get('type'):
|
||||
|
|
9
xmpp.py
9
xmpp.py
|
@ -20,6 +20,9 @@ def get_xmpp_address(actor_json: {}) -> str:
|
|||
if not isinstance(actor_json['attachment'], list):
|
||||
return ''
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name'].lower()
|
||||
|
@ -76,6 +79,9 @@ def set_xmpp_address(actor_json: {}, xmpp_address: str) -> None:
|
|||
# remove any existing value
|
||||
property_found = None
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name']
|
||||
|
@ -104,6 +110,9 @@ def set_xmpp_address(actor_json: {}, xmpp_address: str) -> None:
|
|||
return
|
||||
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name']
|
||||
|
|
12
youtube.py
12
youtube.py
|
@ -23,6 +23,9 @@ def get_youtube(actor_json: {}) -> str:
|
|||
if not isinstance(actor_json['attachment'], list):
|
||||
return ''
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name'].lower()
|
||||
|
@ -44,6 +47,9 @@ def get_youtube(actor_json: {}) -> str:
|
|||
return remove_html(youtube_text)
|
||||
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
if not property_value.get('type'):
|
||||
continue
|
||||
prop_value_name, _ = \
|
||||
|
@ -69,6 +75,9 @@ def set_youtube(actor_json: {}, youtube: str) -> None:
|
|||
# remove any existing value
|
||||
property_found = None
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name'].lower()
|
||||
|
@ -87,6 +96,9 @@ def set_youtube(actor_json: {}, youtube: str) -> None:
|
|||
actor_json['attachment'].remove(property_found)
|
||||
|
||||
for property_value in actor_json['attachment']:
|
||||
if not isinstance(property_value, dict):
|
||||
print("WARN: actor attachment is not dict: " + str(property_value))
|
||||
continue
|
||||
name_value = None
|
||||
if property_value.get('name'):
|
||||
name_value = property_value['name']
|
||||
|
|
Loading…
Reference in New Issue