|
|
|
@ -1,4 +1,7 @@
|
|
|
|
|
from os import path, remove
|
|
|
|
|
from io import BytesIO
|
|
|
|
|
from base64 import b64encode
|
|
|
|
|
from qrcode import make as qrcode_make
|
|
|
|
|
from flask import render_template, Blueprint, request, session, flash
|
|
|
|
|
from flask import send_from_directory, redirect, url_for, current_app
|
|
|
|
|
from werkzeug.utils import secure_filename
|
|
|
|
@ -31,6 +34,8 @@ def top():
|
|
|
|
|
|
|
|
|
|
@bp.route("/post/<id>")
|
|
|
|
|
def read(id):
|
|
|
|
|
_address_qr = BytesIO()
|
|
|
|
|
qr_code = None
|
|
|
|
|
if Post.filter(id=id):
|
|
|
|
|
wallet = wownero.Wallet()
|
|
|
|
|
post = Post.get(id=id)
|
|
|
|
@ -41,6 +46,9 @@ def read(id):
|
|
|
|
|
if wallet.connected:
|
|
|
|
|
address = wallet.get_address(account=post.account_index)
|
|
|
|
|
transfers = wallet.transfers(account=post.account_index)
|
|
|
|
|
qr_uri = f'wownero:{address}?tx_description=suchwow%20post%20{post.id}'
|
|
|
|
|
address_qr = qrcode_make(qr_uri).save(_address_qr)
|
|
|
|
|
qr_code = b64encode(_address_qr.getvalue()).decode()
|
|
|
|
|
else:
|
|
|
|
|
address = "?"
|
|
|
|
|
transfers = "?"
|
|
|
|
@ -48,7 +56,8 @@ def read(id):
|
|
|
|
|
"post/read.html",
|
|
|
|
|
post=post,
|
|
|
|
|
address=address,
|
|
|
|
|
transfers=transfers
|
|
|
|
|
transfers=transfers,
|
|
|
|
|
qr_code=qr_code
|
|
|
|
|
)
|
|
|
|
|
else:
|
|
|
|
|
flash("No meme there, brah")
|
|
|
|
|