better templating, improving rpc api calls

master
lza_menace 2 years ago
parent adaae35cc0
commit bf9a17a98a

@ -2,7 +2,7 @@ import requests
import monero.address
from quart import Quart, render_template, redirect, request, flash, jsonify
from quart_auth import (
AuthUser, AuthManager, login_required, login_user, current_user, Unauthorized
AuthUser, AuthManager, login_required, login_user, logout_user, current_user, Unauthorized
)
from quart_bcrypt import Bcrypt
from quart_session import Session
@ -75,6 +75,12 @@ async def login():
return await render_template("login.html")
@app.route("/logout")
async def logout():
if current_user.is_authenticated:
logout_user()
return redirect("/")
@app.route("/setup", methods=["GET", "POST"])
async def setup():
if User.select().first():

@ -56,6 +56,11 @@ class Wallet(Model):
return False
def add_wallet_lws(self):
if self.check_wallet_lws() and self.added is False:
self.added = True
self.date_added = datetime.utcnow()
self.save()
return True
endpoint = f"{config.LWS_ADMIN_URL}/add_account"
data = {
"auth": self.user.view_key,

@ -0,0 +1,53 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Monero LWS Web App</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="shortcut icon" href="/static/images/favicon.ico" type="image/png">
<meta itemprop="name" content="MyThing app">
<meta itemprop="description" content="Monero LWS web app">
<meta itemprop="image" content="">
<meta property="og:url" content="">
<meta property="og:type" content="website">
<meta property="og:title" content="">
<meta property="og:description" content="Monero LWS web app">
<meta property="og:image" content="">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="">
<meta name="twitter:description" content="Monero LWS web app">
<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/css/skeleton.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>
</div>
<!-- <div class="nav-center">
<a class="brand">
<img src="logo.svg" alt="">
</a>
</div> -->
<div class="nav-right">
<a>Wallets</a>
<a href="/logout">Logout</a>
</div>
</nav>
<div class="container">
<div style="margin: 1em;">
{% for message in get_flashed_messages() %}
<li>{{ message }}</li>
{% endfor %}
</div>
{% block content %}
{% endblock %}
</div>
</body>
</html>

@ -1,5 +1,10 @@
{% extends 'includes/base.html' %}
{% block content %}
{% if current_user.is_authenticated %}
<p>hi {{ current_user.username }}</p>
{% else %}
<p>hi anon</p>
{% endif %}
{% endblock %}

@ -1,7 +1,6 @@
{% for message in get_flashed_messages() %}
<li>{{ message }}</li>
{% endfor %}
<br />
{% extends 'includes/base.html' %}
{% block content %}
<div id="login">
<form method="post">
<label for="username">Username</label>
@ -19,3 +18,4 @@
margin-bottom: 1em;
}
</style>
{% endblock %}

@ -1,7 +1,6 @@
{% for message in get_flashed_messages() %}
<li>{{ message }}</li>
{% endfor %}
<br />
{% extends 'includes/base.html' %}
{% block content %}
<div id="setup">
<form method="post">
<label for="username">Username</label>
@ -23,3 +22,4 @@
margin-bottom: 1em;
}
</style>
{% endblock %}

@ -1,7 +1,6 @@
{% for message in get_flashed_messages() %}
<li>{{ message }}</li>
{% endfor %}
<br />
{% extends 'includes/base.html' %}
{% block content %}
<div id="wallet_add">
<form method="post">
<label for="name">Name</label>
@ -17,7 +16,6 @@
<button type="submit">Send</button>
</form>
</div>
<style>
input {
display: block;
@ -25,4 +23,8 @@
margin-bottom: 1em;
}
</style>
{% endblock %}

@ -1,3 +1,6 @@
{% extends 'includes/base.html' %}
{% block content %}
<p>{{ wallet.name }}</p>
<p>{{ wallet.description }}</p>
<p>{{ wallet.date }}</p>
@ -8,3 +11,4 @@
</pre>
<a href="{{ url_for('wallet_rescan', id=wallet.id) }}"><button>rescan</button></a>
{% endblock %}
Loading…
Cancel
Save