161 lines
4.5 KiB
HTML
161 lines
4.5 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>BridgeSwarm Examples</title>
|
|
<style>
|
|
:root {
|
|
--bg: #0f1419;
|
|
--panel: #1a2332;
|
|
--text: #e7ecf3;
|
|
--muted: #8b9bb4;
|
|
--accent: #3d8bfd;
|
|
--accent-2: #2dd4bf;
|
|
--border: #2a3548;
|
|
}
|
|
* { box-sizing: border-box; }
|
|
body {
|
|
margin: 0;
|
|
min-height: 100vh;
|
|
font-family: "Segoe UI", system-ui, sans-serif;
|
|
background:
|
|
radial-gradient(1200px 600px at 10% -10%, rgba(61, 139, 253, 0.18), transparent 55%),
|
|
radial-gradient(900px 500px at 90% 0%, rgba(45, 212, 191, 0.12), transparent 50%),
|
|
var(--bg);
|
|
color: var(--text);
|
|
line-height: 1.5;
|
|
}
|
|
main {
|
|
max-width: 880px;
|
|
margin: 0 auto;
|
|
padding: 48px 24px 80px;
|
|
}
|
|
h1 {
|
|
margin: 0 0 8px;
|
|
font-size: 2rem;
|
|
letter-spacing: -0.03em;
|
|
}
|
|
.lede {
|
|
color: var(--muted);
|
|
margin: 0 0 28px;
|
|
max-width: 54ch;
|
|
}
|
|
.warn {
|
|
border: 1px solid rgba(251, 191, 36, 0.35);
|
|
background: rgba(251, 191, 36, 0.08);
|
|
color: #fde68a;
|
|
padding: 12px 14px;
|
|
border-radius: 10px;
|
|
margin-bottom: 28px;
|
|
font-size: 0.95rem;
|
|
}
|
|
.warn code { color: #fff7c2; }
|
|
.grid {
|
|
display: grid;
|
|
gap: 14px;
|
|
}
|
|
a.card {
|
|
display: block;
|
|
text-decoration: none;
|
|
color: inherit;
|
|
background: var(--panel);
|
|
border: 1px solid var(--border);
|
|
border-radius: 14px;
|
|
padding: 18px 18px 16px;
|
|
transition: border-color 0.15s ease, transform 0.15s ease;
|
|
}
|
|
a.card:hover {
|
|
border-color: rgba(61, 139, 253, 0.7);
|
|
transform: translateY(-1px);
|
|
}
|
|
a.card h2 {
|
|
margin: 0 0 6px;
|
|
font-size: 1.15rem;
|
|
}
|
|
a.card p {
|
|
margin: 0;
|
|
color: var(--muted);
|
|
font-size: 0.95rem;
|
|
}
|
|
.path {
|
|
display: inline-block;
|
|
margin-top: 10px;
|
|
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
font-size: 0.8rem;
|
|
color: var(--accent-2);
|
|
}
|
|
footer {
|
|
margin-top: 36px;
|
|
color: var(--muted);
|
|
font-size: 0.9rem;
|
|
}
|
|
footer code {
|
|
color: #cbd5e1;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<main>
|
|
<h1>BridgeSwarm Examples</h1>
|
|
<p class="lede">
|
|
Interactive demos for Hyperswarm in the browser. Install the BridgeSwarm extension
|
|
and native host first, then open any demo below in two tabs to try P2P.
|
|
</p>
|
|
|
|
<div class="warn" id="fileWarn" hidden>
|
|
You opened this page via <code>file://</code>. Modern browsers treat each local file as a
|
|
unique security origin, so demos break. Run <code>npm run examples</code> from the repo
|
|
and use <code>http://127.0.0.1:4173/</code> instead.
|
|
</div>
|
|
|
|
<div class="grid">
|
|
<a class="card" href="./chat/">
|
|
<h2>Chat</h2>
|
|
<p>Minimal P2P chat over a topic — join, see peers, send messages.</p>
|
|
<span class="path">/chat/</span>
|
|
</a>
|
|
<a class="card" href="./chat-advanced/">
|
|
<h2>Advanced Chat</h2>
|
|
<p>Rooms, presence, markdown, emoji, and file sharing.</p>
|
|
<span class="path">/chat-advanced/</span>
|
|
</a>
|
|
<a class="card" href="./sdk-demo/">
|
|
<h2>SDK Demo</h2>
|
|
<p>Swarm lifecycle, raw messages, and Protomux channels.</p>
|
|
<span class="path">/sdk-demo/</span>
|
|
</a>
|
|
<a class="card" href="./hrpc-demo/">
|
|
<h2>HRPC Demo</h2>
|
|
<p>Typed RPC (ping / streams) over Hyperswarm connections.</p>
|
|
<span class="path">/hrpc-demo/</span>
|
|
</a>
|
|
<a class="card" href="./whiteboard/">
|
|
<h2>Whiteboard</h2>
|
|
<p>Collaborative drawing synced peer-to-peer in real time.</p>
|
|
<span class="path">/whiteboard/</span>
|
|
</a>
|
|
<a class="card" href="./screenshare/">
|
|
<h2>Screenshare</h2>
|
|
<p>WebRTC media with BridgeSwarm used only for signaling.</p>
|
|
<span class="path">/screenshare/</span>
|
|
</a>
|
|
<a class="card" href="./data-demo/">
|
|
<h2>Data API Demo</h2>
|
|
<p>Hypercore, Hyperbee, Hyperdrive, Autobase, and Hyperdb from the page.</p>
|
|
<span class="path">/data-demo/</span>
|
|
</a>
|
|
</div>
|
|
|
|
<footer>
|
|
Start the server with <code>npm run examples</code> from the BridgeSwarm repo root.
|
|
</footer>
|
|
</main>
|
|
<script>
|
|
if (location.protocol === 'file:') {
|
|
document.getElementById('fileWarn').hidden = false;
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|