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 ''
|
||||
|
||||
|
||||
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
|
||||
"""
|
||||
notCwtchAddress = False
|
||||
not_cwtch_address = False
|
||||
|
||||
if len(cwtchAddress) < 56:
|
||||
notCwtchAddress = True
|
||||
if cwtchAddress != cwtchAddress.lower():
|
||||
notCwtchAddress = True
|
||||
if not re.match("^[a-z0-9]*$", cwtchAddress):
|
||||
notCwtchAddress = True
|
||||
if len(cwtch_address) < 56:
|
||||
not_cwtch_address = True
|
||||
if cwtch_address != cwtch_address.lower():
|
||||
not_cwtch_address = True
|
||||
if not re.match("^[a-z0-9]*$", cwtch_address):
|
||||
not_cwtch_address = True
|
||||
|
||||
if not actor_json.get('attachment'):
|
||||
actor_json['attachment'] = []
|
||||
|
||||
# remove any existing value
|
||||
propertyFound = None
|
||||
property_found = None
|
||||
for property_value in actor_json['attachment']:
|
||||
if not property_value.get('name'):
|
||||
continue
|
||||
|
@ -65,11 +65,11 @@ def set_cwtch_address(actor_json: {}, cwtchAddress: str) -> None:
|
|||
continue
|
||||
if not property_value['name'].lower().startswith('cwtch'):
|
||||
continue
|
||||
propertyFound = property_value
|
||||
property_found = property_value
|
||||
break
|
||||
if propertyFound:
|
||||
actor_json['attachment'].remove(propertyFound)
|
||||
if notCwtchAddress:
|
||||
if property_found:
|
||||
actor_json['attachment'].remove(property_found)
|
||||
if not_cwtch_address:
|
||||
return
|
||||
|
||||
for property_value in actor_json['attachment']:
|
||||
|
@ -81,12 +81,12 @@ def set_cwtch_address(actor_json: {}, cwtchAddress: str) -> None:
|
|||
continue
|
||||
if property_value['type'] != 'PropertyValue':
|
||||
continue
|
||||
property_value['value'] = cwtchAddress
|
||||
property_value['value'] = cwtch_address
|
||||
return
|
||||
|
||||
newCwtchAddress = {
|
||||
new_cwtch_address = {
|
||||
"name": "Cwtch",
|
||||
"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
|
||||
briarAddress = None
|
||||
jamiAddress = None
|
||||
cwtchAddress = None
|
||||
cwtch_address = None
|
||||
ssbAddress = None
|
||||
emailAddress = None
|
||||
lockedAccount = False
|
||||
|
@ -7136,7 +7136,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
toxAddress = get_tox_address(actor_json)
|
||||
briarAddress = get_briar_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)
|
||||
EnigmaPubKey = get_enigma_pub_key(actor_json)
|
||||
PGPpubKey = get_pgp_pub_key(actor_json)
|
||||
|
@ -7173,7 +7173,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
xmppAddress, matrixAddress,
|
||||
ssbAddress, blogAddress,
|
||||
toxAddress, briarAddress,
|
||||
jamiAddress, cwtchAddress,
|
||||
jamiAddress, cwtch_address,
|
||||
EnigmaPubKey,
|
||||
PGPpubKey, PGPfingerprint,
|
||||
emailAddress,
|
||||
|
|
|
@ -48,7 +48,7 @@ def html_person_options(defaultTimeline: str,
|
|||
toxAddress: str,
|
||||
briarAddress: str,
|
||||
jamiAddress: str,
|
||||
cwtchAddress: str,
|
||||
cwtch_address: str,
|
||||
EnigmaPubKey: str,
|
||||
PGPpubKey: str,
|
||||
PGPfingerprint: str,
|
||||
|
@ -225,9 +225,9 @@ def html_person_options(defaultTimeline: str,
|
|||
if jamiAddress:
|
||||
optionsStr += \
|
||||
'<p class="imText">Jami: ' + remove_html(jamiAddress) + '</p>\n'
|
||||
if cwtchAddress:
|
||||
if cwtch_address:
|
||||
optionsStr += \
|
||||
'<p class="imText">Cwtch: ' + remove_html(cwtchAddress) + '</p>\n'
|
||||
'<p class="imText">Cwtch: ' + remove_html(cwtch_address) + '</p>\n'
|
||||
if EnigmaPubKey:
|
||||
optionsStr += \
|
||||
'<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)
|
||||
briarAddress = get_briar_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 \
|
||||
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:
|
||||
donateSection = '<div class="container">\n'
|
||||
donateSection += ' <center>\n'
|
||||
|
@ -700,10 +700,10 @@ def html_profile(signing_priv_key_pem: str,
|
|||
donateSection += \
|
||||
'<p>Jami: <label class="toxaddr">' + \
|
||||
jamiAddress + '</label></p>\n'
|
||||
if cwtchAddress:
|
||||
if cwtch_address:
|
||||
donateSection += \
|
||||
'<p>Cwtch: <label class="toxaddr">' + \
|
||||
cwtchAddress + '</label></p>\n'
|
||||
cwtch_address + '</label></p>\n'
|
||||
if EnigmaPubKey:
|
||||
donateSection += \
|
||||
'<p>Enigma: <label class="toxaddr">' + \
|
||||
|
@ -1886,7 +1886,7 @@ def _html_edit_profile_contact_info(nickname: str,
|
|||
toxAddress: str,
|
||||
briarAddress: str,
|
||||
jamiAddress: str,
|
||||
cwtchAddress: str,
|
||||
cwtch_address: str,
|
||||
translate: {}) -> str:
|
||||
"""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('Briar', 'briarAddress', briarAddress)
|
||||
editProfileForm += edit_text_field('Jami', 'jamiAddress', jamiAddress)
|
||||
editProfileForm += edit_text_field('Cwtch', 'cwtchAddress', cwtchAddress)
|
||||
editProfileForm += edit_text_field('Cwtch', 'cwtchAddress', cwtch_address)
|
||||
editProfileForm += \
|
||||
'<a href="/users/' + nickname + \
|
||||
'/followingaccounts"><label class="labels">' + \
|
||||
|
@ -2135,7 +2135,7 @@ def html_edit_profile(css_cache: {}, translate: {}, base_dir: str, path: str,
|
|||
PGPpubKey = EnigmaPubKey = ''
|
||||
PGPfingerprint = xmppAddress = matrixAddress = ''
|
||||
ssbAddress = blogAddress = toxAddress = jamiAddress = ''
|
||||
cwtchAddress = briarAddress = manuallyApprovesFollowers = ''
|
||||
cwtch_address = briarAddress = manuallyApprovesFollowers = ''
|
||||
|
||||
actor_json = load_json(actorFilename)
|
||||
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)
|
||||
briarAddress = get_briar_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)
|
||||
EnigmaPubKey = get_enigma_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,
|
||||
ssbAddress, toxAddress,
|
||||
briarAddress, jamiAddress,
|
||||
cwtchAddress, translate)
|
||||
cwtch_address, translate)
|
||||
|
||||
# Encryption Keys
|
||||
editProfileForm += \
|
||||
|
|
Loading…
Reference in New Issue