Spaces:
Sleeping
Sleeping
Update server.js
Browse files
server.js
CHANGED
|
@@ -18,9 +18,9 @@
|
|
| 18 |
* 3. Set port to 7860 (already default)
|
| 19 |
* 4. Your Space URL becomes the endpoint!
|
| 20 |
*
|
| 21 |
-
* Read: https://
|
| 22 |
-
* Write: https://
|
| 23 |
-
* Web: https://
|
| 24 |
*/
|
| 25 |
|
| 26 |
const http = require('http');
|
|
@@ -218,11 +218,16 @@ function renderDashboard() {
|
|
| 218 |
<li><span class="method post">POST</span><span><strong>/submit</strong> β Submit a new blob <code>{"id":"...","blob":"..."}</code></span></li>
|
| 219 |
<li><span class="method get">GET</span><span><strong>/stats</strong> β JSON stats</span></li>
|
| 220 |
<li><span class="method get">GET</span><span><strong>/health</strong> β Health check</span></li>
|
|
|
|
| 221 |
<div class="tip">
|
| 222 |
π‘ <strong>Client setup:</strong> In <code>social.html</code>, add these as your endpoint:<br><br>
|
| 223 |
-
<strong>Read URL:</strong> <code>https://
|
| 224 |
-
<strong>Submit URL:</strong> <code>https://
|
| 225 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 226 |
<div style="overflow-x:auto;">
|
| 227 |
<table>
|
| 228 |
<thead><tr><th>Recipient ID</th><th>Timestamp</th><th>Blob Size</th></tr></thead>
|
|
@@ -230,7 +235,7 @@ function renderDashboard() {
|
|
| 230 |
</table>
|
| 231 |
</div>
|
| 232 |
<p style="color:var(--dim);font-size:0.8rem;margin-top:8px;">π Blobs are encrypted β the server cannot read them.</p>
|
| 233 |
-
<p style="text-align:center;padding:40px;color:var(--dim);">π No messages yet. Share this endpoint!</p>`
|
| 234 |
</div>
|
| 235 |
<div class="card" style="text-align:center;">
|
| 236 |
<h2>π Zero-Knowledge Architecture</h2>
|
|
|
|
| 18 |
* 3. Set port to 7860 (already default)
|
| 19 |
* 4. Your Space URL becomes the endpoint!
|
| 20 |
*
|
| 21 |
+
* Read: https://USER-REPO.hf.space/blobs.jsonl
|
| 22 |
+
* Write: https://USER-REPO.hf.space/submit
|
| 23 |
+
* Web: https://USER-REPO.hf.space/
|
| 24 |
*/
|
| 25 |
|
| 26 |
const http = require('http');
|
|
|
|
| 218 |
<li><span class="method post">POST</span><span><strong>/submit</strong> β Submit a new blob <code>{"id":"...","blob":"..."}</code></span></li>
|
| 219 |
<li><span class="method get">GET</span><span><strong>/stats</strong> β JSON stats</span></li>
|
| 220 |
<li><span class="method get">GET</span><span><strong>/health</strong> β Health check</span></li>
|
| 221 |
+
</ul>
|
| 222 |
<div class="tip">
|
| 223 |
π‘ <strong>Client setup:</strong> In <code>social.html</code>, add these as your endpoint:<br><br>
|
| 224 |
+
<strong>Read URL:</strong> <code>https://${process.env.SPACE_ID || 'USER-REPO'}.hf.space/blobs.jsonl</code><br>
|
| 225 |
+
<strong>Submit URL:</strong> <code>https://${process.env.SPACE_ID || 'USER-REPO'}.hf.space/submit</code>
|
| 226 |
</div>
|
| 227 |
+
</div>
|
| 228 |
+
<div class="card">
|
| 229 |
+
<h2>π¬ Recent Messages ${hasMessages ? `(last ${Math.min(stats.messages, 50)} of ${stats.messages})` : ''}</h2>
|
| 230 |
+
${hasMessages ? `
|
| 231 |
<div style="overflow-x:auto;">
|
| 232 |
<table>
|
| 233 |
<thead><tr><th>Recipient ID</th><th>Timestamp</th><th>Blob Size</th></tr></thead>
|
|
|
|
| 235 |
</table>
|
| 236 |
</div>
|
| 237 |
<p style="color:var(--dim);font-size:0.8rem;margin-top:8px;">π Blobs are encrypted β the server cannot read them.</p>
|
| 238 |
+
` : `<p style="text-align:center;padding:40px;color:var(--dim);">π No messages yet. Share this endpoint!</p>`}
|
| 239 |
</div>
|
| 240 |
<div class="card" style="text-align:center;">
|
| 241 |
<h2>π Zero-Knowledge Architecture</h2>
|