fix: use resolveStateDir() for node-pairing and voicewake storage
Both node-pairing.ts and voicewake.ts were using a local defaultBaseDir() that hardcoded ~/.clawdbot, ignoring CLAWDBOT_STATE_DIR. This caused nodes/paired.json and settings/voicewake.json to be stored in ~/.clawdbot instead of the configured state directory. Fixes the bug where paired nodes config was stored in a different location than the rest of the gateway state.
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import { randomUUID } from "node:crypto";
|
import { randomUUID } from "node:crypto";
|
||||||
import fs from "node:fs/promises";
|
import fs from "node:fs/promises";
|
||||||
import os from "node:os";
|
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
|
import { resolveStateDir } from "../config/paths.js";
|
||||||
|
|
||||||
export type NodePairingPendingRequest = {
|
export type NodePairingPendingRequest = {
|
||||||
requestId: string;
|
requestId: string;
|
||||||
@@ -48,12 +48,8 @@ type NodePairingStateFile = {
|
|||||||
|
|
||||||
const PENDING_TTL_MS = 5 * 60 * 1000;
|
const PENDING_TTL_MS = 5 * 60 * 1000;
|
||||||
|
|
||||||
function defaultBaseDir() {
|
|
||||||
return path.join(os.homedir(), ".clawdbot");
|
|
||||||
}
|
|
||||||
|
|
||||||
function resolvePaths(baseDir?: string) {
|
function resolvePaths(baseDir?: string) {
|
||||||
const root = baseDir ?? defaultBaseDir();
|
const root = baseDir ?? resolveStateDir();
|
||||||
const dir = path.join(root, "nodes");
|
const dir = path.join(root, "nodes");
|
||||||
return {
|
return {
|
||||||
dir,
|
dir,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { randomUUID } from "node:crypto";
|
import { randomUUID } from "node:crypto";
|
||||||
import fs from "node:fs/promises";
|
import fs from "node:fs/promises";
|
||||||
import os from "node:os";
|
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
|
import { resolveStateDir } from "../config/paths.js";
|
||||||
|
|
||||||
export type VoiceWakeConfig = {
|
export type VoiceWakeConfig = {
|
||||||
triggers: string[];
|
triggers: string[];
|
||||||
@@ -10,12 +10,8 @@ export type VoiceWakeConfig = {
|
|||||||
|
|
||||||
const DEFAULT_TRIGGERS = ["clawd", "claude", "computer"];
|
const DEFAULT_TRIGGERS = ["clawd", "claude", "computer"];
|
||||||
|
|
||||||
function defaultBaseDir() {
|
|
||||||
return path.join(os.homedir(), ".clawdbot");
|
|
||||||
}
|
|
||||||
|
|
||||||
function resolvePath(baseDir?: string) {
|
function resolvePath(baseDir?: string) {
|
||||||
const root = baseDir ?? defaultBaseDir();
|
const root = baseDir ?? resolveStateDir();
|
||||||
return path.join(root, "settings", "voicewake.json");
|
return path.join(root, "settings", "voicewake.json");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user