import Link from "next/link"; import { requireCloudViewer } from "../cloud-auth"; import { DashboardShell, PageHeading, StatusPill, formatDate, } from "../components/Shells"; import { getDashboardSnapshot, getOrCreateAccount } from "@/db/repository"; import { getConnectionCopy } from "./connection-copy"; import { OpenPwaButton } from "./OpenPwaButton"; import { deriveControlPlaneContact } from "@/db/device-control-plane"; import { deriveBetaOnboarding } from "./onboarding"; export const dynamic = "force-dynamic"; export default async function DashboardPage() { const viewer = await requireCloudViewer("/dashboard"); const account = await getOrCreateAccount(viewer); const snapshot = await getDashboardSnapshot(account); const activeHosts = snapshot.hosts.filter((host) => host.lifecycle === "active"); const entitlement = snapshot.entitlement; const connection = getConnectionCopy(snapshot.connection.state); const onboarding = deriveBetaOnboarding({ entitlement, hasPendingRequest: snapshot.accessRequests.some((request) => request.status === "requested"), }); const entitlementLabel = entitlement.mode === "public_beta" ? "公测免费" : entitlement.mode === "grant" ? "闭测邀请" : entitlement.publicBetaState === "gated" ? "等待安全门禁" : "无有效权益"; const entitlementDetail = entitlement.mode === "none" && entitlement.publicBetaState === "gated" ? `公开接入仍有 ${entitlement.blockedP0} 项 P0 未通过;管理员邀请账户可继续闭测` : entitlement.unlimited ? "费用全免;当前策略未按槽位限额" : `可用 ${entitlement.availableSlots ?? 0} 个槽位`; return (
: {onboarding.primaryLabel}} />
当前权益 {entitlementLabel} {entitlementDetail}
启用主机 {entitlement.activeSlots} {entitlement.reservedSlots ? `${entitlement.reservedSlots} 个配对请求占位中` : "没有等待配对的占位"}
租户运行态 {connection.label} {snapshot.connection.homeRegion ? `${snapshot.connection.homeRegion} · generation ${snapshot.connection.placementGeneration ?? "-"}` : "等待 home region 分配"}
下次付款 公测不绑支付方式,也不会自动续费
主机

接入状态

查看全部 →
{activeHosts.length ? (
{activeHosts.slice(0, 4).map((host) => { const contact = deriveControlPlaneContact(host.control_plane_last_seen_at); return (
{host.os === "windows" ? "W" : "L"}
{host.name}{host.daemon_version || "daemon 版本待上报"}
{contact.label} {host.control_plane_last_seen_at ? formatDate(host.control_plane_last_seen_at, true) : "等待首次 Relay 授权"}
); })}
) : (

还没有已认领的主机

先创建一次性引导凭证。daemon 完成控制面认领后,会在同一个稳定服务地址等待共享 Relay 就绪。

创建配对请求
)}
当前需要注意

诚实状态

{onboarding.state !== "ready" &&
{onboarding.state === "request_pending" ? "审核中" : onboarding.state === "request_needed" ? "先申请" : "容量已满"}
{onboarding.title}

{onboarding.detail} {onboarding.primaryLabel} →

}
{connection.label}
{connection.detail}

{connection.nextStep}

{entitlement.publicBetaState === "gated" &&
公开接入冻结
P0 门禁不能被免费政策绕过

新公开配对暂不开放;管理员明确签发的免费闭测邀请仍可继续。

}
公测
报价与订单不开放

当前没有任何付款流程;先把主机接入、恢复和稳定性做好。

规则
公测结束不自动转付费

收费方案以后再定;未主动确认前不会创建付费关系。

CONNECTION PATH

按当前状态完成下一步。

  1. 01
    获得免费测试资格

    {onboarding.title}。{onboarding.detail}

  2. 02
    创建短时配对请求

    有可用免费名额后,控制平面生成十分钟一次性码。

  3. 03
    daemon 认领并证明主机身份

    控制面签发独立设备令牌,并推进租户 authorization revision。

  4. 04
    共享 sealed Relay 就绪

    {snapshot.connection.state === "ready" ? "daemon 保持稳定服务地址即可连接。" : "等待租户 placement 指向健康节点;不会向客户端释放后端节点 URL。"}

); }