93 lines
3.5 KiB
HTML
93 lines
3.5 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||
<title>BridgeSwarm – Data API Demo</title>
|
||
<link rel="stylesheet" href="style.css">
|
||
<script>
|
||
if (location.protocol === 'file:') {
|
||
document.documentElement.innerHTML =
|
||
'<body style="margin:0;font:15px/1.5 Segoe UI,system-ui,sans-serif;background:#0f1419;color:#e7ecf3">' +
|
||
'<div style="max-width:36rem;margin:10vh auto;padding:24px;background:#1a2332;border:1px solid #2a3548;border-radius:14px">' +
|
||
'<h1 style="margin:0 0 10px;font-size:1.25rem">Open this demo over HTTP</h1>' +
|
||
'<p style="color:#8b9bb4">Browsers treat each <code>file://</code> URL as a unique security origin, so local demos break.</p>' +
|
||
'<p>From the BridgeSwarm repo root run:</p>' +
|
||
'<pre style="padding:12px;background:#0f1419;border-radius:10px;color:#2dd4bf">npm run examples</pre>' +
|
||
'<p style="color:#8b9bb4">Then open <code>http://127.0.0.1:4173/</code></p>' +
|
||
'</div></body>';
|
||
}
|
||
</script>
|
||
</head>
|
||
<body>
|
||
<h1>BridgeSwarm – Data API Demo</h1>
|
||
<p>Uses <code>BridgeSwarm.request(type, payload)</code> to call Hypercore, Hyperbee, Hyperdrive, Autobase, and Hyperdb in the native host.</p>
|
||
<div class="section">
|
||
<div class="row">
|
||
<span id="publicKey">Your public key: (loading...)</span>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="section">
|
||
<h2>Hypercore</h2>
|
||
<div class="row">
|
||
<button class="primary" id="coreInfo">Core info</button>
|
||
<input type="text" id="coreAppend" placeholder="Data to append (text)">
|
||
<button class="secondary" id="coreAppendBtn">Append</button>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="section">
|
||
<h2>Hyperbee (key/value)</h2>
|
||
<div class="row">
|
||
<input type="text" id="beeKey" placeholder="Key">
|
||
<input type="text" id="beeValue" placeholder="Value">
|
||
<button class="primary" id="beePut">Put</button>
|
||
<button class="secondary" id="beeGet">Get</button>
|
||
<button class="secondary" id="beeDel">Del</button>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="section">
|
||
<h2>Hyperdrive (files)</h2>
|
||
<div class="row">
|
||
<input type="text" id="drivePath" placeholder="Path (e.g. /foo.txt)" value="/readme.txt">
|
||
<input type="text" id="driveContent" placeholder="Content to write">
|
||
<button class="primary" id="drivePut">Put</button>
|
||
<button class="secondary" id="driveGet">Get</button>
|
||
<button class="secondary" id="driveList">List /</button>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="section">
|
||
<h2>Autobase (log)</h2>
|
||
<div class="row">
|
||
<input type="text" id="autobaseValue" placeholder="Value to append">
|
||
<button class="primary" id="autobaseAppend">Append</button>
|
||
<button class="secondary" id="autobaseInfo">Info</button>
|
||
<button class="secondary" id="autobaseView">Read view (0..4)</button>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="section">
|
||
<h2>Hyperdb (records)</h2>
|
||
<div class="row">
|
||
<input type="text" id="hyperdbId" placeholder="Id">
|
||
<input type="text" id="hyperdbValue" placeholder="Value">
|
||
<button class="primary" id="hyperdbPut">Put</button>
|
||
<button class="secondary" id="hyperdbGet">Get</button>
|
||
<button class="secondary" id="hyperdbDel">Del</button>
|
||
<button class="secondary" id="hyperdbFind">Find all</button>
|
||
<button class="secondary" id="hyperdbFlush">Flush</button>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="section">
|
||
<h2>Log</h2>
|
||
<div class="log" id="log"></div>
|
||
</div>
|
||
|
||
<script src="app.js"></script>
|
||
</body>
|
||
</html>
|