Fix MITM on window

This commit is contained in:
decolua
2026-02-28 10:04:57 +07:00
parent 49a56612bf
commit 833069caac
22 changed files with 650 additions and 199 deletions

16
src/mitm/paths.js Normal file
View File

@@ -0,0 +1,16 @@
const path = require("path");
const os = require("os");
// Single source of truth for data directory — matches localDb.js logic
function getDataDir() {
if (process.env.DATA_DIR) return process.env.DATA_DIR;
if (process.platform === "win32") {
return path.join(process.env.APPDATA || path.join(os.homedir(), "AppData", "Roaming"), "9router");
}
return path.join(os.homedir(), ".9router");
}
const DATA_DIR = getDataDir();
const MITM_DIR = path.join(DATA_DIR, "mitm");
module.exports = { DATA_DIR, MITM_DIR };