// screens-dashboard.jsx const _claimToRow = (c) => ({ time: c.time ? new Date(c.time).toTimeString().slice(0, 8) : "—", plat: c.platform || "—", code: c.code || "—", elapsed: c.elapsed_ms ? `${c.elapsed_ms}ms` : "—", res: c.status === "claimed" ? "ok" : "err", src: c.source || "api", }); const Sparkline = ({ data, color = "var(--accent)" }) => { const w = 240, h = 40; const max = Math.max(...data, 1); const pts = data.map((v, i) => `${(i/(data.length-1))*w},${h - (v/max)*h}`).join(" "); return ( ); }; const FeedTable = ({ rows }) => (
timeplatcodeelapsedres
{rows.map((r, i) => (
{r.time} {r.plat.replace("stake_", ".").replace("shuffle","shuf").replace("thrill","thrl")} {r.code} {r.elapsed} {r.res === "ok" ? "✓" : r.res === "pending" ? "…" : "✕"}
))}
); const Sidebar = ({ active, setActive, user }) => { const items = [ ["dashboard", "gauge", "Overview"], ["codes", "code", "Codes"], ["claims", "bolt", "Claims"], ["platforms", "globe", "Platforms"], ]; const admin = [ ["users", "users", "Users"], ["broadcast", "code", "Send Code"], ["admin-claims", "bolt", "Claim History"], ["promos", "credit", "Promos"], ["revenue", "chart", "Revenue"], ["health", "shield", "Health"], ]; return ( ); }; const Dashboard = ({ user, path, plan, goto, addToast }) => { const [feed, setFeed] = React.useState([]); const [loading, setLoading] = React.useState(true); const [active, setActive] = React.useState("dashboard"); const [tokens, setTokens] = React.useState({ com: 0, us: 0 }); const [refreshing, setRefreshing] = React.useState(false); const stats = React.useMemo(() => { const ok = feed.filter(r => r.res === "ok"); const api = ok.filter(r => r.src === "api"); const ext = ok.filter(r => r.src === "ext"); return { claims7d: feed.length, fromApi: api.length, fromExt: ext.length, successRate: feed.length ? Math.round(ok.length / feed.length * 100) : 0, }; }, [feed]); const fetchFeed = React.useCallback(async (showRefresh) => { const token = localStorage.getItem("cc_token"); if (!token) return; if (showRefresh) setRefreshing(true); try { const [cr, hr] = await Promise.all([ fetch("/api/claims", { headers: { Authorization: `Bearer ${token}` } }), fetch("/health"), ]); if (cr.ok) { const d = await cr.json(); setFeed((d.claims || []).map(_claimToRow)); } if (hr.ok) { const h = await hr.json(); const ts = h.turnstile || {}; setTokens({ com: ts.stake_com?.size ?? 0, us: ts.stake_us?.size ?? 0 }); } } catch (_) {} setLoading(false); setRefreshing(false); }, []); React.useEffect(() => { fetchFeed(false); const t = setInterval(() => fetchFeed(false), 15000); return () => clearInterval(t); }, [fetchFeed]); const isAdmin = ["users", "broadcast", "admin-claims", "promos", "revenue", "health"].includes(active); React.useEffect(() => { if (isAdmin && !user?.is_admin) setActive("dashboard"); }, [isAdmin, user]); return (
{isAdmin && user?.is_admin ? : active === "claims" ? : active === "codes" ? : active === "billing" ? : active === "settings" ? : active === "platforms" ? : fetchFeed(true)} goto={goto} /> }
); }; const MainPanel = ({ user, plan, path, feed, stats, tokens, loading, refreshing, onRefresh, goto }) => (
{/* header */}
API · cloud {plan || "free"} {tokens.com > 0 && turnstile · com {tokens.com}} {tokens.us > 0 && us {tokens.us}}

Hi {user?.username || user?.name || "there"}.

{loading ? "Loading your claims…" : `${stats.claims7d} claims recorded · ${stats.successRate}% success rate`}

{refreshing ? "Refreshing…" : "Refresh"}
{/* stats */}
{/* two engine cards */}
API · Stake.com / Stake.us online
a.filter((_,j)=>j<=i&&_.res==="ok").length)} />
{stats.fromApi} successful API claims {tokens.com > 0 && com token ready} {tokens.us > 0 && us token ready} {tokens.com === 0 && tokens.us === 0 && no tokens yet}
Decodo residential proxy · rotates per claim
Extension · Shuffle / Thrill not available yet
Browser extension coming soon
Shuffle & Thrill support in development
{/* feed */}
Claim history {loading ? "loading…" : feed.length ? `${feed.length} records` : "no claims yet"}
{feed.length === 0 && !loading ?

No claims yet. Codes are claimed automatically when BoostMonitor sends them.

: }

API status

Total claims {stats.claims7d}
API claims {stats.fromApi}
Success rate {stats.claims7d ? `${stats.successRate}%` : "—"}
Last claim {feed[0] ? `${feed[0].code} · ${feed[0].elapsed}` : "—"}
); const ExtensionPanel = ({ user }) => { const [token, setToken] = React.useState(""); const [copied, setCopied] = React.useState(false); const [error, setError] = React.useState(""); const hasAccess = user?.extension_access; const downloadUrl = (browser) => `/api/extension/download/${browser}?token=${encodeURIComponent(token)}`; const copyToken = () => { navigator.clipboard.writeText(token).then(() => { setCopied(true); setTimeout(() => setCopied(false), 2000); }); }; return (
extension

Browser Extension

Paste your token (from support / your approval email), then download the zip for your browser. Each zip is personal — your token is baked in.

{!hasAccess && (
Extension access required

Extension access is not yet available. Check back soon.

)}
{ setToken(e.target.value); setError(""); }} style={{ flex: 1, fontFamily: "var(--font-mono)" }} /> {token && ( {copied ? "Copied!" : "Copy"} )}
{error &&

{error}

}
download for your browser
{[ { id: "chrome", label: "Chrome / Brave", sub: "Manifest V3 · load unpacked" }, { id: "firefox", label: "Firefox", sub: "Manifest V2 · about:debugging" }, { id: "safari", label: "Safari", sub: "Requires Xcode — contact support" }, ].map(b => (
{b.label}
{b.sub}
{b.id === "safari" ? ( Contact support ) : ( { if (!token) { e.preventDefault(); setError("Paste your token first."); } }} style={{ textDecoration: "none", display: "block" }}> Download zip )}
))}
install guide
1 Paste your token above and click Download for your browser.
2 Chrome/Brave: go to chrome://extensions, enable Developer Mode, click "Load unpacked", select the unzipped folder.
2 Firefox: go to about:debugging#/runtime/this-firefox, click "Load Temporary Add-on", select manifest.json.
3 Pin the extension icon. Log into Shuffle / Thrill in a normal tab — the extension detects your session and starts listening automatically.
! Your token is personal — do not share your zip or token. If compromised, contact support to get it revoked and re-issued.
); }; const PlatformsPanel = ({ path }) => (
platforms

Connections & sessions

Manage proxies
{[ { id: "stake_com", via: "API · cloud", note: "24/7 server-side claiming" }, { id: "stake_us", via: "API · cloud", note: "Sweeps only · Texas proxy" }, { id: "shuffle", via: "Extension", note: "Not available yet", disabled: true }, { id: "thrill", via: "Extension", note: "Not available yet", disabled: true }, ].map(p => (
{p.disabled ? "coming soon" : "active"}

{p.note}

via · {p.via}
))}
); const ClaimsPanel = ({ user }) => { const [claims, setClaims] = React.useState([]); const [loading, setLoading] = React.useState(true); const token = localStorage.getItem("cc_token"); React.useEffect(() => { fetch("/api/claims", { headers: { Authorization: `Bearer ${token}` } }) .then(r => r.ok ? r.json() : null) .then(d => { if (d?.claims) setClaims(d.claims); setLoading(false); }) .catch(() => setLoading(false)); }, []); const ok = claims.filter(c => c.status === "claimed").length; const total = claims.length; return (
account · history

{loading ? "…" : total ? `${ok} / ${total} claimed` : "No claims yet"}

Your last 100 claim attempts across all platforms.

{loading ?

Loading…

: total === 0 ? (

No claims recorded yet. Codes are claimed automatically when BoostMonitor sends them.

) : (
{["Status", "Code", "Platform", "Value", "Speed", "Time"].map(h => ( ))} {claims.map(c => { const isOk = c.status === "claimed"; const ts = c.time ? new Date(c.time).toLocaleString([], { month: "numeric", day: "numeric", hour: "2-digit", minute: "2-digit" }) : "—"; const val = c.value && c.currency ? `${c.value} ${c.currency}` : (isOk ? "—" : (c.message || "—")); return ( ); })}
{h}
{isOk ? "claimed" : "failed"} {c.code || "—"} {(c.platform || "—").replace("stake_", "Stake.").replace("shuffle", "Shuffle")} {val} {c.elapsed_ms ? `${c.elapsed_ms}ms` : "—"} {ts}
)}
); }; const CodesPanel = () => { const [claims, setClaims] = React.useState([]); const [loading, setLoading] = React.useState(true); const token = localStorage.getItem("cc_token"); React.useEffect(() => { fetch("/api/claims", { headers: { Authorization: `Bearer ${token}` } }) .then(r => r.ok ? r.json() : null) .then(d => { if (d?.claims) setClaims(d.claims); setLoading(false); }) .catch(() => setLoading(false)); }, []); // Dedupe by code, keep first occurrence (most recent) const seen = new Set(); const codes = claims.filter(c => { if (!c.code || seen.has(c.code)) return false; seen.add(c.code); return true; }); return (
workspace · codes

{loading ? "…" : `${codes.length} unique codes`}

Bonus codes that were broadcast to your account.

{loading ?

Loading…

: codes.length === 0 ? (

No codes yet. They appear here automatically when broadcast.

) : (
{["Code", "Platform", "Result", "Value", "Claimed at"].map(h => ( ))} {codes.map(c => { const isOk = c.status === "claimed"; const ts = c.time ? new Date(c.time).toLocaleString([], { month: "numeric", day: "numeric", hour: "2-digit", minute: "2-digit" }) : "—"; const val = c.value && c.currency ? `${c.value} ${c.currency}` : "—"; return ( ); })}
{h}
{c.code} {(c.platform || "—").replace("stake_", "Stake.").replace("shuffle", "Shuffle")} {isOk ? "claimed" : "failed"} {val} {ts}
)}
); }; const AdminPanel = ({ active, user }) => { if (active === "users") return ; if (active === "broadcast") return ; if (active === "admin-claims") return ; if (active === "promos") return ; if (active === "revenue") return ; return ; }; const AdminBroadcast = () => { const authHeader = () => ({ Authorization: `Bearer ${localStorage.getItem("cc_token")}`, "content-type": "application/json" }); const PLATFORMS = [ { id: "stake_com", label: "Stake.com", desc: "API claim for all active Stake.com subscribers", color: "var(--accent)" }, { id: "stake_us", label: "Stake.us", desc: "API claim for all active Stake.us subscribers", color: "var(--accent)" }, { id: "shuffle", label: "Shuffle", desc: "Push to all connected extension users (coming soon)", color: "var(--ok)" }, { id: "thrill", label: "Thrill", desc: "Push to all connected extension users (coming soon)", color: "var(--ok)" }, ]; const [platform, setPlatform] = React.useState("stake_com"); const [code, setCode] = React.useState(""); const [sending, setSending] = React.useState(false); const [result, setResult] = React.useState(null); // { ok, message } const [history, setHistory] = React.useState([]); // last few sends const send = async () => { if (!code.trim()) return; setSending(true); setResult(null); try { const r = await fetch("/api/admin/broadcast", { method: "POST", headers: authHeader(), body: JSON.stringify({ code: code.trim(), platform }), }); const d = await r.json(); const plat = PLATFORMS.find(p => p.id === platform); const entry = { code: code.trim(), platform, label: plat.label, ok: !!d.ok, time: new Date().toLocaleTimeString() }; setHistory(h => [entry, ...h].slice(0, 10)); setResult(d.ok ? { ok: true, message: `Dispatched — all ${plat.label} users notified` } : { ok: false, message: d.error || "Server error" }); if (d.ok) setCode(""); } catch (_) { setResult({ ok: false, message: "Network error" }); } setSending(false); }; const plat = PLATFORMS.find(p => p.id === platform); return (
admin · send code

Manual broadcast

Stake codes trigger API claims instantly. Shuffle/Thrill codes push to connected extensions.

{/* Platform picker */}
Platform
{PLATFORMS.map(p => (
setPlatform(p.id)} style={{ padding: "12px 14px", borderRadius: "var(--radius-sm)", cursor: "pointer", border: `2px solid ${platform === p.id ? p.color : "var(--border)"}`, background: platform === p.id ? "var(--surf-3)" : "var(--surf-2)", transition: "border-color .15s", }}>
{p.label}
{p.desc}
))}
{/* Code input */}
Code
{ setCode(e.target.value); setResult(null); }} onKeyDown={e => e.key === "Enter" && !sending && send()} placeholder={`e.g. BOOST100`} style={{ flex: 1, fontFamily: "var(--font-mono)", letterSpacing: ".06em", fontSize: 15 }} /> {sending ? "Sending…" : `Send → ${plat.label}`}
{result && (
{result.ok ? "✓" : "✕"} {result.message}
)}
{/* Recent sends */} {history.length > 0 && (
Recent sends
{history.map((h, i) => (
{h.ok ? "✓" : "✕"} {h.code} {h.label}
{h.time}
))}
)}
); }; const AdminUsers = () => { const [users, setUsers] = React.useState([]); const [loading, setLoading] = React.useState(true); const [search, setSearch] = React.useState(""); const [busy, setBusy] = React.useState({}); const [revealed, setRevealed] = React.useState({}); const [granting, setGranting] = React.useState({}); // userId → { plan, days } | null const [grantOk, setGrantOk] = React.useState({}); const [slots, setSlots] = React.useState({}); // userId → slot[] | "loading" const [slotBusy, setSlotBusy] = React.useState({}); // slotId → true const authHeader = () => ({ Authorization: `Bearer ${localStorage.getItem("cc_token")}`, "content-type": "application/json" }); const load = () => { fetch("/api/admin/users", { headers: authHeader() }) .then(r => r.ok ? r.json() : null) .then(d => { if (d?.users) setUsers(d.users); setLoading(false); }) .catch(() => setLoading(false)); }; React.useEffect(load, []); // Toggle the per-user slots panel; fetch slots on first open const toggleSlots = (userId) => { if (slots[userId] !== undefined) { setSlots(s => { const n = { ...s }; delete n[userId]; return n; }); return; } setSlots(s => ({ ...s, [userId]: "loading" })); fetch(`/api/admin/users/${userId}/slots`, { headers: authHeader() }) .then(r => r.ok ? r.json() : null) .then(d => setSlots(s => ({ ...s, [userId]: d?.slots || [] }))) .catch(() => setSlots(s => ({ ...s, [userId]: [] }))); }; const setSlotActive = async (userId, slotId, active) => { setSlotBusy(b => ({ ...b, [slotId]: true })); try { const r = await fetch(`/api/admin/slots/${slotId}/active`, { method: "POST", headers: authHeader(), body: JSON.stringify({ active }), }); const d = await r.json(); if (d.ok) { setSlots(s => ({ ...s, [userId]: (s[userId] || []).map(sl => sl.id === slotId ? { ...sl, active } : sl), })); } } catch (_) {} setSlotBusy(b => ({ ...b, [slotId]: false })); }; const act = async (userId, action) => { setBusy(b => ({ ...b, [userId]: action })); const url = `/api/admin/users/${userId}/${action === "suspend" ? "suspend" : action + "-extension"}`; try { const r = await fetch(url, { method: "POST", headers: authHeader(), body: JSON.stringify({}) }); const d = await r.json(); if (action === "approve" && d.token) { setRevealed(rv => ({ ...rv, [userId]: d.token })); } load(); } catch (_) {} setBusy(b => ({ ...b, [userId]: null })); }; const grant = async (userId) => { const g = granting[userId] || { plan: "stake_com", days: 30 }; setBusy(b => ({ ...b, [userId]: "grant" })); try { const r = await fetch(`/api/admin/users/${userId}/grant`, { method: "POST", headers: authHeader(), body: JSON.stringify({ plan: g.plan, days: parseInt(g.days) || 30 }), }); const d = await r.json(); if (d.ok) { setGrantOk(o => ({ ...o, [userId]: true })); load(); } } catch (_) {} setBusy(b => ({ ...b, [userId]: null })); setTimeout(() => setGrantOk(o => ({ ...o, [userId]: false })), 3000); }; const filtered = users.filter(u => { if (!search) return true; const q = search.toLowerCase(); return (u.username || "").includes(q) || (u.email || "").includes(q); }); const PLAN_OPTS = [ { value: "house_cut", label: "The House Cut — $10/slot" }, { value: "prime_cut", label: "The Prime Cut — $15/slot" }, { value: "grand_feast", label: "The Grand Feast — $30/slot" }, ]; return (
admin · users

{loading ? "…" : `${users.length} users`}

Refresh
setSearch(e.target.value)} style={{ flex: 1 }} />
{loading ?

Loading…

: (
{filtered.map((u) => { const hasExt = false; // extension not yet available const isBusy = busy[u.id]; const token = revealed[u.id]; const g = granting[u.id] || { plan: "stake_com", days: "30" }; return (
{u.username || "—"} {u.email || "telegram"}
{u.plan_display || u.plan} {u.plan_expires_at && exp {new Date(u.plan_expires_at).toLocaleDateString()}} {u.is_admin && admin}
{/* Grant free subscription */}
setGranting(gr => ({ ...gr, [u.id]: { ...g, days: e.target.value } }))} placeholder="days" style={{ width: 60, fontSize: 12, padding: "4px 8px" }} /> grant(u.id)}> {isBusy === "grant" ? "…" : grantOk[u.id] ? "✓ Granted!" : "Grant free sub"} act(u.id, "suspend")} style={{ color: "var(--warn)" }}> {isBusy === "suspend" ? "…" : "Suspend"} toggleSlots(u.id)}> {slots[u.id] !== undefined ? "Hide slots" : "API slots"}
{/* Per-slot enable/disable — for wager-requirement enforcement */} {slots[u.id] !== undefined && (
{slots[u.id] === "loading" ? ( Loading slots… ) : slots[u.id].length === 0 ? ( No API slots configured. ) : (
{slots[u.id].map(sl => (
{sl.active ? "active" : "disabled"} {PLAT_LABEL[sl.platform] || sl.platform} slot {sl.slot_index} · {sl.currency} {sl.api_key_masked} setSlotActive(u.id, sl.id, !sl.active)} style={{ color: sl.active ? "var(--err)" : "var(--ok)" }}> {slotBusy[sl.id] ? "…" : sl.active ? "Disable" : "Enable"}
))}
)}
)} {/* Extension controls — only for ext-capable plans */} {hasExt && (
act(u.id, "approve")}> {isBusy === "approve" ? "…" : <> Approve ext token} act(u.id, "revoke")} style={{ color: "var(--err)", borderColor: "var(--err)" }}> {isBusy === "revoke" ? "…" : "Revoke token"}
)} {token && (
Extension token — copy and share with {u.username}. Not shown again. navigator.clipboard.writeText(token)}>
{token}
)}
); })}
)}
); }; const PLAT_LABEL = { stake_com: "Stake.com", stake_us: "Stake.us", shuffle: "Shuffle", thrill: "Thrill" }; const AdminClaims = () => { const [claims, setClaims] = React.useState([]); const [loading, setLoading] = React.useState(true); const [platform, setPlatform] = React.useState(""); const [search, setSearch] = React.useState(""); const authHeader = () => ({ Authorization: `Bearer ${localStorage.getItem("cc_token")}` }); const load = (plat) => { setLoading(true); const qs = plat ? `?platform=${plat}` : ""; fetch(`/api/admin/claims${qs}`, { headers: authHeader() }) .then(r => r.ok ? r.json() : null) .then(d => { if (d?.claims) setClaims(d.claims); setLoading(false); }) .catch(() => setLoading(false)); }; React.useEffect(() => load(platform), [platform]); const ok = claims.filter(c => c.status === "claimed").length; const total = claims.length; const rate = total ? Math.round(ok / total * 100) : 0; const filtered = claims.filter(c => { if (!search) return true; const q = search.toLowerCase(); return (c.code || "").includes(q) || (c.username || "").includes(q) || (c.platform || "").includes(q); }); return (
admin · claim history

{loading ? "…" : `${ok} / ${total} claimed · ${rate}%`}

{["", "stake_com", "stake_us", "shuffle", "thrill"].map(p => ( setPlatform(p)}> {p ? PLAT_LABEL[p] : "All"} ))} load(platform)}> Refresh
setSearch(e.target.value)} style={{ width: "100%" }} />
{loading ?

Loading…

: (
{["Status", "Code", "User", "Platform", "Value", "Speed", "Time"].map(h => ( ))} {filtered.map(c => { const ok = c.status === "claimed"; const ts = c.time ? new Date(c.time).toLocaleString([], { month: "numeric", day: "numeric", hour: "2-digit", minute: "2-digit" }) : "—"; const speed = c.elapsed_ms ? `${c.elapsed_ms}ms` : "—"; const val = c.value && c.currency ? `${c.value} ${c.currency}` : (c.message && !ok ? c.message : "—"); return ( ); })} {!filtered.length && ( )}
{h}
{ok ? "claimed" : "failed"} {c.code} {c.username} {PLAT_LABEL[c.platform] || c.platform} {val} {speed} {ts}
No claims found.
)}
); }; const AdminPromos = () => { const [promos, setPromos] = React.useState([]); const [loading, setLoading] = React.useState(true); const [form, setForm] = React.useState({ code: "", promo_type: "free_days", value: "7", max_uses: "", note: "" }); const [saving, setSaving] = React.useState(false); const [err, setErr] = React.useState(""); const authHeader = () => ({ Authorization: `Bearer ${localStorage.getItem("cc_token")}`, "content-type": "application/json" }); const load = () => { setLoading(true); fetch("/api/admin/promos", { headers: authHeader() }) .then(r => r.ok ? r.json() : null) .then(d => { if (d?.promos) setPromos(d.promos); setLoading(false); }) .catch(() => setLoading(false)); }; React.useEffect(load, []); const create = async () => { setErr(""); setSaving(true); try { const r = await fetch("/api/admin/promos", { method: "POST", headers: authHeader(), body: JSON.stringify({ code: form.code.toUpperCase(), promo_type: form.promo_type, value: parseInt(form.value) || 0, max_uses: form.max_uses ? parseInt(form.max_uses) : null, note: form.note, }), }); const d = await r.json(); if (d.error) { setErr(d.error); } else { setForm({ code: "", promo_type: "free_days", value: "7", max_uses: "", note: "" }); load(); } } catch (_) { setErr("Network error"); } setSaving(false); }; const deactivate = async (id) => { await fetch(`/api/admin/promos/${id}`, { method: "DELETE", headers: authHeader() }); load(); }; const PRESET_TYPES = [ { type: "free_days", value: 7, label: "7 days free" }, { type: "discount_pct", value: 50, label: "50% off" }, ]; return (
admin · promos

Promo Codes

Create promo
{PRESET_TYPES.map(p => ( setForm(f => ({ ...f, promo_type: p.type, value: String(p.value) }))}> {p.label} ))}
Code
setForm(f => ({ ...f, code: e.target.value.toUpperCase() }))} placeholder="e.g. WELCOME7" style={{ textTransform: "uppercase", letterSpacing: ".06em" }} />
Type
{form.promo_type === "free_days" ? "Days" : "% off"}
setForm(f => ({ ...f, value: e.target.value }))} type="number" min="1" />
Max uses
setForm(f => ({ ...f, max_uses: e.target.value }))} placeholder="∞" type="number" min="1" />
Note (admin only)
setForm(f => ({ ...f, note: e.target.value }))} placeholder="optional memo" />
{saving ? "…" : "Create"}
{err &&

{err}

}
{loading ?

Loading…

: ( {["Code", "Type", "Value", "Used", "Max", "Note", ""].map(h => ( ))} {promos.map(p => ( ))} {!promos.length && ( )}
{h}
{p.code} {p.promo_type === "free_days" ? "free days" : "% off"} {p.promo_type === "free_days" ? `${p.value}d` : `${p.value}%`} {p.used_count} {p.max_uses ?? "∞"} {p.note || "—"} {p.active && ( deactivate(p.id)} style={{ color: "var(--err)", borderColor: "var(--err)" }}> Deactivate )} {!p.active && inactive}
No promos yet.
)}
); }; const SettingsPanel = ({ user }) => { const token = () => localStorage.getItem("cc_token"); const auth = () => ({ Authorization: `Bearer ${token()}`, "content-type": "application/json" }); // Toggles — seed from user prop const [reload, setReload] = React.useState(user?.addons?.reload || false); const [daily, setDaily] = React.useState(user?.addons?.daily_dollar || false); const [proxyCom, setProxyCom] = React.useState(user?.proxy?.com_enabled ?? true); const [proxyUs, setProxyUs] = React.useState(user?.proxy?.us_enabled ?? true); const [comRegion, setComRegion] = React.useState(user?.proxy?.com_region || "norway"); const [saving, setSaving] = React.useState(false); const [saveMsg, setSaveMsg] = React.useState(""); // Turnstile slot status const [slots, setSlots] = React.useState([]); const [slotsLoading, setSlotsLoading] = React.useState(true); React.useEffect(() => { fetch("/api/me/slots/status", { headers: { Authorization: `Bearer ${token()}` } }) .then(r => r.ok ? r.json() : null) .then(d => { if (d?.slots) setSlots(d.slots); }) .catch(() => {}) .finally(() => setSlotsLoading(false)); }, []); const saveSettings = async () => { setSaving(true); setSaveMsg(""); try { await fetch("/api/me/settings", { method: "POST", headers: auth(), body: JSON.stringify({ reload_enabled: reload, daily_dollar_enabled: daily, proxy_com_enabled: proxyCom, proxy_us_enabled: proxyUs }), }); if (proxyCom) { await fetch("/api/me/proxy-region", { method: "POST", headers: auth(), body: JSON.stringify({ com_region: comRegion }), }); } setSaveMsg("Saved."); } catch { setSaveMsg("Error saving — try again"); } setSaving(false); setTimeout(() => setSaveMsg(""), 3000); }; const COM_REGIONS = [ { value: "norway", label: "Norway (recommended)" }, { value: "malta", label: "Malta" }, { value: "japan", label: "Japan" }, ]; const Toggle = ({ label, hint, value, onChange, disabled, futureUse }) => (
{label} {futureUse && for future use}
{hint &&

{hint}

}
); const tokenAge = (s) => { if (!s.has_token) return "—"; if (s.age_seconds == null) return "unknown"; if (s.age_seconds < 60) return `${s.age_seconds}s old`; return `${Math.round(s.age_seconds / 60)}m old`; }; return (
settings

Account settings

{/* ── Proxy settings ── */}
Proxy
{proxyCom && (
{ setPromoCode(e.target.value.toUpperCase()); setPromoInfo(null); setPromoErr(""); }} placeholder="ENTER CODE" style={{ flex: 1, textTransform: "uppercase", letterSpacing: ".08em" }} /> {checking ? "…" : "Apply"}
{promoInfo && (
Applied {promoInfo.description}
)} {promoErr &&

{promoErr}

}
How many API slots?
{[1, 2, 3, 4].map(n => ( ))}
{plan.name} × {slotCount} ${plan.price} × {slotCount} = ${baseTotal}/mo
Reloads + Stake.us daily dollar included
{promoInfo?.promo_type === "free_days" && (
+ {promoInfo.value} free days free
)} {discountedPrice && (
{promoInfo.value}% discount −${(baseTotal - parseFloat(discountedPrice)).toFixed(2)}
)}
Total ${discountedPrice ?? baseTotal}/mo
{payErr &&

{payErr}

} {checkingOut ? "Starting…" : "Pay with crypto →"}

Powered by NOWPayments · BTC, ETH, USDT and more

); }; const PLAN_LABELS = { free: "Free Taste", house_cut: "The House Cut", prime_cut: "The Prime Cut", grand_feast: "The Grand Feast", // Legacy IDs still possible on in-flight rows mid-deploy stake_com: "The House Cut", stake_us: "The House Cut", bundle: "The House Cut", shuffle: "The House Cut", wild_card: "The House Cut", stake_runner: "The House Cut", god_mode: "The House Cut", }; const PLAN_PRICES = { house_cut: 10, prime_cut: 15, grand_feast: 30 }; const AdminRevenue = () => { const [rev, setRev] = React.useState(null); const [loading, setLoading] = React.useState(true); const token = localStorage.getItem("cc_token"); React.useEffect(() => { fetch("/api/admin/revenue", { headers: { Authorization: `Bearer ${token}` } }) .then(r => r.ok ? r.json() : null) .then(d => { if (d) setRev(d); setLoading(false); }) .catch(() => setLoading(false)); }, []); if (loading) return

Loading…

; if (!rev) return

Failed to load revenue data.

; const byPlan = rev.by_plan || {}; return (
admin · revenue

${rev.mrr.toFixed(2)} MRR

{rev.active_subs} active subscribers · ${rev.arpu} ARPU

Subscribers by plan
{Object.entries(byPlan).map(([plan, count]) => { const price = PLAN_PRICES[plan] || 0; const label = PLAN_LABELS[plan] || plan; const planMrr = count * price; return (
{label} 0 ? "ok" : ""} dot={count > 0}>{count} users ${planMrr}/mo
); })}
); }; const AdminHealth = () => { const [stats, setStats] = React.useState(null); const [services, setServices] = React.useState(null); const [loading, setLoading] = React.useState(true); const authHeader = () => ({ Authorization: `Bearer ${localStorage.getItem("cc_token")}` }); const load = () => { setLoading(true); Promise.all([ fetch("/api/admin/stats", { headers: authHeader() }).then(r => r.ok ? r.json() : null), fetch("/api/admin/services", { headers: authHeader() }).then(r => r.ok ? r.json() : null), ]).then(([s, sv]) => { if (s) setStats(s); if (sv) setServices(sv); setLoading(false); }).catch(() => setLoading(false)); }; React.useEffect(() => { load(); }, []); if (loading) return

Loading…

; if (!stats) return

Not authorised or failed to load.

; // turnstile pool — shape: { backend, solver_enabled, stake_com:{tokens,max}, // stake_us:{tokens,max}, solves:{ok,failed,last_ok_at,last_error,last_error_at} } const ts = stats.turnstile || {}; const comPool = ts.stake_com?.tokens ?? 0; const comMax = ts.stake_com?.max ?? 0; const usPool = ts.stake_us?.tokens ?? 0; const usMax = ts.stake_us?.max ?? 0; // Solver is "erroring" only if its most recent failure is newer than its // most recent success — a stale error after recovery shouldn't alarm. const solverErroring = !!ts.solves?.last_error && (ts.solves.last_error_at || 0) > (ts.solves.last_ok_at || 0); // services — shape: { summary:{running,dead,cancelled}, cache_age_s, reload_users, daily_users, tasks:[…] } const sum = services?.summary || { running: 0, dead: 0, cancelled: 0 }; const tasks = services?.tasks || []; const fmtAgo = (epoch) => { if (!epoch) return "never"; const s = Math.max(0, Math.round(Date.now() / 1000 - epoch)); if (s < 60) return `${s}s ago`; if (s < 3600) return `${Math.round(s / 60)}m ago`; return `${Math.round(s / 3600)}h ago`; }; return (
admin · service health

Service health

claimer · live 0 ? "ok" : ""} dot={stats.sse_live > 0}>{stats.sse_live} SSE 0 ? "err" : "ok"} dot> {sum.dead > 0 ? `${sum.dead} task(s) dead` : `${sum.running} task(s) live`} {solverErroring ? "solver erroring" : "solver ok"} Refresh
Turnstile pool
solver backend {ts.backend || "—"}
solver enabled {ts.solver_enabled ? "yes" : "no"}
solves (ok / failed) {(ts.solves?.ok ?? 0)} / {(ts.solves?.failed ?? 0)}
last successful solve {fmtAgo(ts.solves?.last_ok_at)}
{ts.solves?.last_error && (
last solver error {ts.solves.last_error}
)}
user cache age {services?.cache_age_s != null ? `${services.cache_age_s}s` : "—"}
Plans breakdown
{Object.entries(stats.by_plan || {}).map(([plan, count]) => (
{PLAN_LABELS[plan] || plan} {count}
))}
{/* Claim engines — reload + daily-dollar background tasks */}
Claim engines · reload + daily-dollar
{sum.running} running {sum.dead > 0 && {sum.dead} dead} {services?.reload_users ?? 0} reload · {services?.daily_users ?? 0} daily
{tasks.length === 0 ? (

No background tasks running — no users have reload or daily-dollar enabled.

) : (
{["Engine", "Platform", "User", "State", "Last claim"].map(h => ( ))} {tasks.map((t, i) => ( ))}
{h}
{t.engine === "daily_dollar" ? "Daily dollar" : "Reload"} {PLAT_LABEL[t.platform] || t.platform} {(t.user_id || "").slice(0, 8)} {t.state} {fmtAgo(t.last_claim)}
)}
); }; Object.assign(window, { Dashboard });