Add TOOL_HOSTS constant for per-tool DNS mapping and integrate into MitmToolCard component (#788)

This commit is contained in:
mrcyclo
2026-04-28 09:50:11 +07:00
committed by GitHub
parent 58a821d687
commit 54a67dbeb8
3 changed files with 29 additions and 9 deletions
+2 -9
View File
@@ -3,14 +3,7 @@ const fs = require("fs");
const path = require("path");
const os = require("os");
const { log, err } = require("../logger");
// Per-tool DNS hosts mapping
const TOOL_HOSTS = {
antigravity: ["daily-cloudcode-pa.googleapis.com", "cloudcode-pa.googleapis.com"],
copilot: ["api.individual.githubcopilot.com"],
kiro: ["q.us-east-1.amazonaws.com", "codewhisperer.us-east-1.amazonaws.com"],
cursor: ["api2.cursor.sh"],
};
const { TOOL_HOSTS } = require("../../shared/constants/mitmToolHosts");
const IS_WIN = process.platform === "win32";
const IS_MAC = process.platform === "darwin";
@@ -25,7 +18,7 @@ const HOSTS_FILE = IS_WIN
function executeElevatedPowerShell(psScriptPath, timeoutMs = 30000) {
const flagFile = path.join(os.tmpdir(), `ps_done_${Date.now()}.flag`);
const psSQ = (s) => s.replace(/'/g, "''");
let psContent = fs.readFileSync(psScriptPath, "utf8");
psContent += `\nSet-Content -Path '${psSQ(flagFile)}' -Value 'done' -Encoding UTF8\n`;
fs.writeFileSync(psScriptPath, psContent, "utf8");