fix setting the custom cloudflared bin directory

This commit is contained in:
Egor 2025-12-03 18:27:36 -08:00
parent 9ecf1c6757
commit 39ac48d44f

View file

@ -1,6 +1,6 @@
import fs from 'fs'; import fs from 'fs';
import path from 'path'; import path from 'path';
import { Tunnel, install } from 'cloudflared'; import { Tunnel, install, use as setCloudflaredBin } from 'cloudflared';
import { platform } from 'process'; import { platform } from 'process';
import { logError } from '@/utils/node/logging'; import { logError } from '@/utils/node/logging';
@ -42,15 +42,14 @@ export const startTunnel = async (
const bin = getCloudflaredBin(); const bin = getCloudflaredBin();
if (!fs.existsSync(bin)) { if (!fs.existsSync(bin)) {
sendKoboldOutput('Installing cloudflared binary...'); sendKoboldOutput(`Installing cloudflared binary to ${bin}...`);
await install(bin); await install(bin);
} }
setCloudflaredBin(bin);
const tunnelTarget = getTunnelTarget(frontendPreference); const tunnelTarget = getTunnelTarget(frontendPreference);
const tunnel = Tunnel.quick(tunnelTarget, { const tunnel = Tunnel.quick(tunnelTarget, { '--no-autoupdate': true });
'--no-autoupdate': true,
bin,
});
activeTunnel = tunnel; activeTunnel = tunnel;
let rateLimited = false; let rateLimited = false;