diff --git a/lib/frpc.js b/lib/frpc.js index ece4077..7b0b266 100644 --- a/lib/frpc.js +++ b/lib/frpc.js @@ -164,6 +164,7 @@ function downloadFile(url, dest) { */ function writeFrpcConfig(clawId, frpConfig) { const { server, port, auth_token, dashboard_local_port = 18789 } = frpConfig; + const ttyRemotePort = 10000 + Number(clawId); const toml = `# 由 clawd 自动生成,请勿手动修改 serverAddr = "${server}" serverPort = ${port} @@ -180,13 +181,13 @@ subdomain = "${clawId}" [[proxies]] name = "tty-${clawId}" -type = "http" +type = "tcp" localPort = ${TTYD_PORT} -subdomain = "tty-${clawId}" +remotePort = ${ttyRemotePort} `; fs.mkdirSync(CONFIG_DIR, { recursive: true }); fs.writeFileSync(FRPC_CONFIG, toml, 'utf8'); - console.log(`[frpc] frpc.toml 已写入: dashboard subdomain=${clawId}, tty subdomain=tty-${clawId}`); + console.log(`[frpc] frpc.toml 已写入: dashboard subdomain=${clawId}, tty tcp-port=${ttyRemotePort}`); } class FrpcManager {