refactor: update MitmServerCard and MitmToolCard to use modalError instead of message for error handling

- Replaced message state with modalError in both components for better error management.
- Removed unused message display logic and adjusted action handling to improve clarity.
- Enhanced error handling in doAction and doDnsAction functions to ignore errors gracefully.
- Updated API call responses to streamline user feedback on actions.
This commit is contained in:
decolua
2026-03-20 12:44:20 +07:00
parent 6af8043f2a
commit c8d2497423
8 changed files with 117 additions and 103 deletions

View File

@@ -43,7 +43,7 @@ export async function GET() {
certExists: status.certExists || false,
certTrusted: status.certTrusted || false,
dnsStatus: status.dnsStatus || {},
hasCachedPassword: !!getCachedPassword(),
hasCachedPassword: !!getCachedPassword() || !!(await loadEncryptedPassword()),
isAdmin: checkIsAdmin(),
});
} catch (error) {

View File

@@ -1,9 +1,13 @@
import { NextResponse } from "next/server";
import { enableTunnel } from "@/lib/tunnel/tunnelManager";
const DNS_WARMUP_DELAY_MS = 8000;
export async function POST() {
try {
const result = await enableTunnel();
// Wait for DNS warmup to propagate at Cloudflare edge after tunnel registered
await new Promise((r) => setTimeout(r, DNS_WARMUP_DELAY_MS));
return NextResponse.json(result);
} catch (error) {
console.error("Tunnel enable error:", error);