import Link from "next/link"; import { ActionForm } from "@/components/action-form"; import { Input } from "@/components/ui/input"; import { buttonVariants } from "@/components/ui/button"; import { SubmitButton } from "@/components/submit-button"; import { CopyButton } from "@/components/copy-button"; import { listCertificates } from "@/lib/certificates"; import { listInstallations } from "@/lib/provisioning"; import { formatLocalDateTime } from "@/lib/datetime"; import { uploadCertificateAction, deleteCertificateAction, createInstallationAction, revokeInstallationAction, } from "./actions"; export default async function CertificatesPage() { const [certificates, installations] = await Promise.all([ listCertificates(), listInstallations(), ]); const now = new Date().getTime(); return (
部署

证书与自动安装

上传证书 → 生成脚本 → 在服务器设置端口,自动安装并注册节点。

上传证书

使用 PEM 格式、未加密私钥。平台加密存储私钥,页面不回显。上传替换证书需创建新记录;已安装节点不会自动更新或续期。

上传证书

托管证书

{certificates.length} 张
{certificates.length === 0 ? (

还没有证书,请先上传。

) : ( certificates.map((cert) => { const expired = Date.parse(cert.expires_at) <= now; const soon = Date.parse(cert.expires_at) < now + 30 * 86400_000; return (
{cert.name}

到期:{formatLocalDateTime(cert.expires_at)}

{expired ? "已过期" : soon ? "30 天内到期" : "有效"} 删除
); }) )}

生成服务器安装脚本

脚本适用于使用 systemd 的 Linux(x86_64 / ARM64 / ARMv7),以 root 执行。运行时输入 jp1 等域名前缀(自动补全 .p.xn--876a.net)、HY2 UDP 和统计 API TCP 端口;支持 NAT 内外端口不同。域名用于节点地址和 SNI,请预先解析到服务器公网 IP。证书须覆盖 *.p.xn--876a.net。

生成安装脚本

安装记录

查看节点同步状态

下载后执行 sudo bash install-节点Slug.sh。脚本含有效期 24 小时的安装凭据,请妥善保管;安装成功后自动失效。也支持 --domain jp1.p.xn--876a.net --hy2-port 端口 --stats-port 端口。重试需使用相同域名和端口。删除记录不删除已注册节点。

{installations.length === 0 ? (

生成的脚本会出现在这里。

) : ( installations.map((job) => { const expired = Date.parse(job.expires_at) <= now; const available = !job.completed_at && !job.revoked_at && !expired; const status = job.completed_at ? "已安装" : job.revoked_at ? "已撤销" : expired ? "已过期" : job.node_id ? "待完成,可重试" : "等待安装"; return (
{job.name}

{job.slug} · {job.server_host || "域名在脚本中设置"} ·{" "} {job.certificate_name}

凭据到期:{formatLocalDateTime(job.expires_at)}
{status}
{available && ( <> 下载 SH 撤销 )} 删除记录
); }) )}
); }