Merge pull request #107 from zeronet-conservancy/advanceddonations

advanced site donations: custom, btc, xmr
This commit is contained in:
caryoscelus 2022-06-09 11:18:34 +00:00 committed by GitHub
commit ea8bc2f373
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 7 deletions

View file

@ -1,5 +1,6 @@
### zeronet-conservancy 0.7.5+
maintainers: @caryoscelus, @d4708, @FraYoshi, @prtngn
- introduce multiple donations methods (@caryoscelus)
- easier termux startup script (@unmanbearpig)
- Brazilian Portuguese readme translation (@iFallenHunt)
- reduce fingerprinting information (@caryoscelus)

View file

@ -434,15 +434,41 @@ class UiWebsocketPlugin(object):
</div>
</li>
"""))
donate_key = site.content_manager.contents.get("content.json", {}).get("donate", None)
if type(donate_key) is str and len(donate_key) > 0:
donate_generic = site.content_manager.contents.get("content.json", {}).get("donate", None) or site.content_manager.contents.get("content.json", {}).get("donate-generic", None)
donate_btc = site.content_manager.contents.get("content.json", {}).get("donate-btc", None)
donate_xmr = site.content_manager.contents.get("content.json", {}).get("donate-xmr", None)
donate_enabled = bool(donate_generic or donate_btc or donate_xmr)
if donate_enabled:
body.append(_("""
<li>
<label>{_[Donate]}</label><br>
<div class='flex'>
{donate_key}
<a href='bitcoin:{donate_key}' class='button' id='button-donate'>{_[Donate]}</a>
</div>
<label>{_[Donate]}</label><br>
"""))
if donate_generic:
body.append(_("""
<div class='flex'>
{donate_generic}
</div>
"""))
if donate_btc:
body.append(_("""
<div class='flex'>
<span style="font-size:90%">{donate_btc}</span><br/>
</div>
<div class='flex'>
<a href='bitcoin:{donate_btc}' class='button'>{_[Donate BTC]}</a>
</div>
"""))
if donate_xmr:
body.append(_("""
<div class='flex'>
<span style="font-size:90%">{donate_key}</span><br/>
</div>
<div class='flex'>
<a href='monero:{donate_xmr}' class='button'>{_[Donate Monero]}</a>
</div>
"""))
if donate_enabled:
body.append(_("""
</li>
"""))