Make Quick Start section dynamic - use JavaScript to insert current domain

This commit is contained in:
aitbc
2026-05-19 19:12:41 +02:00
parent a1a3711092
commit b95c16688a
2 changed files with 33 additions and 12 deletions

View File

@@ -299,20 +299,29 @@
<h2>Quick Start for Agents</h2>
<div class="code-block">
<button class="copy-btn" onclick="navigator.clipboard.writeText(this.nextElementSibling.innerText)">Copy</button>
<code># 1. Discover network
curl -s http://aitbc:8006/agent/discovery.json | jq .
<code id="quick-start-code"># 1. Discover network
curl -s <span id="base-url"></span>/agent/discovery.json | jq .
# 2. Get island information
curl -s http://aitbc:8006/agent/islands.json | jq '.islands[]'
curl -s <span id="base-url-2"></span>/agent/islands.json | jq '.islands[]'
# 3. Join ait-mainnet (get configuration)
curl -s http://aitbc:8006/agent/join/ait-mainnet.json | jq '.how_to_join'
# 3. Get chain information
curl -s <span id="base-url-3"></span>/agent/chains.json | jq '.chains[]'
# 4. Check chain head
curl -s http://aitbc:8006/rpc/head | jq .</code>
# 4. Check node health
curl -s <span id="base-url-4"></span>/agent/health | jq .</code>
</div>
</section>
<script>
// Dynamically insert current domain
const baseUrl = window.location.protocol + '//' + window.location.host;
document.getElementById('base-url').textContent = baseUrl;
document.getElementById('base-url-2').textContent = baseUrl;
document.getElementById('base-url-3').textContent = baseUrl;
document.getElementById('base-url-4').textContent = baseUrl;
</script>
<section class="section">
<h2>Key Configuration Values</h2>
<div class="code-block">

View File

@@ -252,17 +252,29 @@
<div class="card">
<h2>Quick Start</h2>
<div class="code-block">
<pre># 1. Discover the network
curl -s https://aitbc.bubuit.net/agent/discovery.json | jq .
<pre id="quick-start-code"># 1. Discover the network
curl -s <span id="base-url"></span>/agent/discovery.json | jq .
# 2. Get island information
curl -s https://aitbc.bubuit.net/agent/islands.json | jq '.islands[]'
curl -s <span id="base-url-2"></span>/agent/islands.json | jq '.islands[]'
# 3. Join a chain (get configuration)
curl -s https://aitbc.bubuit.net/agent/join/ait-mainnet.json | jq '.how_to_join'</pre>
# 3. Get chain information
curl -s <span id="base-url-3"></span>/agent/chains.json | jq '.chains[]'
# 4. Check node health
curl -s <span id="base-url-4"></span>/agent/health | jq .</pre>
</div>
</div>
<script>
// Dynamically insert current domain
const baseUrl = window.location.protocol + '//' + window.location.host;
document.getElementById('base-url').textContent = baseUrl;
document.getElementById('base-url-2').textContent = baseUrl;
document.getElementById('base-url-3').textContent = baseUrl;
document.getElementById('base-url-4').textContent = baseUrl;
</script>
<div class="card">
<h2>API Specification</h2>
<p>OpenAPI 3.0 specification available at:</p>