adding init script and mnemonic util

master
lza_menace 1 year ago
parent 6de3345c85
commit 8795d8c9eb

@ -3,4 +3,4 @@ init:
git clone https://github.com/lalanza808/docker-monero-node
build:
docker-compose build
docker-compose build

@ -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 monero.address
import monero.seed
from quart import Quart, render_template, redirect, request, flash, jsonify
from quart_auth import (
AuthUser, AuthManager, login_required, login_user, logout_user, current_user, Unauthorized
@ -38,18 +39,30 @@ async def index():
wallets=wallets
)
@app.route("/debug")
async def debug():
admin = User.get(1)
data = {
"auth": admin.view_key,
"params": {
"height": 2836540,
"addresses": ["46pSfwbyukuduh13pqUo7R6S5W8Uk2EnqcKuPg4T9KaoHVSFQ5Qb33nBEN6xVxpeKG1TgYoxo4GxhJm2JFYN1sHJBEH1MwY"]
}
}
r = requests.post("http://127.0.0.1:8081/rescan", json=data)
return jsonify(r.json())
@app.route("/utils")
async def utils():
return await render_template("utils/index.html")
@app.route("/utils/mnemonic", methods=["GET", "POST"])
async def utils_mnemonic():
form = await request.form
if form:
seed = form.get("seed", "")
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"])
@ -82,7 +95,7 @@ async def login():
@app.route("/logout")
async def logout():
if current_user.is_authenticated:
if await current_user.is_authenticated:
logout_user()
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="keywords" content="Wownero, Monero, crypto, wallet, explorer">
<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/main.css"> -->
<link rel="stylesheet" href="/static/css/main.css">
-->
</head>
<body>
<nav class="nav">
<div class="nav-left">
<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 class="nav-center">
<a class="brand">

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

@ -2,16 +2,18 @@
{% block content %}
<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">
<label for="username">Username</label>
<input type="text" name="username" />
<label for="password">Password</label>
<input type="password" name="password" />
<label for="address">Address</label>
<label for="address">LWS Address</label>
<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" />
<button type="submit">Send</button>
<button type="submit">Submit</button>
</form>
</div>
@ -21,5 +23,10 @@
padding-bottom: .5em;
margin-bottom: 1em;
}
.subtext {
font-size: 1em;
display: block;
color: #666;
}
</style>
{% 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' %}
{% block content %}
<h1>Manage Wallets</h1>
<a class="button outline primary" href="/wallet/add">Add a Wallet</a>
<div id="wallets" class="content">
{% for wallet in wallets %}

@ -11,6 +11,7 @@
<p>Received: {{ info['total_received'] }}</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>Chain Height: {{ info['blockchain_height'] }}</p>
<p>Spent Outputs: {{ info['spent_outputs'] | length }}</p>
<!--
{

Loading…
Cancel
Save