some basic tialwind styling

This commit is contained in:
0ceanSlim 2023-12-20 10:39:11 -05:00
parent de3f6efd42
commit 52c25969f5
3 changed files with 104 additions and 3 deletions

View File

@ -7,7 +7,7 @@ import json
app = Flask(__name__)
def read_rpc_config(filename="rpc_config.json"):
def read_rpc_config(filename="../rpc_config.json"):
with open(filename, "r") as config_file:
config = json.load(config_file)
@ -71,5 +71,38 @@ def handle_generate_seed():
result = generate_seed(seed_length)
return jsonify({'seed': result})
# Route to get the current RPC configuration
@app.route('/get_rpc_config', methods=['GET'])
def get_rpc_config():
rpc_host, rpc_port, rpc_user, rpc_password = read_rpc_config()
return jsonify({'rpcHost': rpc_host, 'rpcPort': rpc_port, 'rpcUser': rpc_user, 'rpcPassword': rpc_password})
# Route to update the RPC configuration
@app.route('/update_rpc_config', methods=['POST'])
def update_rpc_config():
rpc_host = request.form['rpcHost']
rpc_port = request.form['rpcPort']
rpc_user = request.form['rpcUser']
rpc_password = request.form['rpcPassword']
# Update the RPC configuration file or database with the new values
# You may want to perform validation or error handling here
# For demonstration purposes, let's update the configuration and return success
try:
with open("../rpc_config.json", "w") as config_file:
config = {
"rpc_host": rpc_host,
"rpc_port": rpc_port,
"rpc_user": rpc_user,
"rpc_password": rpc_password
}
json.dump(config, config_file)
return jsonify({'message': 'RPC configuration updated successfully.'})
except Exception as e:
return jsonify({'message': f'Error updating RPC configuration: {str(e)}'})
if __name__ == "__main__":
app.run(debug=True)

View File

@ -540,6 +540,11 @@ video {
--tw-backdrop-sepia: ;
}
.bg-neutral-800 {
--tw-bg-opacity: 1;
background-color: rgb(38 38 38 / var(--tw-bg-opacity));
}
.font-bold {
font-weight: 700;
}
@ -547,3 +552,13 @@ video {
.italic {
font-style: italic;
}
.text-white {
--tw-text-opacity: 1;
color: rgb(255 255 255 / var(--tw-text-opacity));
}
.text-black {
--tw-text-opacity: 1;
color: rgb(0 0 0 / var(--tw-text-opacity));
}

View File

@ -5,14 +5,14 @@
<link rel="stylesheet" type="text/css" href="../static/style/output.css" />
<title>Create Wallet</title>
</head>
<body>
<body class="text-white bg-neutral-800 ">
<h1 class="font-bold">Create a New Wallet</h1>
<form id="walletForm">
<label for="walletName">Wallet Name:</label>
<input type="text" id="walletName" name="walletName" required><br><br>
<label for="seedLength">Choose Seed Phrase Length:</label>
<select id="seedLength" name="seedLength">
<select id="seedLength" class="text-black" name="seedLength">
<option value="12">12 Words</option>
<option value="24">24 Words</option>
</select><br><br>
@ -42,5 +42,58 @@
});
});
</script>
<h1 class="font-bold">RPC Configuration</h1>
<form id="rpcConfigForm">
<label for="rpcHost">RPC Host:</label>
<input type="text" id="rpcHost" name="rpcHost" required><br><br>
<label for="rpcPort">RPC Port:</label>
<input type="text" id="rpcPort" name="rpcPort" required><br><br>
<label for="rpcUser">RPC User:</label>
<input type="text" id="rpcUser" name="rpcUser" required><br><br>
<label for="rpcPassword">RPC Password:</label>
<input type="password" id="rpcPassword" name="rpcPassword" required><br><br>
<button type="submit">Save Configuration</button>
</form>
<div id="rpcResult"></div>
<!-- Add your JavaScript code here -->
<script>
// Fetch the current RPC configuration on page load
fetch('/get_rpc_config')
.then(response => response.json())
.then(data => {
document.getElementById('rpcHost').value = data.rpcHost;
document.getElementById('rpcPort').value = data.rpcPort;
document.getElementById('rpcUser').value = data.rpcUser;
document.getElementById('rpcPassword').value = data.rpcPassword;
})
.catch(error => {
console.error('Error:', error);
});
document.getElementById('rpcConfigForm').addEventListener('submit', function(event) {
event.preventDefault();
const form = event.target;
const formData = new FormData(form);
fetch('/update_rpc_config', {
method: 'POST',
body: formData
})
.then(response => response.json())
.then(data => {
document.getElementById('rpcResult').innerHTML = data.message;
})
.catch(error => {
console.error('Error:', error);
});
});
</script>
</body>
</html>