mirror of https://gitlab.com/bashrc2/epicyon
Snake case
parent
64588f9d2a
commit
0cbdf6d270
34
cwtch.py
34
cwtch.py
|
@ -41,23 +41,23 @@ def get_cwtch_address(actor_json: {}) -> str:
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
|
||||||
def set_cwtch_address(actor_json: {}, cwtchAddress: str) -> None:
|
def set_cwtch_address(actor_json: {}, cwtch_address: str) -> None:
|
||||||
"""Sets an cwtch address for the given actor
|
"""Sets an cwtch address for the given actor
|
||||||
"""
|
"""
|
||||||
notCwtchAddress = False
|
not_cwtch_address = False
|
||||||
|
|
||||||
if len(cwtchAddress) < 56:
|
if len(cwtch_address) < 56:
|
||||||
notCwtchAddress = True
|
not_cwtch_address = True
|
||||||
if cwtchAddress != cwtchAddress.lower():
|
if cwtch_address != cwtch_address.lower():
|
||||||
notCwtchAddress = True
|
not_cwtch_address = True
|
||||||
if not re.match("^[a-z0-9]*$", cwtchAddress):
|
if not re.match("^[a-z0-9]*$", cwtch_address):
|
||||||
notCwtchAddress = True
|
not_cwtch_address = True
|
||||||
|
|
||||||
if not actor_json.get('attachment'):
|
if not actor_json.get('attachment'):
|
||||||
actor_json['attachment'] = []
|
actor_json['attachment'] = []
|
||||||
|
|
||||||
# remove any existing value
|
# remove any existing value
|
||||||
propertyFound = None
|
property_found = None
|
||||||
for property_value in actor_json['attachment']:
|
for property_value in actor_json['attachment']:
|
||||||
if not property_value.get('name'):
|
if not property_value.get('name'):
|
||||||
continue
|
continue
|
||||||
|
@ -65,11 +65,11 @@ def set_cwtch_address(actor_json: {}, cwtchAddress: str) -> None:
|
||||||
continue
|
continue
|
||||||
if not property_value['name'].lower().startswith('cwtch'):
|
if not property_value['name'].lower().startswith('cwtch'):
|
||||||
continue
|
continue
|
||||||
propertyFound = property_value
|
property_found = property_value
|
||||||
break
|
break
|
||||||
if propertyFound:
|
if property_found:
|
||||||
actor_json['attachment'].remove(propertyFound)
|
actor_json['attachment'].remove(property_found)
|
||||||
if notCwtchAddress:
|
if not_cwtch_address:
|
||||||
return
|
return
|
||||||
|
|
||||||
for property_value in actor_json['attachment']:
|
for property_value in actor_json['attachment']:
|
||||||
|
@ -81,12 +81,12 @@ def set_cwtch_address(actor_json: {}, cwtchAddress: str) -> None:
|
||||||
continue
|
continue
|
||||||
if property_value['type'] != 'PropertyValue':
|
if property_value['type'] != 'PropertyValue':
|
||||||
continue
|
continue
|
||||||
property_value['value'] = cwtchAddress
|
property_value['value'] = cwtch_address
|
||||||
return
|
return
|
||||||
|
|
||||||
newCwtchAddress = {
|
new_cwtch_address = {
|
||||||
"name": "Cwtch",
|
"name": "Cwtch",
|
||||||
"type": "PropertyValue",
|
"type": "PropertyValue",
|
||||||
"value": cwtchAddress
|
"value": cwtch_address
|
||||||
}
|
}
|
||||||
actor_json['attachment'].append(newCwtchAddress)
|
actor_json['attachment'].append(new_cwtch_address)
|
||||||
|
|
|
@ -7108,7 +7108,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
toxAddress = None
|
toxAddress = None
|
||||||
briarAddress = None
|
briarAddress = None
|
||||||
jamiAddress = None
|
jamiAddress = None
|
||||||
cwtchAddress = None
|
cwtch_address = None
|
||||||
ssbAddress = None
|
ssbAddress = None
|
||||||
emailAddress = None
|
emailAddress = None
|
||||||
lockedAccount = False
|
lockedAccount = False
|
||||||
|
@ -7136,7 +7136,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
toxAddress = get_tox_address(actor_json)
|
toxAddress = get_tox_address(actor_json)
|
||||||
briarAddress = get_briar_address(actor_json)
|
briarAddress = get_briar_address(actor_json)
|
||||||
jamiAddress = get_jami_address(actor_json)
|
jamiAddress = get_jami_address(actor_json)
|
||||||
cwtchAddress = get_cwtch_address(actor_json)
|
cwtch_address = get_cwtch_address(actor_json)
|
||||||
emailAddress = get_email_address(actor_json)
|
emailAddress = get_email_address(actor_json)
|
||||||
EnigmaPubKey = get_enigma_pub_key(actor_json)
|
EnigmaPubKey = get_enigma_pub_key(actor_json)
|
||||||
PGPpubKey = get_pgp_pub_key(actor_json)
|
PGPpubKey = get_pgp_pub_key(actor_json)
|
||||||
|
@ -7173,7 +7173,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
xmppAddress, matrixAddress,
|
xmppAddress, matrixAddress,
|
||||||
ssbAddress, blogAddress,
|
ssbAddress, blogAddress,
|
||||||
toxAddress, briarAddress,
|
toxAddress, briarAddress,
|
||||||
jamiAddress, cwtchAddress,
|
jamiAddress, cwtch_address,
|
||||||
EnigmaPubKey,
|
EnigmaPubKey,
|
||||||
PGPpubKey, PGPfingerprint,
|
PGPpubKey, PGPfingerprint,
|
||||||
emailAddress,
|
emailAddress,
|
||||||
|
|
|
@ -48,7 +48,7 @@ def html_person_options(defaultTimeline: str,
|
||||||
toxAddress: str,
|
toxAddress: str,
|
||||||
briarAddress: str,
|
briarAddress: str,
|
||||||
jamiAddress: str,
|
jamiAddress: str,
|
||||||
cwtchAddress: str,
|
cwtch_address: str,
|
||||||
EnigmaPubKey: str,
|
EnigmaPubKey: str,
|
||||||
PGPpubKey: str,
|
PGPpubKey: str,
|
||||||
PGPfingerprint: str,
|
PGPfingerprint: str,
|
||||||
|
@ -225,9 +225,9 @@ def html_person_options(defaultTimeline: str,
|
||||||
if jamiAddress:
|
if jamiAddress:
|
||||||
optionsStr += \
|
optionsStr += \
|
||||||
'<p class="imText">Jami: ' + remove_html(jamiAddress) + '</p>\n'
|
'<p class="imText">Jami: ' + remove_html(jamiAddress) + '</p>\n'
|
||||||
if cwtchAddress:
|
if cwtch_address:
|
||||||
optionsStr += \
|
optionsStr += \
|
||||||
'<p class="imText">Cwtch: ' + remove_html(cwtchAddress) + '</p>\n'
|
'<p class="imText">Cwtch: ' + remove_html(cwtch_address) + '</p>\n'
|
||||||
if EnigmaPubKey:
|
if EnigmaPubKey:
|
||||||
optionsStr += \
|
optionsStr += \
|
||||||
'<p class="imText">Enigma: ' + remove_html(EnigmaPubKey) + '</p>\n'
|
'<p class="imText">Enigma: ' + remove_html(EnigmaPubKey) + '</p>\n'
|
||||||
|
|
|
@ -648,10 +648,10 @@ def html_profile(signing_priv_key_pem: str,
|
||||||
toxAddress = get_tox_address(profile_json)
|
toxAddress = get_tox_address(profile_json)
|
||||||
briarAddress = get_briar_address(profile_json)
|
briarAddress = get_briar_address(profile_json)
|
||||||
jamiAddress = get_jami_address(profile_json)
|
jamiAddress = get_jami_address(profile_json)
|
||||||
cwtchAddress = get_cwtch_address(profile_json)
|
cwtch_address = get_cwtch_address(profile_json)
|
||||||
if donateUrl or websiteUrl or xmppAddress or matrixAddress or \
|
if donateUrl or websiteUrl or xmppAddress or matrixAddress or \
|
||||||
ssbAddress or toxAddress or briarAddress or \
|
ssbAddress or toxAddress or briarAddress or \
|
||||||
jamiAddress or cwtchAddress or PGPpubKey or EnigmaPubKey or \
|
jamiAddress or cwtch_address or PGPpubKey or EnigmaPubKey or \
|
||||||
PGPfingerprint or emailAddress:
|
PGPfingerprint or emailAddress:
|
||||||
donateSection = '<div class="container">\n'
|
donateSection = '<div class="container">\n'
|
||||||
donateSection += ' <center>\n'
|
donateSection += ' <center>\n'
|
||||||
|
@ -700,10 +700,10 @@ def html_profile(signing_priv_key_pem: str,
|
||||||
donateSection += \
|
donateSection += \
|
||||||
'<p>Jami: <label class="toxaddr">' + \
|
'<p>Jami: <label class="toxaddr">' + \
|
||||||
jamiAddress + '</label></p>\n'
|
jamiAddress + '</label></p>\n'
|
||||||
if cwtchAddress:
|
if cwtch_address:
|
||||||
donateSection += \
|
donateSection += \
|
||||||
'<p>Cwtch: <label class="toxaddr">' + \
|
'<p>Cwtch: <label class="toxaddr">' + \
|
||||||
cwtchAddress + '</label></p>\n'
|
cwtch_address + '</label></p>\n'
|
||||||
if EnigmaPubKey:
|
if EnigmaPubKey:
|
||||||
donateSection += \
|
donateSection += \
|
||||||
'<p>Enigma: <label class="toxaddr">' + \
|
'<p>Enigma: <label class="toxaddr">' + \
|
||||||
|
@ -1886,7 +1886,7 @@ def _html_edit_profile_contact_info(nickname: str,
|
||||||
toxAddress: str,
|
toxAddress: str,
|
||||||
briarAddress: str,
|
briarAddress: str,
|
||||||
jamiAddress: str,
|
jamiAddress: str,
|
||||||
cwtchAddress: str,
|
cwtch_address: str,
|
||||||
translate: {}) -> str:
|
translate: {}) -> str:
|
||||||
"""Contact Information section of edit profile screen
|
"""Contact Information section of edit profile screen
|
||||||
"""
|
"""
|
||||||
|
@ -1902,7 +1902,7 @@ def _html_edit_profile_contact_info(nickname: str,
|
||||||
editProfileForm += edit_text_field('Tox', 'toxAddress', toxAddress)
|
editProfileForm += edit_text_field('Tox', 'toxAddress', toxAddress)
|
||||||
editProfileForm += edit_text_field('Briar', 'briarAddress', briarAddress)
|
editProfileForm += edit_text_field('Briar', 'briarAddress', briarAddress)
|
||||||
editProfileForm += edit_text_field('Jami', 'jamiAddress', jamiAddress)
|
editProfileForm += edit_text_field('Jami', 'jamiAddress', jamiAddress)
|
||||||
editProfileForm += edit_text_field('Cwtch', 'cwtchAddress', cwtchAddress)
|
editProfileForm += edit_text_field('Cwtch', 'cwtchAddress', cwtch_address)
|
||||||
editProfileForm += \
|
editProfileForm += \
|
||||||
'<a href="/users/' + nickname + \
|
'<a href="/users/' + nickname + \
|
||||||
'/followingaccounts"><label class="labels">' + \
|
'/followingaccounts"><label class="labels">' + \
|
||||||
|
@ -2135,7 +2135,7 @@ def html_edit_profile(css_cache: {}, translate: {}, base_dir: str, path: str,
|
||||||
PGPpubKey = EnigmaPubKey = ''
|
PGPpubKey = EnigmaPubKey = ''
|
||||||
PGPfingerprint = xmppAddress = matrixAddress = ''
|
PGPfingerprint = xmppAddress = matrixAddress = ''
|
||||||
ssbAddress = blogAddress = toxAddress = jamiAddress = ''
|
ssbAddress = blogAddress = toxAddress = jamiAddress = ''
|
||||||
cwtchAddress = briarAddress = manuallyApprovesFollowers = ''
|
cwtch_address = briarAddress = manuallyApprovesFollowers = ''
|
||||||
|
|
||||||
actor_json = load_json(actorFilename)
|
actor_json = load_json(actorFilename)
|
||||||
if actor_json:
|
if actor_json:
|
||||||
|
@ -2150,7 +2150,7 @@ def html_edit_profile(css_cache: {}, translate: {}, base_dir: str, path: str,
|
||||||
toxAddress = get_tox_address(actor_json)
|
toxAddress = get_tox_address(actor_json)
|
||||||
briarAddress = get_briar_address(actor_json)
|
briarAddress = get_briar_address(actor_json)
|
||||||
jamiAddress = get_jami_address(actor_json)
|
jamiAddress = get_jami_address(actor_json)
|
||||||
cwtchAddress = get_cwtch_address(actor_json)
|
cwtch_address = get_cwtch_address(actor_json)
|
||||||
emailAddress = get_email_address(actor_json)
|
emailAddress = get_email_address(actor_json)
|
||||||
EnigmaPubKey = get_enigma_pub_key(actor_json)
|
EnigmaPubKey = get_enigma_pub_key(actor_json)
|
||||||
PGPpubKey = get_pgp_pub_key(actor_json)
|
PGPpubKey = get_pgp_pub_key(actor_json)
|
||||||
|
@ -2293,7 +2293,7 @@ def html_edit_profile(css_cache: {}, translate: {}, base_dir: str, path: str,
|
||||||
xmppAddress, matrixAddress,
|
xmppAddress, matrixAddress,
|
||||||
ssbAddress, toxAddress,
|
ssbAddress, toxAddress,
|
||||||
briarAddress, jamiAddress,
|
briarAddress, jamiAddress,
|
||||||
cwtchAddress, translate)
|
cwtch_address, translate)
|
||||||
|
|
||||||
# Encryption Keys
|
# Encryption Keys
|
||||||
editProfileForm += \
|
editProfileForm += \
|
||||||
|
|
Loading…
Reference in New Issue