mirror of https://gitlab.com/bashrc2/epicyon
Better handling of donation types
parent
d9f126e2ac
commit
a66522cd2e
26
person.py
26
person.py
|
@ -838,7 +838,9 @@ def personUnsnooze(baseDir: str,nickname: str,domain: str,snoozeActor: str) -> N
|
||||||
|
|
||||||
|
|
||||||
def getDonationTypes() -> str:
|
def getDonationTypes() -> str:
|
||||||
return ('patreon','paypal','gofundme','liberapay','kickstarter','indiegogo','crowdsupply')
|
return ('patreon','paypal','gofundme','liberapay', \
|
||||||
|
'kickstarter','indiegogo','crowdsupply', \
|
||||||
|
'subscribestar')
|
||||||
|
|
||||||
def getDonationUrl(actorJson: {}) -> str:
|
def getDonationUrl(actorJson: {}) -> str:
|
||||||
"""Returns a link used for donations
|
"""Returns a link used for donations
|
||||||
|
@ -870,22 +872,12 @@ def setDonationUrl(actorJson: {},donateUrl: str) -> None:
|
||||||
if not actorJson.get('attachment'):
|
if not actorJson.get('attachment'):
|
||||||
actorJson['attachment']=[]
|
actorJson['attachment']=[]
|
||||||
|
|
||||||
|
donationType=getDonationTypes()
|
||||||
donateName=None
|
donateName=None
|
||||||
if 'patreon' in donateUrl:
|
for paymentService in donationType:
|
||||||
donateName='Patreon'
|
if paymentService in donateUrl:
|
||||||
elif 'gofundme' in donateUrl:
|
donateName=paymentService
|
||||||
donateName='GoFundMe'
|
if not donateName:
|
||||||
elif 'liberapay' in donateUrl:
|
|
||||||
donateName='LiberaPay'
|
|
||||||
elif 'paypal' in donateUrl:
|
|
||||||
donateName='PayPal'
|
|
||||||
elif 'kickstarter' in donateUrl:
|
|
||||||
donateName='Kickstarter'
|
|
||||||
elif 'indiegogo' in donateUrl:
|
|
||||||
donateName='IndieGoGo'
|
|
||||||
elif 'crowdsupply' in donateUrl:
|
|
||||||
donateName='CrowdSupply'
|
|
||||||
else:
|
|
||||||
return
|
return
|
||||||
|
|
||||||
donateValue='<a href="'+donateUrl+'" rel="me nofollow noopener noreferrer" target="_blank">'+donateUrl+'</a>'
|
donateValue='<a href="'+donateUrl+'" rel="me nofollow noopener noreferrer" target="_blank">'+donateUrl+'</a>'
|
||||||
|
@ -895,7 +887,7 @@ def setDonationUrl(actorJson: {},donateUrl: str) -> None:
|
||||||
continue
|
continue
|
||||||
if not propertyValue.get('type'):
|
if not propertyValue.get('type'):
|
||||||
continue
|
continue
|
||||||
if propertyValue['name']!=donateName:
|
if propertyValue['name'].lower()!=donateName:
|
||||||
continue
|
continue
|
||||||
if propertyValue['type']!='PropertyValue':
|
if propertyValue['type']!='PropertyValue':
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in New Issue