mirror of
https://github.com/Nezumi-2711/9router.git
synced 2026-09-22 20:00:47 +00:00
Fix : MITM
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user