Rewrite CutOS console host header

This commit is contained in:
yankun
2026-08-02 18:20:17 +08:00
parent 40ca8cd5af
commit b53ef2a890
3 changed files with 33 additions and 2 deletions
+7 -1
View File
@@ -153,8 +153,12 @@ function downloadFile(url, dest) {
}
function writeFrpcConfig(clawId, frpConfig, sshSecretKey, dashboardEnabled = true) {
const { auth_token, dashboard_local_port = 18789 } = frpConfig;
const { auth_token, dashboard_local_port = 18789, dashboard_host_header } = frpConfig;
const ttyRemotePort = 10000 + Number(clawId);
const dashboardHostHeader = String(dashboard_host_header || '').trim();
const dashboardHostHeaderLine = dashboardHostHeader
? `hostHeaderRewrite = "${dashboardHostHeader.replace(/"/g, '\\"')}"`
: '';
const stcpBlock = sshSecretKey ? `
[[proxies]]
name = "ssh-${clawId}-secret"
@@ -175,6 +179,7 @@ name = "dashboard-${clawId}"
type = "http"
localPort = ${dashboard_local_port}
subdomain = "${clawId}"
${dashboardHostHeaderLine}
` : '';
const toml = `# 由 clawd 自动生成,请勿手动修改
serverAddr = "frp.claw.cutos.ai"
@@ -236,5 +241,6 @@ module.exports = {
getDashboardInfo,
resolveOpenclawConfigFile,
startTtyd,
writeFrpcConfig,
FrpcManager,
};