adding init script and mnemonic util

master
lza_menace 2 years ago
parent 6de3345c85
commit 8795d8c9eb

@ -0,0 +1,8 @@
#!/bin/bash
if [[ "$(docker-compose exec -ti monero-lws monero-lws-admin list_admin)" == '{}' ]];
then
docker-compose exec -ti monero-lws monero-lws-admin create_admin;
else
docker-compose exec -ti monero-lws monero-lws-admin list_admin;
fi

@ -1,5 +1,6 @@
import requests import requests
import monero.address import monero.address
import monero.seed
from quart import Quart, render_template, redirect, request, flash, jsonify from quart import Quart, render_template, redirect, request, flash, jsonify
from quart_auth import ( from quart_auth import (
AuthUser, AuthManager, login_required, login_user, logout_user, current_user, Unauthorized AuthUser, AuthManager, login_required, login_user, logout_user, current_user, Unauthorized
@ -38,18 +39,30 @@ async def index():
wallets=wallets wallets=wallets
) )
@app.route("/debug")
async def debug(): @app.route("/utils")
admin = User.get(1) async def utils():
data = { return await render_template("utils/index.html")
"auth": admin.view_key,
"params": {
"height": 2836540, @app.route("/utils/mnemonic", methods=["GET", "POST"])
"addresses": ["46pSfwbyukuduh13pqUo7R6S5W8Uk2EnqcKuPg4T9KaoHVSFQ5Qb33nBEN6xVxpeKG1TgYoxo4GxhJm2JFYN1sHJBEH1MwY"] async def utils_mnemonic():
} form = await request.form
} if form:
r = requests.post("http://127.0.0.1:8081/rescan", json=data) seed = form.get("seed", "")
return jsonify(r.json()) if not seed:
await flash("must provide mnemonic seed")
return redirect("/utils/mnemonic")
try:
s = monero.seed.Seed(seed)
return await render_template(
"utils/mnemonic.html",
results=s
)
except Exception as e:
print(f"failed to read mnemonic seed: {e}")
await flash("failed to parse mnemonic seed")
return await render_template("utils/mnemonic.html")
@app.route("/login", methods=["GET", "POST"]) @app.route("/login", methods=["GET", "POST"])
@ -82,7 +95,7 @@ async def login():
@app.route("/logout") @app.route("/logout")
async def logout(): async def logout():
if current_user.is_authenticated: if await current_user.is_authenticated:
logout_user() logout_user()
return redirect("/") return redirect("/")

@ -0,0 +1,5 @@
.key {
color: #666;
font-size: .9em;
user-select: all;
}

@ -19,16 +19,18 @@
<meta name="twitter:image" content=""> <meta name="twitter:image" content="">
<meta name="keywords" content="Wownero, Monero, crypto, wallet, explorer"> <meta name="keywords" content="Wownero, Monero, crypto, wallet, explorer">
<link rel="stylesheet" href="https://unpkg.com/chota@latest"> <link rel="stylesheet" href="https://unpkg.com/chota@latest">
<!-- <link rel="stylesheet" href="/static/css/normalize.css"> <link rel="stylesheet" href="/static/main.css">
<!--
<link rel="stylesheet" href="/static/css/skeleton.css"> <link rel="stylesheet" href="/static/css/skeleton.css">
<link rel="stylesheet" href="/static/css/main.css"> --> <link rel="stylesheet" href="/static/css/main.css">
-->
</head> </head>
<body> <body>
<nav class="nav"> <nav class="nav">
<div class="nav-left"> <div class="nav-left">
<a class="{% if request.path == '/' %}active{% endif %}" href="/">Home</a> <a class="{% if request.path == '/' %}active{% endif %}" href="/">Home</a>
<a>Settings</a> <a class="{% if request.path == '/utils' %}active{% endif %}" href="/utils">Utils</a>
</div> </div>
<!-- <div class="nav-center"> <!-- <div class="nav-center">
<a class="brand"> <a class="brand">

@ -2,7 +2,7 @@
{% block content %} {% block content %}
<div id="dashboard"> <div id="dashboard">
<h1>LWS Web</h1> <h1>LWS Web Admin</h1>
<p>LWS Admin: {{ config.LWS_ADMIN_URL }}</p> <p>LWS Admin: {{ config.LWS_ADMIN_URL }}</p>
<p>LWS RPC: {{ config.LWS_URL }}</p> <p>LWS RPC: {{ config.LWS_URL }}</p>
<p>{{ wallets.count() }} wallet{% if wallets.count() > 1 %}s{% endif %} being tracked</p> <p>{{ wallets.count() }} wallet{% if wallets.count() > 1 %}s{% endif %} being tracked</p>

@ -2,16 +2,18 @@
{% block content %} {% block content %}
<div id="setup"> <div id="setup">
<h1>Setup your Monero light wallet</h1>
<p class="subtext">The LWS address and view key must be generated from <i>monero-lws</i> using the initialization scripts.</p>
<form method="post"> <form method="post">
<label for="username">Username</label> <label for="username">Username</label>
<input type="text" name="username" /> <input type="text" name="username" />
<label for="password">Password</label> <label for="password">Password</label>
<input type="password" name="password" /> <input type="password" name="password" />
<label for="address">Address</label> <label for="address">LWS Address</label>
<input type="text" name="address" /> <input type="text" name="address" />
<label for="view_key">View Key</label> <label for="view_key">LWS View Key</label>
<input type="text" name="view_key" /> <input type="text" name="view_key" />
<button type="submit">Send</button> <button type="submit">Submit</button>
</form> </form>
</div> </div>
@ -21,5 +23,10 @@
padding-bottom: .5em; padding-bottom: .5em;
margin-bottom: 1em; margin-bottom: 1em;
} }
.subtext {
font-size: 1em;
display: block;
color: #666;
}
</style> </style>
{% endblock %} {% endblock %}

@ -0,0 +1,6 @@
{% extends 'includes/base.html' %}
{% block content %}
<h1>Utilities</h1>
<a class="button outline primary" href="/utils/mnemonic">Read Mnemonic</a>
{% endblock %}

@ -0,0 +1,31 @@
{% extends 'includes/base.html' %}
{% block content %}
<div>
<h1>Parse Mnemonic Seed</h1>
<form method="post">
<label for="seed">25 Word Seed</label>
<input type="password" name="seed" />
<button type="submit">Send</button>
</form>
</div>
<style>
input {
display: block;
padding-bottom: .5em;
margin-bottom: 1em;
}
</style>
{% if results %}
<h2>Results</h2>
<p>Public Address: <span class="key">{{ results.public_address() }}</span></p>
<p>Public Spend Key: <span class="key">{{ results.public_spend_key() }}</span></p>
<p>Public View Key: <span class="key">{{ results.public_view_key() }}</span></p>
<p>Secret Spend Key: <span class="key">{{ results.secret_spend_key() }}</span></p>
<p>Secret View Key: <span class="key">{{ results.secret_view_key() }}</span></p>
{% endif %}
{% endblock %}

@ -1,6 +1,7 @@
{% extends 'includes/base.html' %} {% extends 'includes/base.html' %}
{% block content %} {% block content %}
<h1>Manage Wallets</h1>
<a class="button outline primary" href="/wallet/add">Add a Wallet</a> <a class="button outline primary" href="/wallet/add">Add a Wallet</a>
<div id="wallets" class="content"> <div id="wallets" class="content">
{% for wallet in wallets %} {% for wallet in wallets %}

@ -11,6 +11,7 @@
<p>Received: {{ info['total_received'] }}</p> <p>Received: {{ info['total_received'] }}</p>
<p>Sent: {{ info['total_sent'] }}</p> <p>Sent: {{ info['total_sent'] }}</p>
<p>Scanned Height: {{ info['scanned_height'] }} ({{ info['blockchain_height'] - info['scanned_height'] }} blocks away from top)</p> <p>Scanned Height: {{ info['scanned_height'] }} ({{ info['blockchain_height'] - info['scanned_height'] }} blocks away from top)</p>
<p>Chain Height: {{ info['blockchain_height'] }}</p>
<p>Spent Outputs: {{ info['spent_outputs'] | length }}</p> <p>Spent Outputs: {{ info['spent_outputs'] | length }}</p>
<!-- <!--
{ {

Loading…
Cancel
Save