From 342ed744f870716ab3ebd5c735522a1c32289a62 Mon Sep 17 00:00:00 2001 From: drjones Date: Wed, 30 Sep 2026 19:03:07 -0700 Subject: [PATCH] gap-fixes: favicon.svg, og.png social card, header account/balance chip, operator reply form in /admin --- app.py | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 61 insertions(+), 2 deletions(-) diff --git a/app.py b/app.py index 0bf5583..b10d942 100644 --- a/app.py +++ b/app.py @@ -109,6 +109,8 @@ BASE = """ + + @@ -191,7 +193,7 @@ li{text-align:left;margin:.2rem 0} INBOXPASSPORT PASSKEYSTOOLS - +
{{acct}}
@@ -277,8 +279,20 @@ def kv(pairs): def page(sec, body): n1, n2 = NEBULAS.get(sec, ("rgba(120,85,255,.16)", "rgba(0,190,255,.10)")) + uid = current_user_id() + acct = "" + if uid: + try: + con = db() + u = con.execute("SELECT username FROM users WHERE id=?", (uid,)).fetchone() + bal = get_balance(uid) + pas = has_pass(uid) + acct = ('' + + ("★ PASS · " if pas else "") + "$" + f"{bal/100:.2f}" + " · " + esc(u["username"]) + "") + except Exception: + acct = "" return render_template_string(BASE, body=body, bmac=BMAC, o=lambda s: "on" if s == sec else "", - n1=n1, n2=n2) + n1=n1, n2=n2, acct=acct) def how(steps): lis = "".join(f"
  • {esc(s)}
  • " for s in steps) @@ -1535,6 +1549,17 @@ def passport():
    API: GET /api/passport (cookie auth) → badge JSON. Embed in your agent's llms.txt / tool card.
    """ return page("home", body) +@app.route("/admin/reply", methods=["POST"]) +def admin_reply(): + if not request.cookies.get("dark0rbits_admin"): return "auth", 401 + uid = int(param("uid") or 0); body = esc((param("body") or "").strip()[:4000]) + if uid and body: + con = db() + con.execute("INSERT INTO messages(user_id,sender,body,created) VALUES(?,?,?,?)", (uid, "operator", body, int(time.time()))) + con.commit() + resp = Response(status=302); resp.headers["Location"] = "/admin" + return resp + @app.route("/api/passport") def api_passport(): uid = current_user_id() @@ -1693,9 +1718,15 @@ def admin(): msgs_html = "".join(f'
    {esc(m["username"])} · {time.strftime("%b %d %H:%M", time.localtime(m["created"]))}
    {m["body"]}
    ' for m in msgs) or '
    empty
    ' opens = con.execute("SELECT te.*, tr.filename FROM track_events te JOIN trackables tr ON tr.id=te.trackable_id ORDER BY te.id DESC LIMIT 30").fetchall() opens_html = "".join(f"{esc(o['filename'])}{esc(o['ip'])}{esc(o['ua'][:50])}{time.strftime('%b %d %H:%M', time.localtime(o['ts']))}" for o in opens) + reply_to = param("reply") or "" + reply_html = "" + if reply_to: + r = con.execute("SELECT username FROM users WHERE id=?", (reply_to,)).fetchone() + if r: reply_html = f'
    Reply to {esc(r["username"])}
    ' return page("track", f"""

    OPERATOR CONSOLE

    All customer messages{msgs_html}
    +
    Reply
    {reply_html}
    File open events{opens_html}
    FileIPDeviceWhen
    """) # ---------- INDEX (hacker landing) ---------- @@ -1739,6 +1770,34 @@ No KYC. No email required. No Stripe. BTC only. Agents welcome. For humans: click a card. That's it.
    """ return page("home", body) +@app.route("/favicon.svg") +def favicon(): + svg = '' + return Response(svg, mimetype="image/svg+xml") + +@app.route("/og.png") +def og_img(): + from PIL import Image, ImageDraw + im = Image.new("RGB", (1200, 630), (7, 10, 19)) + dr = ImageDraw.Draw(im) + for i in range(260): + import random as _r + _r.seed(i) + x, y = _r.randint(0, 1199), _r.randint(0, 629) + dr.ellipse([x, y, x+2, y+2], fill=(200+i%55, 210, 255)) + dr.ellipse([480, 190, 720, 430], outline=(167, 139, 250), width=4) + dr.ellipse([455, 165, 745, 455], outline=(111, 214, 255), width=2) + try: + from PIL import ImageFont + f = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSansMono-Bold.ttf", 84) + f2 = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf", 26) + except Exception: + f = f2 = None + dr.text((600, 290), "DARK0RBITS", fill=(255, 201, 77), anchor="mm", font=f) + dr.text((600, 390), "no-KYC network toolbox · BTC only · agents welcome", fill=(147, 160, 194), anchor="mm", font=f2) + buf = io.BytesIO(); im.save(buf, "PNG") + return Response(buf.getvalue(), mimetype="image/png") + @app.route("/health") def health(): return jsonify({"ok": True, "service": "dark0rbits", "version": "2.0"})