Donate button

main2
Bob Mottram 2019-11-06 23:20:00 +00:00
parent 78b1ec3eab
commit 005ff4b106
16 changed files with 43 additions and 17 deletions

View File

@ -139,6 +139,7 @@ from announce import outboxAnnounce
from content import addHtmlTags
from media import removeMetaData
from cache import storePersonInCache
from cache import getPersonFromCache
from httpsig import verifyPostHeaders
import os
import sys
@ -770,6 +771,10 @@ class PubServer(BaseHTTPRequestHandler):
optionsLink=None
if len(optionsList)>3:
optionsLink=optionsList[3]
donateUrl=None
actorJson=getPersonFromCache(self.server.baseDir,optionsActor,self.server.personCache)
if actorJson:
donateUrl=getDonationUrl(actorJson)
msg=htmlPersonOptions(self.server.translate, \
self.server.baseDir, \
self.server.domain, \
@ -777,7 +782,7 @@ class PubServer(BaseHTTPRequestHandler):
optionsActor, \
optionsProfileUrl, \
optionsLink, \
pageNumber).encode()
pageNumber,donateUrl).encode()
self._set_headers('text/html',len(msg),cookie)
self._write(msg)
self.server.GETbusy=False

View File

@ -170,5 +170,6 @@
"Deactivate this account": "Deactivate this account",
"Snooze": "Snooze",
"Unsnooze": "Unsnooze",
"Donations link": "Donations link"
"Donations link": "Donations link",
"Donate": "Donate"
}

View File

@ -170,5 +170,6 @@
"Deactivate this account": "Deactivate this account",
"Snooze": "Snooze",
"Unsnooze": "Unsnooze",
"Donations link": "Donations link"
"Donations link": "Donations link",
"Donate": "Donate"
}

View File

@ -170,5 +170,6 @@
"Deactivate this account": "Deactivate this account",
"Snooze": "Snooze",
"Unsnooze": "Unsnooze",
"Donations link": "Donations link"
"Donations link": "Donations link",
"Donate": "Donate"
}

View File

@ -170,5 +170,6 @@
"Deactivate this account": "Deactivate this account",
"Snooze": "Snooze",
"Unsnooze": "Unsnooze",
"Donations link": "Donations link"
"Donations link": "Donations link",
"Donate": "Donate"
}

View File

@ -170,5 +170,6 @@
"Deactivate this account": "Deactivate this account",
"Snooze": "Snooze",
"Unsnooze": "Unsnooze",
"Donations link": "Donations link"
"Donations link": "Donations link",
"Donate": "Donate"
}

View File

@ -170,5 +170,6 @@
"Deactivate this account": "Deactivate this account",
"Snooze": "Snooze",
"Unsnooze": "Unsnooze",
"Donations link": "Donations link"
"Donations link": "Donations link",
"Donate": "Donate"
}

View File

@ -170,5 +170,6 @@
"Deactivate this account": "Deactivate this account",
"Snooze": "Snooze",
"Unsnooze": "Unsnooze",
"Donations link": "Donations link"
"Donations link": "Donations link",
"Donate": "Donate"
}

View File

@ -170,5 +170,6 @@
"Deactivate this account": "Deactivate this account",
"Snooze": "Snooze",
"Unsnooze": "Unsnooze",
"Donations link": "Donations link"
"Donations link": "Donations link",
"Donate": "Donate"
}

View File

@ -170,5 +170,6 @@
"Deactivate this account": "Deactivate this account",
"Snooze": "Snooze",
"Unsnooze": "Unsnooze",
"Donations link": "Donations link"
"Donations link": "Donations link",
"Donate": "Donate"
}

View File

@ -170,5 +170,6 @@
"Deactivate this account": "Deactivate this account",
"Snooze": "Snooze",
"Unsnooze": "Unsnooze",
"Donations link": "Donations link"
"Donations link": "Donations link",
"Donate": "Donate"
}

View File

@ -170,5 +170,6 @@
"Deactivate this account": "Deactivate this account",
"Snooze": "Snooze",
"Unsnooze": "Unsnooze",
"Donations link": "Donations link"
"Donations link": "Donations link",
"Donate": "Donate"
}

View File

@ -170,5 +170,6 @@
"Deactivate this account": "Deactivate this account",
"Snooze": "Snooze",
"Unsnooze": "Unsnooze",
"Donations link": "Donations link"
"Donations link": "Donations link",
"Donate": "Donate"
}

View File

@ -170,5 +170,6 @@
"Deactivate this account": "Deactivate this account",
"Snooze": "Snooze",
"Unsnooze": "Unsnooze",
"Donations link": "Donations link"
"Donations link": "Donations link",
"Donate": "Donate"
}

View File

@ -170,5 +170,6 @@
"Deactivate this account": "Deactivate this account",
"Snooze": "Snooze",
"Unsnooze": "Unsnooze",
"Donations link": "Donations link"
"Donations link": "Donations link",
"Donate": "Donate"
}

View File

@ -2836,7 +2836,8 @@ def htmlPersonOptions(translate: {},baseDir: str, \
optionsActor: str, \
optionsProfileUrl: str, \
optionsLink: str, \
pageNumber: int) -> str:
pageNumber: int,
donateUrl: str) -> str:
"""Show options for a person: view/follow/block/report
"""
optionsDomain,optionsPort=getDomainFromActor(optionsActor)
@ -2881,6 +2882,11 @@ def htmlPersonOptions(translate: {},baseDir: str, \
if isPersonSnoozed(baseDir,nickname,domain,optionsActor):
snoozeButtonStr='Unsnooze'
donateStr=''
if donateUrl:
donateStr= \
' <a href="'+donateUrl+'"><button class="button" name="submitDonate">'+translate['Donate']+'</button></a>'
optionsStr=htmlHeader(cssFilename,profileStyle)
optionsStr+='<div class="options">'
optionsStr+=' <div class="optionsAvatar">'
@ -2894,7 +2900,8 @@ def htmlPersonOptions(translate: {},baseDir: str, \
' <input type="hidden" name="actor" value="'+optionsActor+'">' \
' <input type="hidden" name="avatarUrl" value="'+optionsProfileUrl+'">'+ \
optionsLinkStr+ \
' <button type="submit" class="button" name="submitView">'+translate['View']+'</button>' \
' <button type="submit" class="button" name="submitView">'+translate['View']+'</button>'+ \
donateStr+ \
' <button type="submit" class="button" name="submit'+followStr+'">'+translate[followStr]+'</button>' \
' <button type="submit" class="button" name="submit'+blockStr+'">'+translate[blockStr]+'</button>' \
' <button type="submit" class="button" name="submitDM">'+translate['DM']+'</button>'+ \