feat: 支持证书托管和节点自动安装

This commit is contained in:
2026-09-29 13:06:56 +08:00
parent ab7d1c937a
commit 586c2399d1
20 changed files with 1600 additions and 20 deletions
+21
View File
@@ -0,0 +1,21 @@
import { readFileSync } from "node:fs";
import path from "node:path";
import { decryptText } from "@/lib/crypto";
import type { Installation } from "@/lib/provisioning";
const quote = (value: string) => "'" + value.replaceAll("'", "'\\''") + "'";
export function buildInstallScript(job: Installation) {
const token = decryptText(job.token_encrypted);
if (!token) throw new Error("installation_token_unavailable");
const values: Record<string, string> = {
PANEL: job.origin,
TOKEN: token,
INSTALL_ID: job.id,
SLUG: job.slug,
};
return readFileSync(
path.join(process.cwd(), "lib/templates/install-node.sh"),
"utf8",
).replace(/__(PANEL|TOKEN|INSTALL_ID|SLUG)__/g, (_, key) =>
quote(values[key]),
);
}