Fix : MITM

This commit is contained in:
decolua
2026-03-14 23:59:22 +07:00
parent f264bb9a23
commit 1dd5d60724
10 changed files with 151 additions and 65 deletions
@@ -7,6 +7,7 @@ import {
stopServer,
enableToolDNS,
disableToolDNS,
trustCert,
getCachedPassword,
setCachedPassword,
loadEncryptedPassword,
@@ -30,6 +31,7 @@ export async function GET() {
running: status.running,
pid: status.pid || null,
certExists: status.certExists || false,
certTrusted: status.certTrusted || false,
dnsStatus: status.dnsStatus || {},
hasCachedPassword: !!getCachedPassword(),
});
@@ -100,8 +102,13 @@ export async function PATCH(request) {
await enableToolDNS(tool, pwd);
} else if (action === "disable") {
await disableToolDNS(tool, pwd);
} else if (action === "trust-cert") {
await trustCert(pwd);
if (!isWin && sudoPassword) setCachedPassword(sudoPassword);
const status = await getMitmStatus();
return NextResponse.json({ success: true, certTrusted: status.certTrusted });
} else {
return NextResponse.json({ error: "action must be enable or disable" }, { status: 400 });
return NextResponse.json({ error: "action must be enable, disable, or trust-cert" }, { status: 400 });
}
if (!isWin && sudoPassword) setCachedPassword(sudoPassword);