mirror of
https://codeberg.org/pluja/kycnot.me
synced 2025-10-13 02:51:02 -04:00
auto-generate qrcodes
This commit is contained in:
parent
b2fd7cd33f
commit
6d4a08f337
2 changed files with 21 additions and 2 deletions
21
kycnot.py
21
kycnot.py
|
@ -13,7 +13,7 @@ from random import randrange
|
||||||
import json
|
import json
|
||||||
import datetime
|
import datetime
|
||||||
import os.path
|
import os.path
|
||||||
#import qrcode
|
import qrcode
|
||||||
import httpx
|
import httpx
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
@ -53,13 +53,30 @@ async def services(request):
|
||||||
title="KYC? Not me!",
|
title="KYC? Not me!",
|
||||||
subtitle="Find best <strong>NON-KYC</strong> online services."))
|
subtitle="Find best <strong>NON-KYC</strong> online services."))
|
||||||
|
|
||||||
|
|
||||||
@app.route("/about", name="about")
|
@app.route("/about", name="about")
|
||||||
async def about(request):
|
async def about(request):
|
||||||
template = env.get_template('about.html')
|
template = env.get_template('about.html')
|
||||||
r = httpx.get(
|
r = httpx.get(
|
||||||
"https://codeberg.org/schylza/schylza/raw/branch/main/SUPPORT.md")
|
"https://codeberg.org/schylza/schylza/raw/branch/main/SUPPORT.md")
|
||||||
donations = json.loads(r.content)
|
donations = json.loads(r.content)
|
||||||
|
addresses = [
|
||||||
|
{'name': 'btc',
|
||||||
|
'address': donations['btc']},
|
||||||
|
{'name': 'xmr',
|
||||||
|
'address': donations['xmr']},
|
||||||
|
{'name': 'nano',
|
||||||
|
'address': donations['nano']},
|
||||||
|
]
|
||||||
|
for ad in addresses:
|
||||||
|
qr = qrcode.QRCode(version=1, box_size=10, border=4)
|
||||||
|
# add data to the QR code
|
||||||
|
qr.add_data(ad['address'])
|
||||||
|
# compile the data into a QR code array
|
||||||
|
qr.make()
|
||||||
|
# transfer the array into an actual image
|
||||||
|
img = qr.make_image(fill_color="white", back_color="#1a1a1a")
|
||||||
|
# save it to a file
|
||||||
|
img.save(f"./static/img/qrcodes/{ad['name']}.png")
|
||||||
#await generate_donations_qrcodes(donations)
|
#await generate_donations_qrcodes(donations)
|
||||||
return html(template.render(date=date, title="KYC? Not me!",
|
return html(template.render(date=date, title="KYC? Not me!",
|
||||||
subtitle="About KYCNOT.ME",
|
subtitle="About KYCNOT.ME",
|
||||||
|
|
|
@ -34,3 +34,5 @@ ujson==4.0.2
|
||||||
uvloop==0.15.2
|
uvloop==0.15.2
|
||||||
websockets==8.1
|
websockets==8.1
|
||||||
wrapt==1.12.1
|
wrapt==1.12.1
|
||||||
|
qrcode
|
||||||
|
pillow
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue