fix(frpc): ttyd switch to tcp proxy to fix ws bidirectional issue

Made-with: Cursor
This commit is contained in:
stswangzhiping
2026-03-15 22:55:27 +08:00
parent c0c445b61d
commit 54476c82b6

View File

@@ -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 {