voicecc 1.1.27 → 1.1.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/voicecc.js +14 -1
- package/package.json +1 -1
- package/server/services/tunnel.ts +4 -7
package/bin/voicecc.js
CHANGED
|
@@ -24,7 +24,20 @@ const PKG_ROOT = join(__dirname, "..");
|
|
|
24
24
|
const TSX_BIN = join(PKG_ROOT, "node_modules", ".bin", "tsx");
|
|
25
25
|
const ENV_PATH = join(PKG_ROOT, ".env");
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
// When running as root on Linux, use the voicecc user's home directory so
|
|
28
|
+
// both the CLI (root) and the server process (voicecc user) can access the
|
|
29
|
+
// same status/PID files. /root is typically mode 700, so a non-root user
|
|
30
|
+
// cannot traverse it to reach /root/.voicecc.
|
|
31
|
+
let voiceccDir = join(homedir(), ".voicecc");
|
|
32
|
+
if (process.getuid && process.getuid() === 0 && platform() === "linux") {
|
|
33
|
+
try {
|
|
34
|
+
const voiceccHome = execSync(`eval echo ~voicecc`, { encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"] }).trim();
|
|
35
|
+
if (voiceccHome && !voiceccHome.startsWith("~")) {
|
|
36
|
+
voiceccDir = join(voiceccHome, ".voicecc");
|
|
37
|
+
}
|
|
38
|
+
} catch { /* voicecc user doesn't exist yet, use default */ }
|
|
39
|
+
}
|
|
40
|
+
const VOICECC_DIR = voiceccDir;
|
|
28
41
|
const PID_FILE = join(VOICECC_DIR, "voicecc.pid");
|
|
29
42
|
const LOG_FILE = join(VOICECC_DIR, "voicecc.log");
|
|
30
43
|
const STATUS_FILE = join(VOICECC_DIR, "status.json");
|
package/package.json
CHANGED
|
@@ -140,13 +140,10 @@ async function createTunnel(port: number): Promise<string> {
|
|
|
140
140
|
console.log(`[cloudflared] ${data.trim()}`);
|
|
141
141
|
});
|
|
142
142
|
|
|
143
|
-
//
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
tunnel.on("disconnected", (conn: { id: string; ip: string; location: string }) => {
|
|
148
|
-
console.log(`[cloudflared] Disconnected: ${conn.location} (${conn.ip})`);
|
|
149
|
-
});
|
|
143
|
+
// Note: we intentionally skip tunnel.on("connected"/"disconnected") here.
|
|
144
|
+
// The cloudflared package fires processOutput() on both stdout and stderr,
|
|
145
|
+
// so those events fire twice per connection. The raw stderr handler above
|
|
146
|
+
// already captures connection info from cloudflared's own log lines.
|
|
150
147
|
|
|
151
148
|
// Wait for the tunnel URL or fail
|
|
152
149
|
const url = await new Promise<string>((resolve, reject) => {
|