chore: brokenbits example extension

This commit is contained in:
Eneko Illarramendi
2020-04-03 22:28:25 +02:00
parent 434029966f
commit d0b44eada9
5 changed files with 82 additions and 133 deletions
+5 -20
View File
@@ -1,26 +1,11 @@
#add your dependencies here
from flask import g, render_template
from flask import jsonify, render_template, request, redirect, url_for
from lnbits.db import open_db, open_ext_db
from lnbits.decorators import check_user_exists, validate_uuids
from lnbits.extensions.example import example_ext
#add your endpoints here
@example_ext.route("/")
@validate_uuids(["usr"], required=True)
@check_user_exists()
def index():
"""Try to add descriptions for others."""
usr = request.args.get("usr")
if usr:
if not len(usr) > 20:
return redirect(url_for("home"))
# Get all the data
with open_db() as db:
user_wallets = db.fetchall("SELECT * FROM wallets WHERE user = ?", (usr,))
user_ext = db.fetchall("SELECT extension FROM extensions WHERE user = ? AND active = 1", (usr,))
user_ext = [v[0] for v in user_ext]
return render_template(
"example/index.html"
)
return render_template("example/index.html", user=g.user)