generated from nathanwoodburn/python-webserver-template
All checks were successful
Build Docker / BuildImage (push) Successful in 2m5s
201 lines
7.1 KiB
HTML
201 lines
7.1 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Fire HSD | Nathan.Woodburn</title>
|
|
<link rel="icon" href="/assets/img/favicon.png" type="image/png">
|
|
<link rel="stylesheet" href="/assets/css/index.css">
|
|
<link rel="stylesheet" href="/assets/css/bootstrap.min.css">
|
|
<style>
|
|
/* Extra styling for index page */
|
|
.intro {
|
|
max-width: 600px;
|
|
margin: 0 auto 2em auto;
|
|
padding: 1.5em;
|
|
background: rgba(40, 40, 40, 0.5);
|
|
border-radius: 10px;
|
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
|
|
font-size: 1.15em;
|
|
line-height: 1.7;
|
|
}
|
|
|
|
.api-table-container {
|
|
max-width: 90%;
|
|
margin: 0 auto;
|
|
}
|
|
|
|
/* Responsive table styling */
|
|
.table-responsive {
|
|
overflow-x: auto;
|
|
-webkit-overflow-scrolling: touch;
|
|
margin-bottom: 1rem;
|
|
}
|
|
|
|
/* Table styling */
|
|
.api-table {
|
|
width: 100%;
|
|
max-width: 800px;
|
|
margin: 0 auto;
|
|
border-collapse: collapse;
|
|
}
|
|
|
|
.api-table th,
|
|
.api-table td {
|
|
padding: 8px;
|
|
border-bottom: 1px solid #444;
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
.api-table th,
|
|
.api-table td {
|
|
padding: 6px 4px;
|
|
font-size: 0.9em;
|
|
}
|
|
|
|
code {
|
|
word-break: break-word;
|
|
}
|
|
}
|
|
|
|
footer {
|
|
margin-top: 4em;
|
|
text-align: center;
|
|
color: #aaa;
|
|
font-size: 0.95em;
|
|
}
|
|
|
|
.logo {
|
|
width: 80px;
|
|
height: 80px;
|
|
margin-bottom: 1em;
|
|
border-radius: 50%;
|
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body class="bg-dark text-light">
|
|
<div class="centre" style="margin-top: 2em;">
|
|
<img src="/assets/img/favicon.png" alt="Fire HSD Logo" class="logo">
|
|
<h1>Fire HSD</h1>
|
|
<span style="font-size:1.2em; color:#f0f0f0;">A free public API for Handshake (HSD)</span>
|
|
</div>
|
|
<div class="spacer"></div>
|
|
<div class="intro">
|
|
Fire HSD is a public API for the <a href="https://handshake.org/" target="_blank">Handshake</a> blockchain.<br>
|
|
You can use these endpoints to query blocks, transactions, coins and names.<br>
|
|
No authentication required!<br>
|
|
<br>
|
|
<b>Quick Start:</b> Try <code>/api/v1/status</code> or <code>/api/v1/block/1</code> in your browser or with
|
|
<code>curl</code>.
|
|
</div>
|
|
<div class="spacer"></div>
|
|
<div class="centre api-table-container">
|
|
<h2>API Endpoints</h2>
|
|
<div id="api-endpoints"></div>
|
|
</div>
|
|
<div style="text-align: center; margin-top: 2em;">
|
|
|
|
<h1>Support Fire HSD</h1>
|
|
If you'd like to help keep the service running and growing,
|
|
consider
|
|
donating:<br />
|
|
<div class="btn-group-vertical btn-group-sm gap-1" role="group"><a class="btn btn-primary" role="button"
|
|
target="_blank" href="https://paypal.me/nathanwoodburn">PayPal</a><a class="btn btn-primary"
|
|
role="button" target="_blank" href="https://donate.stripe.com/8wM6pv0VD08Xe408ww">Card (via
|
|
Stripe)</a><a class="btn btn-primary" role="button" target="_blank"
|
|
href="https://nathan.woodburn.au/donate?c=hns">HNS</a><a class="btn btn-primary" role="button"
|
|
target="_blank" href="https://nathan.woodburn.au/donate?c=btc">BTC</a><a class="btn btn-primary"
|
|
role="button" target="_blank" href="https://nathan.woodburn.au/donate">Other Donation Options</a></div>
|
|
</p>
|
|
</div>
|
|
|
|
<footer>
|
|
© 2025 <a href="https://nathan.woodburn.au" style="color: #aaa;" target="_blank">Nathan.Woodburn/</a>
|
|
— <a href="https://git.woodburn.au/nathanwoodburn/firehsd" style="color:#aaa;" target="_blank">Source</a>
|
|
</footer>
|
|
<script>
|
|
function getDemoUrl(endpoint) {
|
|
// Remove trailing placeholders like <name>, <blockid>, <txid>, etc.
|
|
return endpoint.replace(/\/<[^>]+>/g, '').replace("api","demo")
|
|
}
|
|
|
|
function renderApiEndpoints(apiList) {
|
|
const container = document.getElementById('api-endpoints');
|
|
|
|
// Create responsive wrapper
|
|
const tableWrapper = document.createElement('div');
|
|
tableWrapper.className = 'table-responsive';
|
|
|
|
// Create table element
|
|
const table = document.createElement('table');
|
|
table.className = 'api-table';
|
|
|
|
// Create table header
|
|
const thead = document.createElement('thead');
|
|
const headerRow = document.createElement('tr');
|
|
|
|
const thEndpoint = document.createElement('th');
|
|
thEndpoint.textContent = 'Endpoint';
|
|
|
|
const thDescription = document.createElement('th');
|
|
thDescription.textContent = 'Description';
|
|
|
|
const thEndpointDemo = document.createElement('th');
|
|
thEndpointDemo.textContent = 'Example Usage';
|
|
|
|
headerRow.appendChild(thEndpoint);
|
|
headerRow.appendChild(thDescription);
|
|
headerRow.appendChild(thEndpointDemo);
|
|
thead.appendChild(headerRow);
|
|
table.appendChild(thead);
|
|
|
|
// Create table body
|
|
const tbody = document.createElement('tbody');
|
|
apiList.forEach(api => {
|
|
const row = document.createElement('tr');
|
|
|
|
const tdEndpoint = document.createElement('td');
|
|
const code = document.createElement('code');
|
|
code.textContent = api.endpoint;
|
|
tdEndpoint.appendChild(code);
|
|
|
|
const tdDescription = document.createElement('td');
|
|
tdDescription.textContent = api.description;
|
|
|
|
const tdEndpointDemo = document.createElement('td');
|
|
const demoLink = document.createElement('a');
|
|
demoLink.href = getDemoUrl(api.endpoint);
|
|
demoLink.textContent = 'Try it';
|
|
demoLink.target = '_blank';
|
|
demoLink.classList.add('btn', 'btn-secondary', 'btn-sm');
|
|
tdEndpointDemo.appendChild(demoLink);
|
|
|
|
row.appendChild(tdEndpoint);
|
|
row.appendChild(tdDescription);
|
|
row.appendChild(tdEndpointDemo);
|
|
|
|
tbody.appendChild(row);
|
|
});
|
|
table.appendChild(tbody);
|
|
|
|
// Add table to wrapper and wrapper to container
|
|
tableWrapper.appendChild(table);
|
|
container.innerHTML = '';
|
|
container.appendChild(tableWrapper);
|
|
}
|
|
|
|
fetch('/api/v1/help')
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
if (data.api) {
|
|
renderApiEndpoints(data.api);
|
|
}
|
|
})
|
|
.catch(error => console.error('Error fetching API endpoints:', error));
|
|
</script>
|
|
</body>
|
|
|
|
</html> |