// System const { Modal, Seg, useToast } = window.UI; function PageSystem({ state, dispatch }) { const [logLevel, setLogLevel] = React.useState("info"); const [tokenOpen, setTokenOpen] = React.useState(false); const [savingLog, setSavingLog] = React.useState(false); const stats = state.stats || {}; const traffic = stats.traffic || {}; const runtime = stats.runtime || {}; const tokenHours = state.auth?.seconds ? Math.max(1, Math.round(state.auth.seconds / 3600)) : 0; const toast = useToast(); React.useEffect(() => { if (runtime.log_level) setLogLevel(runtime.log_level); }, [runtime.log_level]); const saveLogLevel = async (level) => { setLogLevel(level); setSavingLog(true); try { const next = await window.PG_API.updateLogging({ level }); setLogLevel(next.log_level || level); toast("Log level saved"); await dispatch({ type: "refreshData" }); } catch (err) { toast(err.message); } finally { setSavingLog(false); } }; const exportConfig = async () => { try { const data = await window.PG_API.exportConfig(); const blob = new Blob([JSON.stringify(data, null, 2)], { type: "application/json" }); const url = URL.createObjectURL(blob); const a = document.createElement("a"); const stamp = new Date().toISOString().replace(/[:.]/g, "-"); a.href = url; a.download = `chijie-config-${stamp}.json`; a.click(); URL.revokeObjectURL(url); toast("Config exported"); } catch (err) { toast(err.message); } }; return (

System

Listen ports, admin auth, hot reload and runtime status.

Proxy API

Bearer-protected
Listen
{runtime.proxy_listen || "—"}
TLS
{runtime.proxy_tls ? "enabled" : "disabled"}
Auth
Authorization: Bearer
Token

Admin API

JWT-protected
Listen
{runtime.admin_listen || "—"}
Auth
{runtime.auth_enabled === false ? "disabled" : "Password + JWT"}
JWT
{tokenHours ? `${tokenHours}h remaining` : "active"}
Pools
{stats.pools_count ?? state.pools.length}

Runtime

Version
{runtime.version || "chijie"}
Go
{runtime.go_version || "—"}
Uptime
{stats.uptime || "—"}
Fingerprints
{stats.fingerprints ?? state.fingerprints.length}
Requests
{traffic.requests ?? 0}
Success rate
{traffic.requests ? `${(traffic.success_rate * 100).toFixed(1)}%` : "—"}

Logging

{savingLog &&
Saving log level…
}

Hot reload

re-read configs without restarting
Runtime uptime: {stats.uptime || "—"}
setTokenOpen(false)} />
); } function CreateProxyTokenModal({ open, onClose }) { const [name, setName] = React.useState("proxy-api"); const [duration, setDuration] = React.useState("30d"); const [result, setResult] = React.useState(null); const [creating, setCreating] = React.useState(false); const toast = useToast(); React.useEffect(() => { if (!open) { setResult(null); setCreating(false); } }, [open]); const copy = async (text) => { try { await navigator.clipboard.writeText(text); toast("Copied"); } catch { toast("Copy failed"); } }; const submit = async () => { setCreating(true); try { const data = await window.PG_API.createProxyToken({ name, duration }); setResult(data); toast("Proxy token created"); } catch (err) { toast(err.message); } finally { setCreating(false); } }; return ( {result?.token && } }>
setName(e.target.value)} placeholder="billing-worker"/>
{result?.token && ( <>