mirror of https://gitlab.com/bashrc2/epicyon
Snake case for profile contact variables
parent
81c3fc8789
commit
63334f8250
86
daemon.py
86
daemon.py
|
@ -5397,38 +5397,38 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
actorChanged = True
|
actorChanged = True
|
||||||
|
|
||||||
# change Enigma public key
|
# change Enigma public key
|
||||||
currentEnigmaPubKey = get_enigma_pub_key(actor_json)
|
currentenigma_pub_key = get_enigma_pub_key(actor_json)
|
||||||
if fields.get('enigmapubkey'):
|
if fields.get('enigmapubkey'):
|
||||||
if fields['enigmapubkey'] != currentEnigmaPubKey:
|
if fields['enigmapubkey'] != currentenigma_pub_key:
|
||||||
set_enigma_pub_key(actor_json,
|
set_enigma_pub_key(actor_json,
|
||||||
fields['enigmapubkey'])
|
fields['enigmapubkey'])
|
||||||
actorChanged = True
|
actorChanged = True
|
||||||
else:
|
else:
|
||||||
if currentEnigmaPubKey:
|
if currentenigma_pub_key:
|
||||||
set_enigma_pub_key(actor_json, '')
|
set_enigma_pub_key(actor_json, '')
|
||||||
actorChanged = True
|
actorChanged = True
|
||||||
|
|
||||||
# change PGP public key
|
# change PGP public key
|
||||||
currentPGPpubKey = get_pgp_pub_key(actor_json)
|
currentpgp_pub_key = get_pgp_pub_key(actor_json)
|
||||||
if fields.get('pgp'):
|
if fields.get('pgp'):
|
||||||
if fields['pgp'] != currentPGPpubKey:
|
if fields['pgp'] != currentpgp_pub_key:
|
||||||
set_pgp_pub_key(actor_json,
|
set_pgp_pub_key(actor_json,
|
||||||
fields['pgp'])
|
fields['pgp'])
|
||||||
actorChanged = True
|
actorChanged = True
|
||||||
else:
|
else:
|
||||||
if currentPGPpubKey:
|
if currentpgp_pub_key:
|
||||||
set_pgp_pub_key(actor_json, '')
|
set_pgp_pub_key(actor_json, '')
|
||||||
actorChanged = True
|
actorChanged = True
|
||||||
|
|
||||||
# change PGP fingerprint
|
# change PGP fingerprint
|
||||||
currentPGPfingerprint = get_pgp_fingerprint(actor_json)
|
currentpgp_fingerprint = get_pgp_fingerprint(actor_json)
|
||||||
if fields.get('openpgp'):
|
if fields.get('openpgp'):
|
||||||
if fields['openpgp'] != currentPGPfingerprint:
|
if fields['openpgp'] != currentpgp_fingerprint:
|
||||||
set_pgp_fingerprint(actor_json,
|
set_pgp_fingerprint(actor_json,
|
||||||
fields['openpgp'])
|
fields['openpgp'])
|
||||||
actorChanged = True
|
actorChanged = True
|
||||||
else:
|
else:
|
||||||
if currentPGPfingerprint:
|
if currentpgp_fingerprint:
|
||||||
set_pgp_fingerprint(actor_json, '')
|
set_pgp_fingerprint(actor_json, '')
|
||||||
actorChanged = True
|
actorChanged = True
|
||||||
|
|
||||||
|
@ -7097,20 +7097,20 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
if len(optionsList) > 3:
|
if len(optionsList) > 3:
|
||||||
optionsLink = optionsList[3]
|
optionsLink = optionsList[3]
|
||||||
isGroup = False
|
isGroup = False
|
||||||
donateUrl = None
|
donate_url = None
|
||||||
websiteUrl = None
|
website_url = None
|
||||||
EnigmaPubKey = None
|
enigma_pub_key = None
|
||||||
PGPpubKey = None
|
pgp_pub_key = None
|
||||||
PGPfingerprint = None
|
pgp_fingerprint = None
|
||||||
xmppAddress = None
|
xmpp_address = None
|
||||||
matrixAddress = None
|
matrix_address = None
|
||||||
blogAddress = None
|
blog_address = None
|
||||||
toxAddress = None
|
tox_address = None
|
||||||
briarAddress = None
|
briar_address = None
|
||||||
jamiAddress = None
|
jami_address = None
|
||||||
cwtch_address = None
|
cwtch_address = None
|
||||||
ssbAddress = None
|
ssb_address = None
|
||||||
emailAddress = None
|
email_address = None
|
||||||
lockedAccount = False
|
lockedAccount = False
|
||||||
alsoKnownAs = None
|
alsoKnownAs = None
|
||||||
movedTo = ''
|
movedTo = ''
|
||||||
|
@ -7127,20 +7127,20 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
if actor_json['type'] == 'Group':
|
if actor_json['type'] == 'Group':
|
||||||
isGroup = True
|
isGroup = True
|
||||||
lockedAccount = get_locked_account(actor_json)
|
lockedAccount = get_locked_account(actor_json)
|
||||||
donateUrl = get_donation_url(actor_json)
|
donate_url = get_donation_url(actor_json)
|
||||||
websiteUrl = get_website(actor_json, self.server.translate)
|
website_url = get_website(actor_json, self.server.translate)
|
||||||
xmppAddress = get_xmpp_address(actor_json)
|
xmpp_address = get_xmpp_address(actor_json)
|
||||||
matrixAddress = get_matrix_address(actor_json)
|
matrix_address = get_matrix_address(actor_json)
|
||||||
ssbAddress = get_ssb_address(actor_json)
|
ssb_address = get_ssb_address(actor_json)
|
||||||
blogAddress = get_blog_address(actor_json)
|
blog_address = get_blog_address(actor_json)
|
||||||
toxAddress = get_tox_address(actor_json)
|
tox_address = get_tox_address(actor_json)
|
||||||
briarAddress = get_briar_address(actor_json)
|
briar_address = get_briar_address(actor_json)
|
||||||
jamiAddress = get_jami_address(actor_json)
|
jami_address = get_jami_address(actor_json)
|
||||||
cwtch_address = get_cwtch_address(actor_json)
|
cwtch_address = get_cwtch_address(actor_json)
|
||||||
emailAddress = get_email_address(actor_json)
|
email_address = get_email_address(actor_json)
|
||||||
EnigmaPubKey = get_enigma_pub_key(actor_json)
|
enigma_pub_key = get_enigma_pub_key(actor_json)
|
||||||
PGPpubKey = get_pgp_pub_key(actor_json)
|
pgp_pub_key = get_pgp_pub_key(actor_json)
|
||||||
PGPfingerprint = get_pgp_fingerprint(actor_json)
|
pgp_fingerprint = get_pgp_fingerprint(actor_json)
|
||||||
if actor_json.get('alsoKnownAs'):
|
if actor_json.get('alsoKnownAs'):
|
||||||
alsoKnownAs = actor_json['alsoKnownAs']
|
alsoKnownAs = actor_json['alsoKnownAs']
|
||||||
|
|
||||||
|
@ -7169,14 +7169,14 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
optionsActor,
|
optionsActor,
|
||||||
optionsProfileUrl,
|
optionsProfileUrl,
|
||||||
optionsLink,
|
optionsLink,
|
||||||
pageNumber, donateUrl, websiteUrl,
|
pageNumber, donate_url, website_url,
|
||||||
xmppAddress, matrixAddress,
|
xmpp_address, matrix_address,
|
||||||
ssbAddress, blogAddress,
|
ssb_address, blog_address,
|
||||||
toxAddress, briarAddress,
|
tox_address, briar_address,
|
||||||
jamiAddress, cwtch_address,
|
jami_address, cwtch_address,
|
||||||
EnigmaPubKey,
|
enigma_pub_key,
|
||||||
PGPpubKey, PGPfingerprint,
|
pgp_pub_key, pgp_fingerprint,
|
||||||
emailAddress,
|
email_address,
|
||||||
self.server.dormant_months,
|
self.server.dormant_months,
|
||||||
backToPath,
|
backToPath,
|
||||||
lockedAccount,
|
lockedAccount,
|
||||||
|
|
36
donate.py
36
donate.py
|
@ -37,9 +37,9 @@ def get_donation_url(actor_json: {}) -> str:
|
||||||
continue
|
continue
|
||||||
if '<a href="' not in property_value['value']:
|
if '<a href="' not in property_value['value']:
|
||||||
continue
|
continue
|
||||||
donateUrl = property_value['value'].split('<a href="')[1]
|
donate_url = property_value['value'].split('<a href="')[1]
|
||||||
if '"' in donateUrl:
|
if '"' in donate_url:
|
||||||
return donateUrl.split('"')[0]
|
return donate_url.split('"')[0]
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
|
||||||
|
@ -65,17 +65,17 @@ def get_website(actor_json: {}, translate: {}) -> str:
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
|
||||||
def set_donation_url(actor_json: {}, donateUrl: str) -> None:
|
def set_donation_url(actor_json: {}, donate_url: str) -> None:
|
||||||
"""Sets a link used for donations
|
"""Sets a link used for donations
|
||||||
"""
|
"""
|
||||||
notUrl = False
|
notUrl = False
|
||||||
if '.' not in donateUrl:
|
if '.' not in donate_url:
|
||||||
notUrl = True
|
notUrl = True
|
||||||
if '://' not in donateUrl:
|
if '://' not in donate_url:
|
||||||
notUrl = True
|
notUrl = True
|
||||||
if ' ' in donateUrl:
|
if ' ' in donate_url:
|
||||||
notUrl = True
|
notUrl = True
|
||||||
if '<' in donateUrl:
|
if '<' in donate_url:
|
||||||
notUrl = True
|
notUrl = True
|
||||||
|
|
||||||
if not actor_json.get('attachment'):
|
if not actor_json.get('attachment'):
|
||||||
|
@ -84,7 +84,7 @@ def set_donation_url(actor_json: {}, donateUrl: str) -> None:
|
||||||
donationType = _get_donation_types()
|
donationType = _get_donation_types()
|
||||||
donateName = None
|
donateName = None
|
||||||
for paymentService in donationType:
|
for paymentService in donationType:
|
||||||
if paymentService in donateUrl:
|
if paymentService in donate_url:
|
||||||
donateName = paymentService
|
donateName = paymentService
|
||||||
if not donateName:
|
if not donateName:
|
||||||
return
|
return
|
||||||
|
@ -106,9 +106,9 @@ def set_donation_url(actor_json: {}, donateUrl: str) -> None:
|
||||||
return
|
return
|
||||||
|
|
||||||
donateValue = \
|
donateValue = \
|
||||||
'<a href="' + donateUrl + \
|
'<a href="' + donate_url + \
|
||||||
'" rel="me nofollow noopener noreferrer" target="_blank">' + \
|
'" rel="me nofollow noopener noreferrer" target="_blank">' + \
|
||||||
donateUrl + '</a>'
|
donate_url + '</a>'
|
||||||
|
|
||||||
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'):
|
||||||
|
@ -130,18 +130,18 @@ def set_donation_url(actor_json: {}, donateUrl: str) -> None:
|
||||||
actor_json['attachment'].append(newDonate)
|
actor_json['attachment'].append(newDonate)
|
||||||
|
|
||||||
|
|
||||||
def set_website(actor_json: {}, websiteUrl: str, translate: {}) -> None:
|
def set_website(actor_json: {}, website_url: str, translate: {}) -> None:
|
||||||
"""Sets a web address
|
"""Sets a web address
|
||||||
"""
|
"""
|
||||||
websiteUrl = websiteUrl.strip()
|
website_url = website_url.strip()
|
||||||
notUrl = False
|
notUrl = False
|
||||||
if '.' not in websiteUrl:
|
if '.' not in website_url:
|
||||||
notUrl = True
|
notUrl = True
|
||||||
if '://' not in websiteUrl:
|
if '://' not in website_url:
|
||||||
notUrl = True
|
notUrl = True
|
||||||
if ' ' in websiteUrl:
|
if ' ' in website_url:
|
||||||
notUrl = True
|
notUrl = True
|
||||||
if '<' in websiteUrl:
|
if '<' in website_url:
|
||||||
notUrl = True
|
notUrl = True
|
||||||
|
|
||||||
if not actor_json.get('attachment'):
|
if not actor_json.get('attachment'):
|
||||||
|
@ -169,6 +169,6 @@ def set_website(actor_json: {}, websiteUrl: str, translate: {}) -> None:
|
||||||
newEntry = {
|
newEntry = {
|
||||||
"name": 'Website',
|
"name": 'Website',
|
||||||
"type": "PropertyValue",
|
"type": "PropertyValue",
|
||||||
"value": websiteUrl
|
"value": website_url
|
||||||
}
|
}
|
||||||
actor_json['attachment'].append(newEntry)
|
actor_json['attachment'].append(newEntry)
|
||||||
|
|
18
jami.py
18
jami.py
|
@ -39,22 +39,22 @@ def get_jami_address(actor_json: {}) -> str:
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
|
||||||
def set_jami_address(actor_json: {}, jamiAddress: str) -> None:
|
def set_jami_address(actor_json: {}, jami_address: str) -> None:
|
||||||
"""Sets an jami address for the given actor
|
"""Sets an jami address for the given actor
|
||||||
"""
|
"""
|
||||||
notJamiAddress = False
|
notJamiAddress = False
|
||||||
|
|
||||||
if len(jamiAddress) < 2:
|
if len(jami_address) < 2:
|
||||||
notJamiAddress = True
|
notJamiAddress = True
|
||||||
if '"' in jamiAddress:
|
if '"' in jami_address:
|
||||||
notJamiAddress = True
|
notJamiAddress = True
|
||||||
if ' ' in jamiAddress:
|
if ' ' in jami_address:
|
||||||
notJamiAddress = True
|
notJamiAddress = True
|
||||||
if '.' in jamiAddress:
|
if '.' in jami_address:
|
||||||
notJamiAddress = True
|
notJamiAddress = True
|
||||||
if ',' in jamiAddress:
|
if ',' in jami_address:
|
||||||
notJamiAddress = True
|
notJamiAddress = True
|
||||||
if '<' in jamiAddress:
|
if '<' in jami_address:
|
||||||
notJamiAddress = True
|
notJamiAddress = True
|
||||||
|
|
||||||
if not actor_json.get('attachment'):
|
if not actor_json.get('attachment'):
|
||||||
|
@ -85,12 +85,12 @@ def set_jami_address(actor_json: {}, jamiAddress: str) -> None:
|
||||||
continue
|
continue
|
||||||
if property_value['type'] != 'PropertyValue':
|
if property_value['type'] != 'PropertyValue':
|
||||||
continue
|
continue
|
||||||
property_value['value'] = jamiAddress
|
property_value['value'] = jami_address
|
||||||
return
|
return
|
||||||
|
|
||||||
newJamiAddress = {
|
newJamiAddress = {
|
||||||
"name": "Jami",
|
"name": "Jami",
|
||||||
"type": "PropertyValue",
|
"type": "PropertyValue",
|
||||||
"value": jamiAddress
|
"value": jami_address
|
||||||
}
|
}
|
||||||
actor_json['attachment'].append(newJamiAddress)
|
actor_json['attachment'].append(newJamiAddress)
|
||||||
|
|
18
matrix.py
18
matrix.py
|
@ -36,7 +36,7 @@ def get_matrix_address(actor_json: {}) -> str:
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
|
||||||
def set_matrix_address(actor_json: {}, matrixAddress: str) -> None:
|
def set_matrix_address(actor_json: {}, matrix_address: str) -> None:
|
||||||
"""Sets an matrix address for the given actor
|
"""Sets an matrix address for the given actor
|
||||||
"""
|
"""
|
||||||
if not actor_json.get('attachment'):
|
if not actor_json.get('attachment'):
|
||||||
|
@ -56,17 +56,17 @@ def set_matrix_address(actor_json: {}, matrixAddress: str) -> None:
|
||||||
if propertyFound:
|
if propertyFound:
|
||||||
actor_json['attachment'].remove(propertyFound)
|
actor_json['attachment'].remove(propertyFound)
|
||||||
|
|
||||||
if '@' not in matrixAddress:
|
if '@' not in matrix_address:
|
||||||
return
|
return
|
||||||
if not matrixAddress.startswith('@'):
|
if not matrix_address.startswith('@'):
|
||||||
return
|
return
|
||||||
if '.' not in matrixAddress:
|
if '.' not in matrix_address:
|
||||||
return
|
return
|
||||||
if '"' in matrixAddress:
|
if '"' in matrix_address:
|
||||||
return
|
return
|
||||||
if '<' in matrixAddress:
|
if '<' in matrix_address:
|
||||||
return
|
return
|
||||||
if ':' not in matrixAddress:
|
if ':' not in matrix_address:
|
||||||
return
|
return
|
||||||
|
|
||||||
for property_value in actor_json['attachment']:
|
for property_value in actor_json['attachment']:
|
||||||
|
@ -78,12 +78,12 @@ def set_matrix_address(actor_json: {}, matrixAddress: str) -> None:
|
||||||
continue
|
continue
|
||||||
if property_value['type'] != 'PropertyValue':
|
if property_value['type'] != 'PropertyValue':
|
||||||
continue
|
continue
|
||||||
property_value['value'] = matrixAddress
|
property_value['value'] = matrix_address
|
||||||
return
|
return
|
||||||
|
|
||||||
newMatrixAddress = {
|
newMatrixAddress = {
|
||||||
"name": "Matrix",
|
"name": "Matrix",
|
||||||
"type": "PropertyValue",
|
"type": "PropertyValue",
|
||||||
"value": matrixAddress
|
"value": matrix_address
|
||||||
}
|
}
|
||||||
actor_json['attachment'].append(newMatrixAddress)
|
actor_json['attachment'].append(newMatrixAddress)
|
||||||
|
|
50
pgp.py
50
pgp.py
|
@ -91,17 +91,17 @@ def get_pgp_fingerprint(actor_json: {}) -> str:
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
|
||||||
def set_email_address(actor_json: {}, emailAddress: str) -> None:
|
def set_email_address(actor_json: {}, email_address: str) -> None:
|
||||||
"""Sets the email address for the given actor
|
"""Sets the email address for the given actor
|
||||||
"""
|
"""
|
||||||
notEmailAddress = False
|
notEmailAddress = False
|
||||||
if '@' not in emailAddress:
|
if '@' not in email_address:
|
||||||
notEmailAddress = True
|
notEmailAddress = True
|
||||||
if '.' not in emailAddress:
|
if '.' not in email_address:
|
||||||
notEmailAddress = True
|
notEmailAddress = True
|
||||||
if '<' in emailAddress:
|
if '<' in email_address:
|
||||||
notEmailAddress = True
|
notEmailAddress = True
|
||||||
if emailAddress.startswith('@'):
|
if email_address.startswith('@'):
|
||||||
notEmailAddress = True
|
notEmailAddress = True
|
||||||
|
|
||||||
if not actor_json.get('attachment'):
|
if not actor_json.get('attachment'):
|
||||||
|
@ -132,27 +132,27 @@ def set_email_address(actor_json: {}, emailAddress: str) -> None:
|
||||||
continue
|
continue
|
||||||
if property_value['type'] != 'PropertyValue':
|
if property_value['type'] != 'PropertyValue':
|
||||||
continue
|
continue
|
||||||
property_value['value'] = emailAddress
|
property_value['value'] = email_address
|
||||||
return
|
return
|
||||||
|
|
||||||
newEmailAddress = {
|
newEmailAddress = {
|
||||||
"name": "Email",
|
"name": "Email",
|
||||||
"type": "PropertyValue",
|
"type": "PropertyValue",
|
||||||
"value": emailAddress
|
"value": email_address
|
||||||
}
|
}
|
||||||
actor_json['attachment'].append(newEmailAddress)
|
actor_json['attachment'].append(newEmailAddress)
|
||||||
|
|
||||||
|
|
||||||
def set_pgp_pub_key(actor_json: {}, PGPpubKey: str) -> None:
|
def set_pgp_pub_key(actor_json: {}, pgp_pub_key: str) -> None:
|
||||||
"""Sets a PGP public key for the given actor
|
"""Sets a PGP public key for the given actor
|
||||||
"""
|
"""
|
||||||
removeKey = False
|
removeKey = False
|
||||||
if not PGPpubKey:
|
if not pgp_pub_key:
|
||||||
removeKey = True
|
removeKey = True
|
||||||
else:
|
else:
|
||||||
if not contains_pgp_public_key(PGPpubKey):
|
if not contains_pgp_public_key(pgp_pub_key):
|
||||||
removeKey = True
|
removeKey = True
|
||||||
if '<' in PGPpubKey:
|
if '<' in pgp_pub_key:
|
||||||
removeKey = True
|
removeKey = True
|
||||||
|
|
||||||
if not actor_json.get('attachment'):
|
if not actor_json.get('attachment'):
|
||||||
|
@ -183,15 +183,15 @@ def set_pgp_pub_key(actor_json: {}, PGPpubKey: str) -> None:
|
||||||
continue
|
continue
|
||||||
if property_value['type'] != 'PropertyValue':
|
if property_value['type'] != 'PropertyValue':
|
||||||
continue
|
continue
|
||||||
property_value['value'] = PGPpubKey
|
property_value['value'] = pgp_pub_key
|
||||||
return
|
return
|
||||||
|
|
||||||
newPGPpubKey = {
|
newpgp_pub_key = {
|
||||||
"name": "PGP",
|
"name": "PGP",
|
||||||
"type": "PropertyValue",
|
"type": "PropertyValue",
|
||||||
"value": PGPpubKey
|
"value": pgp_pub_key
|
||||||
}
|
}
|
||||||
actor_json['attachment'].append(newPGPpubKey)
|
actor_json['attachment'].append(newpgp_pub_key)
|
||||||
|
|
||||||
|
|
||||||
def set_pgp_fingerprint(actor_json: {}, fingerprint: str) -> None:
|
def set_pgp_fingerprint(actor_json: {}, fingerprint: str) -> None:
|
||||||
|
@ -235,12 +235,12 @@ def set_pgp_fingerprint(actor_json: {}, fingerprint: str) -> None:
|
||||||
property_value['value'] = fingerprint.strip()
|
property_value['value'] = fingerprint.strip()
|
||||||
return
|
return
|
||||||
|
|
||||||
newPGPfingerprint = {
|
newpgp_fingerprint = {
|
||||||
"name": "OpenPGP",
|
"name": "OpenPGP",
|
||||||
"type": "PropertyValue",
|
"type": "PropertyValue",
|
||||||
"value": fingerprint
|
"value": fingerprint
|
||||||
}
|
}
|
||||||
actor_json['attachment'].append(newPGPfingerprint)
|
actor_json['attachment'].append(newpgp_fingerprint)
|
||||||
|
|
||||||
|
|
||||||
def extract_pgp_public_key(content: str) -> str:
|
def extract_pgp_public_key(content: str) -> str:
|
||||||
|
@ -470,15 +470,15 @@ def pgp_public_key_upload(base_dir: str, session,
|
||||||
if not test:
|
if not test:
|
||||||
if debug:
|
if debug:
|
||||||
print('Getting PGP public key')
|
print('Getting PGP public key')
|
||||||
PGPpubKey = pgp_local_public_key()
|
pgp_pub_key = pgp_local_public_key()
|
||||||
if not PGPpubKey:
|
if not pgp_pub_key:
|
||||||
return None
|
return None
|
||||||
PGPpubKeyId = _pgp_local_public_key_id()
|
pgp_pub_keyId = _pgp_local_public_key_id()
|
||||||
else:
|
else:
|
||||||
if debug:
|
if debug:
|
||||||
print('Testing with PGP public key ' + test)
|
print('Testing with PGP public key ' + test)
|
||||||
PGPpubKey = test
|
pgp_pub_key = test
|
||||||
PGPpubKeyId = None
|
pgp_pub_keyId = None
|
||||||
|
|
||||||
domain_full = get_full_domain(domain, port)
|
domain_full = get_full_domain(domain, port)
|
||||||
if debug:
|
if debug:
|
||||||
|
@ -531,15 +531,15 @@ def pgp_public_key_upload(base_dir: str, session,
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# set the pgp details
|
# set the pgp details
|
||||||
if PGPpubKeyId:
|
if pgp_pub_keyId:
|
||||||
set_pgp_fingerprint(actor_json, PGPpubKeyId)
|
set_pgp_fingerprint(actor_json, pgp_pub_keyId)
|
||||||
else:
|
else:
|
||||||
if debug:
|
if debug:
|
||||||
print('No PGP key Id. Continuing anyway.')
|
print('No PGP key Id. Continuing anyway.')
|
||||||
|
|
||||||
if debug:
|
if debug:
|
||||||
print('Setting PGP key within ' + actor)
|
print('Setting PGP key within ' + actor)
|
||||||
set_pgp_pub_key(actor_json, PGPpubKey)
|
set_pgp_pub_key(actor_json, pgp_pub_key)
|
||||||
|
|
||||||
# create an actor update
|
# create an actor update
|
||||||
statusNumber, published = get_status_number()
|
statusNumber, published = get_status_number()
|
||||||
|
|
18
ssb.py
18
ssb.py
|
@ -39,21 +39,21 @@ def get_ssb_address(actor_json: {}) -> str:
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
|
||||||
def set_ssb_address(actor_json: {}, ssbAddress: str) -> None:
|
def set_ssb_address(actor_json: {}, ssb_address: str) -> None:
|
||||||
"""Sets an ssb address for the given actor
|
"""Sets an ssb address for the given actor
|
||||||
"""
|
"""
|
||||||
notSSBAddress = False
|
notSSBAddress = False
|
||||||
if not ssbAddress.startswith('@'):
|
if not ssb_address.startswith('@'):
|
||||||
notSSBAddress = True
|
notSSBAddress = True
|
||||||
if '=.' not in ssbAddress:
|
if '=.' not in ssb_address:
|
||||||
notSSBAddress = True
|
notSSBAddress = True
|
||||||
if '"' in ssbAddress:
|
if '"' in ssb_address:
|
||||||
notSSBAddress = True
|
notSSBAddress = True
|
||||||
if ' ' in ssbAddress:
|
if ' ' in ssb_address:
|
||||||
notSSBAddress = True
|
notSSBAddress = True
|
||||||
if ',' in ssbAddress:
|
if ',' in ssb_address:
|
||||||
notSSBAddress = True
|
notSSBAddress = True
|
||||||
if '<' in ssbAddress:
|
if '<' in ssb_address:
|
||||||
notSSBAddress = True
|
notSSBAddress = True
|
||||||
|
|
||||||
if not actor_json.get('attachment'):
|
if not actor_json.get('attachment'):
|
||||||
|
@ -84,12 +84,12 @@ def set_ssb_address(actor_json: {}, ssbAddress: str) -> None:
|
||||||
continue
|
continue
|
||||||
if property_value['type'] != 'PropertyValue':
|
if property_value['type'] != 'PropertyValue':
|
||||||
continue
|
continue
|
||||||
property_value['value'] = ssbAddress
|
property_value['value'] = ssb_address
|
||||||
return
|
return
|
||||||
|
|
||||||
newSSBAddress = {
|
newSSBAddress = {
|
||||||
"name": "SSB",
|
"name": "SSB",
|
||||||
"type": "PropertyValue",
|
"type": "PropertyValue",
|
||||||
"value": ssbAddress
|
"value": ssb_address
|
||||||
}
|
}
|
||||||
actor_json['attachment'].append(newSSBAddress)
|
actor_json['attachment'].append(newSSBAddress)
|
||||||
|
|
20
tox.py
20
tox.py
|
@ -41,24 +41,24 @@ def get_tox_address(actor_json: {}) -> str:
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
|
||||||
def set_tox_address(actor_json: {}, toxAddress: str) -> None:
|
def set_tox_address(actor_json: {}, tox_address: str) -> None:
|
||||||
"""Sets an tox address for the given actor
|
"""Sets an tox address for the given actor
|
||||||
"""
|
"""
|
||||||
notToxAddress = False
|
notToxAddress = False
|
||||||
|
|
||||||
if len(toxAddress) != 76:
|
if len(tox_address) != 76:
|
||||||
notToxAddress = True
|
notToxAddress = True
|
||||||
if toxAddress.upper() != toxAddress:
|
if tox_address.upper() != tox_address:
|
||||||
notToxAddress = True
|
notToxAddress = True
|
||||||
if '"' in toxAddress:
|
if '"' in tox_address:
|
||||||
notToxAddress = True
|
notToxAddress = True
|
||||||
if ' ' in toxAddress:
|
if ' ' in tox_address:
|
||||||
notToxAddress = True
|
notToxAddress = True
|
||||||
if '.' in toxAddress:
|
if '.' in tox_address:
|
||||||
notToxAddress = True
|
notToxAddress = True
|
||||||
if ',' in toxAddress:
|
if ',' in tox_address:
|
||||||
notToxAddress = True
|
notToxAddress = True
|
||||||
if '<' in toxAddress:
|
if '<' in tox_address:
|
||||||
notToxAddress = True
|
notToxAddress = True
|
||||||
|
|
||||||
if not actor_json.get('attachment'):
|
if not actor_json.get('attachment'):
|
||||||
|
@ -89,12 +89,12 @@ def set_tox_address(actor_json: {}, toxAddress: str) -> None:
|
||||||
continue
|
continue
|
||||||
if property_value['type'] != 'PropertyValue':
|
if property_value['type'] != 'PropertyValue':
|
||||||
continue
|
continue
|
||||||
property_value['value'] = toxAddress
|
property_value['value'] = tox_address
|
||||||
return
|
return
|
||||||
|
|
||||||
newToxAddress = {
|
newToxAddress = {
|
||||||
"name": "Tox",
|
"name": "Tox",
|
||||||
"type": "PropertyValue",
|
"type": "PropertyValue",
|
||||||
"value": toxAddress
|
"value": tox_address
|
||||||
}
|
}
|
||||||
actor_json['attachment'].append(newToxAddress)
|
actor_json['attachment'].append(newToxAddress)
|
||||||
|
|
|
@ -39,20 +39,20 @@ def html_person_options(defaultTimeline: str,
|
||||||
optionsProfileUrl: str,
|
optionsProfileUrl: str,
|
||||||
optionsLink: str,
|
optionsLink: str,
|
||||||
pageNumber: int,
|
pageNumber: int,
|
||||||
donateUrl: str,
|
donate_url: str,
|
||||||
webAddress: str,
|
webAddress: str,
|
||||||
xmppAddress: str,
|
xmpp_address: str,
|
||||||
matrixAddress: str,
|
matrix_address: str,
|
||||||
ssbAddress: str,
|
ssb_address: str,
|
||||||
blogAddress: str,
|
blog_address: str,
|
||||||
toxAddress: str,
|
tox_address: str,
|
||||||
briarAddress: str,
|
briar_address: str,
|
||||||
jamiAddress: str,
|
jami_address: str,
|
||||||
cwtch_address: str,
|
cwtch_address: str,
|
||||||
EnigmaPubKey: str,
|
enigma_pub_key: str,
|
||||||
PGPpubKey: str,
|
pgp_pub_key: str,
|
||||||
PGPfingerprint: str,
|
pgp_fingerprint: str,
|
||||||
emailAddress: str,
|
email_address: str,
|
||||||
dormant_months: int,
|
dormant_months: int,
|
||||||
backToPath: str,
|
backToPath: str,
|
||||||
lockedAccount: bool,
|
lockedAccount: bool,
|
||||||
|
@ -122,9 +122,9 @@ def html_person_options(defaultTimeline: str,
|
||||||
snoozeButtonStr = 'Unsnooze'
|
snoozeButtonStr = 'Unsnooze'
|
||||||
|
|
||||||
donateStr = ''
|
donateStr = ''
|
||||||
if donateUrl:
|
if donate_url:
|
||||||
donateStr = \
|
donateStr = \
|
||||||
' <a href="' + donateUrl + \
|
' <a href="' + donate_url + \
|
||||||
' tabindex="-1""><button class="button" name="submitDonate">' + \
|
' tabindex="-1""><button class="button" name="submitDonate">' + \
|
||||||
translate['Donate'] + '</button></a>\n'
|
translate['Donate'] + '</button></a>\n'
|
||||||
|
|
||||||
|
@ -188,55 +188,56 @@ def html_person_options(defaultTimeline: str,
|
||||||
otherAccountsHtml += '</p>\n'
|
otherAccountsHtml += '</p>\n'
|
||||||
if ctr > 0:
|
if ctr > 0:
|
||||||
optionsStr += otherAccountsHtml
|
optionsStr += otherAccountsHtml
|
||||||
if emailAddress:
|
if email_address:
|
||||||
optionsStr += \
|
optionsStr += \
|
||||||
'<p class="imText">' + translate['Email'] + \
|
'<p class="imText">' + translate['Email'] + \
|
||||||
': <a href="mailto:' + \
|
': <a href="mailto:' + \
|
||||||
emailAddress + '">' + remove_html(emailAddress) + '</a></p>\n'
|
email_address + '">' + remove_html(email_address) + '</a></p>\n'
|
||||||
if xmppAddress:
|
if xmpp_address:
|
||||||
optionsStr += \
|
optionsStr += \
|
||||||
'<p class="imText">' + translate['XMPP'] + \
|
'<p class="imText">' + translate['XMPP'] + \
|
||||||
': <a href="xmpp:' + remove_html(xmppAddress) + '">' + \
|
': <a href="xmpp:' + remove_html(xmpp_address) + '">' + \
|
||||||
xmppAddress + '</a></p>\n'
|
xmpp_address + '</a></p>\n'
|
||||||
if matrixAddress:
|
if matrix_address:
|
||||||
optionsStr += \
|
optionsStr += \
|
||||||
'<p class="imText">' + translate['Matrix'] + ': ' + \
|
'<p class="imText">' + translate['Matrix'] + ': ' + \
|
||||||
remove_html(matrixAddress) + '</p>\n'
|
remove_html(matrix_address) + '</p>\n'
|
||||||
if ssbAddress:
|
if ssb_address:
|
||||||
optionsStr += \
|
optionsStr += \
|
||||||
'<p class="imText">SSB: ' + remove_html(ssbAddress) + '</p>\n'
|
'<p class="imText">SSB: ' + remove_html(ssb_address) + '</p>\n'
|
||||||
if blogAddress:
|
if blog_address:
|
||||||
optionsStr += \
|
optionsStr += \
|
||||||
'<p class="imText">Blog: <a href="' + \
|
'<p class="imText">Blog: <a href="' + \
|
||||||
remove_html(blogAddress) + '">' + \
|
remove_html(blog_address) + '">' + \
|
||||||
remove_html(blogAddress) + '</a></p>\n'
|
remove_html(blog_address) + '</a></p>\n'
|
||||||
if toxAddress:
|
if tox_address:
|
||||||
optionsStr += \
|
optionsStr += \
|
||||||
'<p class="imText">Tox: ' + remove_html(toxAddress) + '</p>\n'
|
'<p class="imText">Tox: ' + remove_html(tox_address) + '</p>\n'
|
||||||
if briarAddress:
|
if briar_address:
|
||||||
if briarAddress.startswith('briar://'):
|
if briar_address.startswith('briar://'):
|
||||||
optionsStr += \
|
optionsStr += \
|
||||||
'<p class="imText">' + \
|
'<p class="imText">' + \
|
||||||
remove_html(briarAddress) + '</p>\n'
|
remove_html(briar_address) + '</p>\n'
|
||||||
else:
|
else:
|
||||||
optionsStr += \
|
optionsStr += \
|
||||||
'<p class="imText">briar://' + \
|
'<p class="imText">briar://' + \
|
||||||
remove_html(briarAddress) + '</p>\n'
|
remove_html(briar_address) + '</p>\n'
|
||||||
if jamiAddress:
|
if jami_address:
|
||||||
optionsStr += \
|
optionsStr += \
|
||||||
'<p class="imText">Jami: ' + remove_html(jamiAddress) + '</p>\n'
|
'<p class="imText">Jami: ' + remove_html(jami_address) + '</p>\n'
|
||||||
if cwtch_address:
|
if cwtch_address:
|
||||||
optionsStr += \
|
optionsStr += \
|
||||||
'<p class="imText">Cwtch: ' + remove_html(cwtch_address) + '</p>\n'
|
'<p class="imText">Cwtch: ' + remove_html(cwtch_address) + '</p>\n'
|
||||||
if EnigmaPubKey:
|
if enigma_pub_key:
|
||||||
optionsStr += \
|
optionsStr += \
|
||||||
'<p class="imText">Enigma: ' + remove_html(EnigmaPubKey) + '</p>\n'
|
'<p class="imText">Enigma: ' + \
|
||||||
if PGPfingerprint:
|
remove_html(enigma_pub_key) + '</p>\n'
|
||||||
|
if pgp_fingerprint:
|
||||||
optionsStr += '<p class="pgp">PGP: ' + \
|
optionsStr += '<p class="pgp">PGP: ' + \
|
||||||
remove_html(PGPfingerprint).replace('\n', '<br>') + '</p>\n'
|
remove_html(pgp_fingerprint).replace('\n', '<br>') + '</p>\n'
|
||||||
if PGPpubKey:
|
if pgp_pub_key:
|
||||||
optionsStr += '<p class="pgp">' + \
|
optionsStr += '<p class="pgp">' + \
|
||||||
remove_html(PGPpubKey).replace('\n', '<br>') + '</p>\n'
|
remove_html(pgp_pub_key).replace('\n', '<br>') + '</p>\n'
|
||||||
optionsStr += ' <form method="POST" action="' + \
|
optionsStr += ' <form method="POST" action="' + \
|
||||||
originPathStr + '/personoptions">\n'
|
originPathStr + '/personoptions">\n'
|
||||||
optionsStr += ' <input type="hidden" name="pageNumber" value="' + \
|
optionsStr += ' <input type="hidden" name="pageNumber" value="' + \
|
||||||
|
|
|
@ -229,10 +229,10 @@ def _set_actor_property_url(actor_json: {},
|
||||||
actor_json['attachment'].append(newAddress)
|
actor_json['attachment'].append(newAddress)
|
||||||
|
|
||||||
|
|
||||||
def set_blog_address(actor_json: {}, blogAddress: str) -> None:
|
def set_blog_address(actor_json: {}, blog_address: str) -> None:
|
||||||
"""Sets an blog address for the given actor
|
"""Sets an blog address for the given actor
|
||||||
"""
|
"""
|
||||||
_set_actor_property_url(actor_json, 'Blog', remove_html(blogAddress))
|
_set_actor_property_url(actor_json, 'Blog', remove_html(blog_address))
|
||||||
|
|
||||||
|
|
||||||
def update_avatar_image_cache(signing_priv_key_pem: str,
|
def update_avatar_image_cache(signing_priv_key_pem: str,
|
||||||
|
|
14
xmpp.py
14
xmpp.py
|
@ -34,17 +34,17 @@ def get_xmpp_address(actor_json: {}) -> str:
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
|
||||||
def set_xmpp_address(actor_json: {}, xmppAddress: str) -> None:
|
def set_xmpp_address(actor_json: {}, xmpp_address: str) -> None:
|
||||||
"""Sets an xmpp address for the given actor
|
"""Sets an xmpp address for the given actor
|
||||||
"""
|
"""
|
||||||
notXmppAddress = False
|
notXmppAddress = False
|
||||||
if '@' not in xmppAddress:
|
if '@' not in xmpp_address:
|
||||||
notXmppAddress = True
|
notXmppAddress = True
|
||||||
if '.' not in xmppAddress:
|
if '.' not in xmpp_address:
|
||||||
notXmppAddress = True
|
notXmppAddress = True
|
||||||
if '"' in xmppAddress:
|
if '"' in xmpp_address:
|
||||||
notXmppAddress = True
|
notXmppAddress = True
|
||||||
if '<' in xmppAddress:
|
if '<' in xmpp_address:
|
||||||
notXmppAddress = True
|
notXmppAddress = True
|
||||||
|
|
||||||
if not actor_json.get('attachment'):
|
if not actor_json.get('attachment'):
|
||||||
|
@ -78,12 +78,12 @@ def set_xmpp_address(actor_json: {}, xmppAddress: str) -> None:
|
||||||
continue
|
continue
|
||||||
if property_value['type'] != 'PropertyValue':
|
if property_value['type'] != 'PropertyValue':
|
||||||
continue
|
continue
|
||||||
property_value['value'] = xmppAddress
|
property_value['value'] = xmpp_address
|
||||||
return
|
return
|
||||||
|
|
||||||
newXmppAddress = {
|
newXmppAddress = {
|
||||||
"name": "XMPP",
|
"name": "XMPP",
|
||||||
"type": "PropertyValue",
|
"type": "PropertyValue",
|
||||||
"value": xmppAddress
|
"value": xmpp_address
|
||||||
}
|
}
|
||||||
actor_json['attachment'].append(newXmppAddress)
|
actor_json['attachment'].append(newXmppAddress)
|
||||||
|
|
Loading…
Reference in New Issue