Files
firehsd/templates/index.html
Nathan Woodburn b2c1bcab99
All checks were successful
Build Docker / BuildImage (push) Successful in 58s
feat: Add readme info
2025-08-22 13:53:27 +10:00

149 lines
5.8 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: 800px;
margin: 0 auto;
}
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>
&copy; 2025 <a href="https://nathan.woodburn.au" style="color: #aaa;" target="_blank">Nathan.Woodburn/</a>
&mdash; <a href="https://git.woodburn.au/nathanwoodburn/firehsd" style="color:#aaa;" target="_blank">Source</a>
</footer>
<script>
function renderApiEndpoints(apiList) {
const container = document.getElementById('api-endpoints');
// Create table element
const table = document.createElement('table');
table.style.margin = 'auto';
table.style.borderCollapse = 'collapse';
table.style.width = '100%';
// Create table header
const thead = document.createElement('thead');
const headerRow = document.createElement('tr');
const thEndpoint = document.createElement('th');
thEndpoint.style.padding = '8px';
thEndpoint.style.borderBottom = '1px solid #ccc';
thEndpoint.textContent = 'Endpoint';
const thDescription = document.createElement('th');
thDescription.style.padding = '8px';
thDescription.style.borderBottom = '1px solid #ccc';
thDescription.textContent = 'Description';
headerRow.appendChild(thEndpoint);
headerRow.appendChild(thDescription);
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');
tdEndpoint.style.padding = '8px';
tdEndpoint.style.borderBottom = '1px solid #eee';
const code = document.createElement('code');
code.textContent = api.endpoint;
tdEndpoint.appendChild(code);
const tdDescription = document.createElement('td');
tdDescription.style.padding = '8px';
tdDescription.style.borderBottom = '1px solid #eee';
tdDescription.textContent = api.description;
row.appendChild(tdEndpoint);
row.appendChild(tdDescription);
tbody.appendChild(row);
});
table.appendChild(tbody);
// Replace container content
container.innerHTML = '';
container.appendChild(table);
}
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>