mirror of https://gitlab.com/bashrc2/epicyon
Remove donation url if invalid
parent
d203262084
commit
be39532262
10
donate.py
10
donate.py
|
@ -41,6 +41,14 @@ def getDonationUrl(actorJson: {}) -> str:
|
||||||
def setDonationUrl(actorJson: {}, donateUrl: str) -> None:
|
def setDonationUrl(actorJson: {}, donateUrl: str) -> None:
|
||||||
"""Sets a link used for donations
|
"""Sets a link used for donations
|
||||||
"""
|
"""
|
||||||
|
notUrl = False
|
||||||
|
if '.' not in donateUrl:
|
||||||
|
notUrl = True
|
||||||
|
if '://' not in donateUrl:
|
||||||
|
notUrl = True
|
||||||
|
if ' ' in donateUrl:
|
||||||
|
notUrl = True
|
||||||
|
|
||||||
if not actorJson.get('attachment'):
|
if not actorJson.get('attachment'):
|
||||||
actorJson['attachment'] = []
|
actorJson['attachment'] = []
|
||||||
|
|
||||||
|
@ -65,6 +73,8 @@ def setDonationUrl(actorJson: {}, donateUrl: str) -> None:
|
||||||
break
|
break
|
||||||
if propertyFound:
|
if propertyFound:
|
||||||
actorJson['attachment'].remove(propertyFound)
|
actorJson['attachment'].remove(propertyFound)
|
||||||
|
if notUrl:
|
||||||
|
return
|
||||||
|
|
||||||
donateValue = \
|
donateValue = \
|
||||||
'<a href="' + donateUrl + \
|
'<a href="' + donateUrl + \
|
||||||
|
|
Loading…
Reference in New Issue