mirror of https://gitlab.com/bashrc2/epicyon
Removing existing values from profile
parent
29d0a8dcc6
commit
4594a92508
14
donate.py
14
donate.py
|
@ -51,6 +51,20 @@ def setDonationUrl(actorJson: {},donateUrl: str) -> None:
|
|||
if not donateName:
|
||||
return
|
||||
|
||||
# remove any existing value
|
||||
propertyFound=None
|
||||
for propertyValue in actorJson['attachment']:
|
||||
if not propertyValue.get('name'):
|
||||
continue
|
||||
if not propertyValue.get('type'):
|
||||
continue
|
||||
if not propertyValue['name'].lower()!=donateName:
|
||||
continue
|
||||
propertyFound=propertyValue
|
||||
break
|
||||
if propertyFound:
|
||||
actorJson['attachment'].remove(propertyFound)
|
||||
|
||||
donateValue='<a href="'+donateUrl+'" rel="me nofollow noopener noreferrer" target="_blank">'+donateUrl+'</a>'
|
||||
|
||||
for propertyValue in actorJson['attachment']:
|
||||
|
|
14
matrix.py
14
matrix.py
|
@ -41,6 +41,20 @@ def setMatrixAddress(actorJson: {},matrixAddress: str) -> None:
|
|||
if not actorJson.get('attachment'):
|
||||
actorJson['attachment']=[]
|
||||
|
||||
# remove any existing value
|
||||
propertyFound=None
|
||||
for propertyValue in actorJson['attachment']:
|
||||
if not propertyValue.get('name'):
|
||||
continue
|
||||
if not propertyValue.get('type'):
|
||||
continue
|
||||
if not propertyValue['name'].lower().startswith('matrix'):
|
||||
continue
|
||||
propertyFound=propertyValue
|
||||
break
|
||||
if propertyFound:
|
||||
actorJson['attachment'].remove(propertyFound)
|
||||
|
||||
if '@' not in matrixAddress:
|
||||
return
|
||||
if not matrixAddress.startswith('@'):
|
||||
|
|
28
pgp.py
28
pgp.py
|
@ -58,6 +58,20 @@ def setEmailAddress(actorJson: {},emailAddress: str) -> None:
|
|||
if not actorJson.get('attachment'):
|
||||
actorJson['attachment']=[]
|
||||
|
||||
# remove any existing value
|
||||
propertyFound=None
|
||||
for propertyValue in actorJson['attachment']:
|
||||
if not propertyValue.get('name'):
|
||||
continue
|
||||
if not propertyValue.get('type'):
|
||||
continue
|
||||
if not propertyValue['name'].lower().startswith('email'):
|
||||
continue
|
||||
propertyFound=propertyValue
|
||||
break
|
||||
if propertyFound:
|
||||
actorJson['attachment'].remove(propertyFound)
|
||||
|
||||
if '@' not in emailAddress:
|
||||
return
|
||||
if '.' not in emailAddress:
|
||||
|
@ -90,6 +104,20 @@ def setPGPpubKey(actorJson: {},PGPpubKey: str) -> None:
|
|||
if not actorJson.get('attachment'):
|
||||
actorJson['attachment']=[]
|
||||
|
||||
# remove any existing value
|
||||
propertyFound=None
|
||||
for propertyValue in actorJson['attachment']:
|
||||
if not propertyValue.get('name'):
|
||||
continue
|
||||
if not propertyValue.get('type'):
|
||||
continue
|
||||
if not propertyValue['name'].lower().startswith('pgp'):
|
||||
continue
|
||||
propertyFound=propertyValue
|
||||
break
|
||||
if propertyFound:
|
||||
actorJson['attachment'].remove(propertyValue)
|
||||
|
||||
if '--BEGIN PGP PUBLIC KEY' not in PGPpubKey:
|
||||
return
|
||||
|
||||
|
|
15
xmpp.py
15
xmpp.py
|
@ -39,6 +39,21 @@ def setXmppAddress(actorJson: {},xmppAddress: str) -> None:
|
|||
if not actorJson.get('attachment'):
|
||||
actorJson['attachment']=[]
|
||||
|
||||
# remove any existing value
|
||||
propertyFound=None
|
||||
for propertyValue in actorJson['attachment']:
|
||||
if not propertyValue.get('name'):
|
||||
continue
|
||||
if not propertyValue.get('type'):
|
||||
continue
|
||||
if not (propertyValue['name'].lower().startswith('xmpp') or \
|
||||
propertyValue['name'].lower().startswith('jabber')):
|
||||
continue
|
||||
propertyFound=propertyValue
|
||||
break
|
||||
if propertyFound:
|
||||
actorJson['attachment'].remove(propertyFound)
|
||||
|
||||
if '@' not in xmppAddress:
|
||||
return
|
||||
if '.' not in xmppAddress:
|
||||
|
|
Loading…
Reference in New Issue