redesign screen-1 and screen-2, add pub status API and FAQ
- add hero video to screen-1 with local Dune Rise font replacing Google Fonts - screen-2: replace cards with interactive FAQ accordion (6 questions + 5 nested) - add SSB pub node status monitor with live API polling - add Flask API (/api/status/ssb, /api/status/ecoind) proxied via nginx - full responsive CSS rewrite (1024px, 768px, 480px breakpoints) - strip all accent marks for Dune Rise font compatibility Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
c9bf099c29
commit
48053b47ec
8 changed files with 648 additions and 219 deletions
48
api/server.py
Normal file
48
api/server.py
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
#!/usr/bin/env python3
|
||||
"""0asis.net pub status API"""
|
||||
import subprocess, json
|
||||
from flask import Flask, jsonify
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.route("/api/status/ssb")
|
||||
def ssb_status():
|
||||
try:
|
||||
out = subprocess.run(["ss", "-tlnp"], capture_output=True, text=True, timeout=3)
|
||||
ssb_up = ":8008" in out.stdout
|
||||
peers = None
|
||||
feeds = None
|
||||
if ssb_up:
|
||||
try:
|
||||
st = subprocess.run(
|
||||
["ssb-server", "status"],
|
||||
capture_output=True, text=True, timeout=5
|
||||
)
|
||||
lines = st.stderr + st.stdout
|
||||
# strip sodium warning lines
|
||||
clean = "\n".join(l for l in lines.splitlines() if not l.startswith("error loading") and not l.startswith("Require") and not l.startswith("falling") and not l.startswith("-"))
|
||||
d = json.loads(clean)
|
||||
since = d.get("sync", {}).get("since", -1)
|
||||
gossip = d.get("gossip", {})
|
||||
peers = len([v for v in gossip.values() if isinstance(v, dict) and v.get("connected")])
|
||||
feeds = since if since >= 0 else "syncing"
|
||||
except Exception:
|
||||
pass
|
||||
return jsonify(status="online" if ssb_up else "offline", peers=peers, feeds=feeds)
|
||||
except Exception:
|
||||
pass
|
||||
return jsonify(status="offline", peers=None, feeds=None)
|
||||
|
||||
@app.route("/api/status/ecoind")
|
||||
def ecoind_status():
|
||||
try:
|
||||
out = subprocess.run(["ecoind", "getinfo"], capture_output=True, text=True, timeout=5)
|
||||
if out.returncode == 0:
|
||||
d = json.loads(out.stdout)
|
||||
return jsonify(status="online", blocks=d.get("blocks"), connections=d.get("connections"))
|
||||
except Exception:
|
||||
pass
|
||||
return jsonify(status="offline", blocks="---", connections="---")
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(host="127.0.0.1", port=3001)
|
||||
Loading…
Add table
Add a link
Reference in a new issue