@fudrouter/fsrouter 0.6.102 → 0.6.103
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/dist/lib/appUpdater.js +2 -2
- package/dist/lib/dataDir.js +35 -10
- package/dist/lib/mitmAliasCache.js +1 -1
- package/dist/lib/tunnel/tailscale/tailscale.js +1 -1
- package/dist/lib/updater/updater.js +1 -1
- package/dist/routes/automation/codebuddy/[id]/route.js +1 -1
- package/dist/routes/automation/codebuddy/route.js +1 -1
- package/dist/routes/automation/openvecta/route.js +1 -1
- package/package.json +1 -1
package/dist/lib/appUpdater.js
CHANGED
|
@@ -13,7 +13,7 @@ function killMitmByPidFile() {
|
|
|
13
13
|
const mitmPidFile = path.join(
|
|
14
14
|
process.platform === "win32"
|
|
15
15
|
? path.join(process.env.APPDATA || "", "9router")
|
|
16
|
-
: path.join(os.homedir(), ".
|
|
16
|
+
: path.join(os.homedir(), ".fsrouter"),
|
|
17
17
|
"mitm",
|
|
18
18
|
".mitm.pid"
|
|
19
19
|
);
|
|
@@ -108,7 +108,7 @@ function getDataDir() {
|
|
|
108
108
|
if (process.platform === "win32") {
|
|
109
109
|
return path.join(process.env.APPDATA || path.join(os.homedir(), "AppData", "Roaming"), "9router");
|
|
110
110
|
}
|
|
111
|
-
return path.join(os.homedir(), ".
|
|
111
|
+
return path.join(os.homedir(), ".fsrouter");
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
function resolveBundledUpdaterPath() {
|
package/dist/lib/dataDir.js
CHANGED
|
@@ -2,7 +2,8 @@ import fs from "node:fs";
|
|
|
2
2
|
import path from "path";
|
|
3
3
|
import os from "os";
|
|
4
4
|
|
|
5
|
-
const APP_NAME = "
|
|
5
|
+
const APP_NAME = "fsrouter";
|
|
6
|
+
const LEGACY_APP_NAME = "amrouter";
|
|
6
7
|
|
|
7
8
|
function defaultDir() {
|
|
8
9
|
if (process.platform === "win32") {
|
|
@@ -11,19 +12,43 @@ function defaultDir() {
|
|
|
11
12
|
return path.join(os.homedir(), `.${APP_NAME}`);
|
|
12
13
|
}
|
|
13
14
|
|
|
15
|
+
function legacyDir() {
|
|
16
|
+
if (process.platform === "win32") {
|
|
17
|
+
return path.join(process.env.APPDATA || path.join(os.homedir(), "AppData", "Roaming"), LEGACY_APP_NAME);
|
|
18
|
+
}
|
|
19
|
+
return path.join(os.homedir(), `.${LEGACY_APP_NAME}`);
|
|
20
|
+
}
|
|
21
|
+
|
|
14
22
|
export function getDataDir() {
|
|
15
23
|
const configured = process.env.DATA_DIR;
|
|
16
|
-
if (
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
if (configured) {
|
|
25
|
+
try {
|
|
26
|
+
fs.mkdirSync(configured, { recursive: true });
|
|
27
|
+
return configured;
|
|
28
|
+
} catch (e) {
|
|
29
|
+
if (e?.code === "EACCES" || e?.code === "EPERM") {
|
|
30
|
+
console.warn(`[DATA_DIR] '${configured}' not writable → fallback ~/.${APP_NAME}`);
|
|
31
|
+
return defaultDir();
|
|
32
|
+
}
|
|
33
|
+
throw e;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const dir = defaultDir();
|
|
37
|
+
// Backward-compat: if the new dir doesn't exist yet but the legacy `amrouter`
|
|
38
|
+
// dir does, migrate it (rename) so existing data isn't lost on first launch.
|
|
39
|
+
if (!fs.existsSync(dir)) {
|
|
40
|
+
const old = legacyDir();
|
|
41
|
+
if (fs.existsSync(old)) {
|
|
42
|
+
try {
|
|
43
|
+
fs.renameSync(old, dir);
|
|
44
|
+
console.log(`[DATA_DIR] Migrated legacy data folder ${old} → ${dir}`);
|
|
45
|
+
} catch (e) {
|
|
46
|
+
console.warn(`[DATA_DIR] Could not migrate ${old} → ${dir}: ${e.message}`);
|
|
47
|
+
}
|
|
24
48
|
}
|
|
25
|
-
throw e;
|
|
26
49
|
}
|
|
50
|
+
try { fs.mkdirSync(dir, { recursive: true }); } catch { /* ignore */ }
|
|
51
|
+
return dir;
|
|
27
52
|
}
|
|
28
53
|
|
|
29
54
|
export const DATA_DIR = getDataDir();
|
|
@@ -8,7 +8,7 @@ import os from "os";
|
|
|
8
8
|
const DATA_DIR = process.env.DATA_DIR
|
|
9
9
|
|| (process.platform === "win32"
|
|
10
10
|
? path.join(process.env.APPDATA || path.join(os.homedir(), "AppData", "Roaming"), "9router")
|
|
11
|
-
: path.join(os.homedir(), ".
|
|
11
|
+
: path.join(os.homedir(), ".fsrouter"));
|
|
12
12
|
|
|
13
13
|
const CACHE_FILE = path.join(DATA_DIR, "mitm", "aliases.json");
|
|
14
14
|
|
|
@@ -460,7 +460,7 @@ function isDaemonTunMode() {
|
|
|
460
460
|
* Start tailscaled.
|
|
461
461
|
* - With sudoPassword: TUN mode (root) → Funnel TLS works
|
|
462
462
|
* - Without: userspace-networking fallback (no sudo, but Funnel TLS unstable)
|
|
463
|
-
* State always lives in ~/.
|
|
463
|
+
* State always lives in ~/.fsrouter/tailscale/ via --statedir.
|
|
464
464
|
*/
|
|
465
465
|
export async function startDaemonWithPassword(sudoPassword) {
|
|
466
466
|
if (IS_WINDOWS) {
|
|
@@ -28,7 +28,7 @@ function getDataDir() {
|
|
|
28
28
|
if (process.platform === "win32") {
|
|
29
29
|
return path.join(process.env.APPDATA || path.join(os.homedir(), "AppData", "Roaming"), "9router");
|
|
30
30
|
}
|
|
31
|
-
return path.join(os.homedir(), ".
|
|
31
|
+
return path.join(os.homedir(), ".fsrouter");
|
|
32
32
|
}
|
|
33
33
|
const updateDir = path.join(getDataDir(), "update");
|
|
34
34
|
try { fs.mkdirSync(updateDir, { recursive: true }); } catch { /* best effort */ }
|
|
@@ -255,7 +255,7 @@ function executeCodeBuddySignupSingle(accountId, jobId, settings) {
|
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
257
|
try {
|
|
258
|
-
const logDir = path.join(process.env.DATA_DIR || path.join(process.env.HOME || process.env.USERPROFILE || "/tmp", ".
|
|
258
|
+
const logDir = path.join(process.env.DATA_DIR || path.join(process.env.HOME || process.env.USERPROFILE || "/tmp", ".fsrouter"), "logs");
|
|
259
259
|
fs.mkdirSync(logDir, { recursive: true });
|
|
260
260
|
fs.appendFileSync(`${logDir}/automation_spawn.log`, `[${new Date().toISOString()}] [id]/route.js spawning python: ${venvPython} ${args.join(" ")}\n`);
|
|
261
261
|
}
|
|
@@ -898,7 +898,7 @@ function executeCodeBuddySignup(accountId, jobId, idx, settings, jobStartTimes =
|
|
|
898
898
|
}
|
|
899
899
|
}
|
|
900
900
|
try {
|
|
901
|
-
const logDir = path.join(process.env.DATA_DIR || path.join(process.env.HOME || process.env.USERPROFILE || "/tmp", ".
|
|
901
|
+
const logDir = path.join(process.env.DATA_DIR || path.join(process.env.HOME || process.env.USERPROFILE || "/tmp", ".fsrouter"), "logs");
|
|
902
902
|
fs.mkdirSync(logDir, { recursive: true });
|
|
903
903
|
fs.appendFileSync(`${logDir}/automation_spawn.log`, `[${new Date().toISOString()}] route.js spawning python: ${venvPython} ${args.join(" ")}\n`);
|
|
904
904
|
}
|
|
@@ -241,7 +241,7 @@ export async function POST_handler(req, res) {
|
|
|
241
241
|
// ── Background runner ─────────────────────────────────────────────────────────
|
|
242
242
|
async function runOpenVectaSignup(jobId, email, venvPython, args) {
|
|
243
243
|
try {
|
|
244
|
-
const logDir = path.join(process.env.DATA_DIR || path.join(process.env.HOME || "/tmp", ".
|
|
244
|
+
const logDir = path.join(process.env.DATA_DIR || path.join(process.env.HOME || "/tmp", ".fsrouter"), "logs");
|
|
245
245
|
fs.mkdirSync(logDir, { recursive: true });
|
|
246
246
|
fs.appendFileSync(`${logDir}/automation_spawn.log`, `[${new Date().toISOString()}] openvecta spawning python: ${venvPython} ${args.join(" ")}\n`);
|
|
247
247
|
}
|