2024-06-06 20:00:13 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Memechain</title>
|
|
|
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
|
2024-06-15 12:37:41 +00:00
|
|
|
<style>
|
|
|
|
.loading {
|
|
|
|
display: none;
|
|
|
|
text-align: center;
|
|
|
|
margin-top: 20px;
|
|
|
|
}
|
|
|
|
.loading .spinner-border {
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
}
|
|
|
|
</style>
|
2024-06-06 20:00:13 +00:00
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div class="container">
|
|
|
|
<h1>Memechain</h1>
|
|
|
|
<em>your glorified nfts or something</em>
|
|
|
|
|
|
|
|
{% with messages = get_flashed_messages(with_categories=true) %}
|
|
|
|
{% if messages %}
|
|
|
|
{% for category, message in messages %}
|
|
|
|
<div style="margin-top: 16px;" class="alert alert-{{ category }}" role="alert">
|
|
|
|
{{ message }}
|
|
|
|
</div>
|
|
|
|
{% endfor %}
|
|
|
|
{% endif %}
|
|
|
|
{% endwith %}
|
|
|
|
|
2024-06-15 12:37:41 +00:00
|
|
|
<div style="margin-top: 40px;" class="row">
|
|
|
|
<div class="col-md-6">
|
|
|
|
<h2>New Block</h2>
|
|
|
|
<form id="upload-form" action="/upload" method="post" enctype="multipart/form-data">
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="image">Select Image:</label>
|
|
|
|
<input type="file" class="form-control-file" id="image" name="image" accept="image/*" required>
|
|
|
|
</div>
|
|
|
|
<button type="submit" class="btn btn-primary" id="upload-btn">Upload</button>
|
|
|
|
<div class="loading">
|
|
|
|
<div class="spinner-border" role="status">
|
|
|
|
<img style="height: 64px; width: 64px;" src="https://media.tenor.com/I6kN-6X7nhAAAAAi/loading-buffering.gif">
|
|
|
|
</div>
|
|
|
|
<p>Mining block...</p>
|
|
|
|
</div>
|
|
|
|
</form>
|
2024-06-06 20:00:13 +00:00
|
|
|
</div>
|
2024-06-15 12:37:41 +00:00
|
|
|
<div class="col-md-6">
|
|
|
|
<h2>Connected Nodes</h2>
|
|
|
|
<form action="/register_node" method="post">
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="node_url">Node URL:</label>
|
|
|
|
<input type="text" class="form-control" id="node_url" name="node_url" required>
|
|
|
|
</div>
|
|
|
|
<button type="submit" class="btn btn-primary">Connect Node</button>
|
|
|
|
</form>
|
|
|
|
<ul id="node-list" class="list-group mt-3"></ul>
|
2024-06-06 20:00:13 +00:00
|
|
|
</div>
|
2024-06-15 12:37:41 +00:00
|
|
|
</div>
|
2024-06-06 20:00:13 +00:00
|
|
|
<hr>
|
|
|
|
<a href="/sync_chain" class="btn btn-primary">Sync Blockchain</a>
|
|
|
|
<hr>
|
|
|
|
<h2>Blockchain</h2>
|
|
|
|
<div id="blockchain"></div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script>
|
|
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script>
|
|
|
|
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
|
|
|
|
<script>
|
|
|
|
fetch('/chain')
|
|
|
|
.then(response => response.json())
|
|
|
|
.then(data => {
|
|
|
|
const blockchainDiv = document.getElementById('blockchain');
|
|
|
|
data.forEach(block => {
|
|
|
|
const blockDiv = document.createElement('div');
|
|
|
|
blockDiv.innerHTML = `
|
|
|
|
<p>Index: ${block.index}</p>
|
|
|
|
<p>Timestamp: ${block.timestamp}</p>
|
|
|
|
<p>Image: <img style="height: 50%; width: 50%;" src="data:image/png;base64,${block.data}" alt="Block Image"></p>
|
|
|
|
<p>Previous Hash: ${block.previous_hash}</p>
|
|
|
|
<p>Hash: ${block.hash}</p>
|
|
|
|
<hr>
|
|
|
|
`;
|
|
|
|
blockchainDiv.appendChild(blockDiv);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
fetch('/nodes')
|
|
|
|
.then(response => response.json())
|
|
|
|
.then(nodes => {
|
|
|
|
const nodeList = document.getElementById('node-list');
|
|
|
|
nodes.forEach(node => {
|
|
|
|
const listItem = document.createElement('li');
|
|
|
|
listItem.textContent = node;
|
|
|
|
listItem.classList.add('list-group-item');
|
|
|
|
nodeList.appendChild(listItem);
|
|
|
|
});
|
2024-06-15 12:37:41 +00:00
|
|
|
});
|
|
|
|
$('form').on('submit', function() {
|
|
|
|
$('.loading').show();
|
|
|
|
});
|
2024-06-06 20:00:13 +00:00
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|