From e0c8e786f162ff3ca434efd805674d8829455ba8 Mon Sep 17 00:00:00 2001 From: lza_menace Date: Tue, 14 Nov 2023 14:44:45 -0800 Subject: [PATCH] cleaning up a bit --- lwsadmin/lws/helpers.py | 9 ------ lwsadmin/lws/routes/htmx.py | 6 +++- lwsadmin/lws/routes/wallet.py | 7 ++--- .../lws/templates/htmx/create_wallet.html | 2 +- .../lws/templates/htmx/import_wallet.html | 2 +- lwsadmin/lws/templates/htmx/label_wallet.html | 28 ++++++++++--------- lwsadmin/lws/templates/htmx/set_height.html | 28 ++++++++++--------- lwsadmin/lws/templates/htmx/show_wallets.html | 2 -- 8 files changed, 40 insertions(+), 44 deletions(-) diff --git a/lwsadmin/lws/helpers.py b/lwsadmin/lws/helpers.py index d02df8b..a5495a7 100644 --- a/lwsadmin/lws/helpers.py +++ b/lwsadmin/lws/helpers.py @@ -18,15 +18,6 @@ from lws import config # webhook_delete_uuid: {"event_ids": [...]} # webhook_list: {} -def get_height() -> int: - try: - r = requests.get(f"{config.MONEROD_URL}/get_info") - print(r.content) - return int(r.json()["height"]) - except Exception as e: - print(e) - return 0 - class LWS: def __init__(self): pass diff --git a/lwsadmin/lws/routes/htmx.py b/lwsadmin/lws/routes/htmx.py index aab9b1a..fb4f15b 100644 --- a/lwsadmin/lws/routes/htmx.py +++ b/lwsadmin/lws/routes/htmx.py @@ -23,11 +23,13 @@ async def create_wallet(): svk=seed.secret_view_key() ) + @bp.route("/import_wallet") async def import_wallet(): """Importing an existing wallet""" return await render_template("htmx/import_wallet.html") + @bp.route("/label_wallet") async def label_wallet(): """Changing the label on a stored wallet""" @@ -39,6 +41,7 @@ async def label_wallet(): label=label ) + @bp.route("/set_height") async def set_height(): """Setting a new height to scan from""" @@ -50,6 +53,7 @@ async def set_height(): height=height ) + @bp.route("/show_wallets") @login_required async def show_wallets(): @@ -73,4 +77,4 @@ async def show_wallets(): "htmx/show_wallets.html", accounts=accounts, requests=requests - ) \ No newline at end of file + ) diff --git a/lwsadmin/lws/routes/wallet.py b/lwsadmin/lws/routes/wallet.py index d81a81f..aec9293 100644 --- a/lwsadmin/lws/routes/wallet.py +++ b/lwsadmin/lws/routes/wallet.py @@ -1,7 +1,7 @@ import monero.address from monero.seed import Seed -from quart import Blueprint, render_template, request, flash, redirect, url_for -from quart_auth import login_required, current_user +from quart import Blueprint, request, flash, redirect, url_for +from quart_auth import login_required from lws.helpers import lws from lws.models import Wallet, get_random_words @@ -15,7 +15,6 @@ bp = Blueprint("wallet", "wallet") async def add(): form = await request.form if form: - address = None label = form.get("label") seed = form.get("seed") restore_height = form.get("restore_height", None) @@ -29,7 +28,7 @@ async def add(): svk = str(seed.secret_view_key()) lws.add_wallet(address, svk) if restore_height != "-1": - lws.rescan(address, str(restore_height)) + lws.rescan(address, int(restore_height)) w = Wallet( address=seed.public_address(), label=label if label else get_random_words() diff --git a/lwsadmin/lws/templates/htmx/create_wallet.html b/lwsadmin/lws/templates/htmx/create_wallet.html index 464eb27..c6d3975 100644 --- a/lwsadmin/lws/templates/htmx/create_wallet.html +++ b/lwsadmin/lws/templates/htmx/create_wallet.html @@ -11,8 +11,8 @@ + - \ No newline at end of file + document.getElementById('label-input-{{ address }}').focus(); + + \ No newline at end of file diff --git a/lwsadmin/lws/templates/htmx/set_height.html b/lwsadmin/lws/templates/htmx/set_height.html index c812445..ef8b3ae 100644 --- a/lwsadmin/lws/templates/htmx/set_height.html +++ b/lwsadmin/lws/templates/htmx/set_height.html @@ -1,14 +1,16 @@ -
- -
- \ No newline at end of file + document.getElementById('height-input-{{ address }}').focus(); + + \ No newline at end of file diff --git a/lwsadmin/lws/templates/htmx/show_wallets.html b/lwsadmin/lws/templates/htmx/show_wallets.html index afc1bc0..6a3dbb4 100644 --- a/lwsadmin/lws/templates/htmx/show_wallets.html +++ b/lwsadmin/lws/templates/htmx/show_wallets.html @@ -19,7 +19,6 @@ - @@ -53,7 +52,6 @@
{{ account['scan_height'] }} -