"""Is the public relay passing splats on to the public page? One short, labelled test: a small coloured ball is sent as a headset gateway would send a room, a browser opens 6ense.com, and the page must draw it. python splat_live_check.py [--page http://6ense.com/] [--relay wss://cyborg-collective-relay.onrender.com] [--shot out.png] The ball is on the public page for about five seconds under the name "Test pattern (not a room)", then it leaves. Nothing about this computer or its user is sent. Use it after a relay deploy, not as a habit. """ import argparse import asyncio import base64 import json import secrets import sys import threading import time import numpy as np sys.stdout.reconfigure(encoding="utf-8", errors="replace") def ball(n, seed): """n splats on a ball half a metre across, two metres ahead: 12 bytes each, as quest_splat.py packs them.""" rng = np.random.default_rng(seed) v = rng.normal(size=(n, 3)); v /= np.linalg.norm(v, axis=1, keepdims=True) q, origin = 0.005, np.array([2.0, 0.0, 1.2]) pos = np.round(v * 0.25 / q).astype("= 0, 1, -1) oy[neg] = (1 - np.abs(o[neg, 0])) * np.where(o[neg, 1] >= 0, 1, -1) rec = np.zeros(n, np.dtype([("p", " document.getElementById('link') && document.getElementById('link').textContent === 'live'", timeout=90000) t = threading.Thread(target=lambda: asyncio.run(send(a.relay, 6, 600, result)), daemon=True) t.start() ok = True try: pg.wait_for_function("() => window.__splat && window.__splat.count() >= 600", timeout=30000) except Exception: ok = False pg.wait_for_timeout(2500) seen = pg.evaluate("""() => ({ count: window.__splat ? window.__splat.count() : 0, cards: [...document.querySelectorAll('#grid > *')].map(c => (c.querySelector('.name') || {}).textContent || c.className) })""") if a.shot: pg.screenshot(path=a.shot) t.join(timeout=20) pg.wait_for_timeout(2500) after = pg.evaluate("() => [...document.querySelectorAll('#grid > *')].map(c => (c.querySelector('.name') || {}).textContent || c.className)") b.close() print(json.dumps({"hello": result.get("hello"), "sent": result.get("sent"), "drawn": seen, "cards_after": after, "page_errors": errors[:3]}, ensure_ascii=False)) good = ok and seen["count"] >= 600 and "Test pattern (not a room)" in seen["cards"] and "Test pattern (not a room)" not in after and not errors print("PASS: the public page drew the test splats and let them go" if good else "FAIL") sys.exit(0 if good else 1) if __name__ == "__main__": main()