9router 0.3.11 → 0.3.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/.next/BUILD_ID +1 -1
- package/app/.next/app-path-routes-manifest.json +42 -42
- package/app/.next/build-manifest.json +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/_global-error.html +2 -2
- package/app/.next/server/app/_global-error.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/app/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/_not-found.html +1 -1
- package/app/.next/server/app/_not-found.rsc +2 -2
- package/app/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/app/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
- package/app/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/app/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/app/.next/server/app/api/auth/login/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/auth/logout/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/antigravity-mitm/alias/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/antigravity-mitm/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/claude-settings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/codex-settings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/droid-settings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cli-tools/openclaw-settings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cloud/auth/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cloud/credentials/update/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cloud/model/resolve/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/cloud/models/alias/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/combos/[id]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/combos/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/init/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/keys/[id]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/keys/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/models/alias/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/models/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/oauth/[provider]/[action]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/oauth/cursor/auto-import/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/oauth/cursor/import/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/oauth/kiro/auto-import/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/oauth/kiro/import/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/oauth/kiro/social-authorize/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/oauth/kiro/social-exchange/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/pricing/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/provider-nodes/[id]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/provider-nodes/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/provider-nodes/validate/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/[id]/models/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/[id]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/[id]/test/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/[id]/test-models/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/client/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/test-batch/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/providers/validate/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/settings/database/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/settings/require-login/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/settings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/shutdown/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/tags/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/translator/load/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/translator/save/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/translator/send/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/translator/translate/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/tunnel/disable/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/tunnel/enable/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/tunnel/status/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/[connectionId]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/chart/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/history/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/providers/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/request-details/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/request-logs/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/usage/stream/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/api/chat/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/chat/completions/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/embeddings/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/messages/count_tokens/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/messages/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/models/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/responses/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1beta/models/[...path]/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/api/v1beta/models/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/callback/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/callback.html +1 -1
- package/app/.next/server/app/callback.rsc +2 -2
- package/app/.next/server/app/callback.segments/_full.segment.rsc +2 -2
- package/app/.next/server/app/callback.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/callback.segments/_index.segment.rsc +2 -2
- package/app/.next/server/app/callback.segments/_tree.segment.rsc +1 -1
- package/app/.next/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/callback.segments/callback.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/cli-tools.html +1 -1
- package/app/.next/server/app/dashboard/cli-tools.rsc +4 -4
- package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/cli-tools.segments/_full.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/cli-tools.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/cli-tools.segments/_index.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/combos.html +1 -1
- package/app/.next/server/app/dashboard/combos.rsc +4 -4
- package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/combos.segments/_full.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/combos.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/combos.segments/_index.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/combos.segments/_tree.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/endpoint.html +1 -1
- package/app/.next/server/app/dashboard/endpoint.rsc +4 -4
- package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/endpoint.segments/_full.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/endpoint.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/endpoint.segments/_index.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/endpoint.segments/_tree.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/profile.html +1 -1
- package/app/.next/server/app/dashboard/profile.rsc +4 -4
- package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/profile.segments/_full.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/profile.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/profile.segments/_index.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/profile.segments/_tree.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers/new.html +1 -1
- package/app/.next/server/app/dashboard/providers/new.rsc +4 -4
- package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers/new.segments/_full.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/providers/new.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers/new.segments/_index.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers/new.segments/_tree.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers.html +1 -1
- package/app/.next/server/app/dashboard/providers.rsc +4 -4
- package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers.segments/_full.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/providers.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers.segments/_index.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers.segments/_tree.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.html +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.rsc +2 -2
- package/app/.next/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/translator.html +1 -1
- package/app/.next/server/app/dashboard/translator.rsc +4 -4
- package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/translator.segments/_full.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/translator.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/translator.segments/_index.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/translator.segments/_tree.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/usage.html +1 -1
- package/app/.next/server/app/dashboard/usage.rsc +4 -4
- package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/usage.segments/_full.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/usage.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/usage.segments/_index.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/usage.segments/_tree.segment.rsc +1 -1
- package/app/.next/server/app/dashboard.html +1 -1
- package/app/.next/server/app/dashboard.rsc +4 -4
- package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard.segments/_full.segment.rsc +4 -4
- package/app/.next/server/app/dashboard.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard.segments/_index.segment.rsc +2 -2
- package/app/.next/server/app/dashboard.segments/_tree.segment.rsc +1 -1
- package/app/.next/server/app/index.html +1 -1
- package/app/.next/server/app/index.rsc +2 -2
- package/app/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/index.segments/_full.segment.rsc +2 -2
- package/app/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/index.segments/_index.segment.rsc +2 -2
- package/app/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/app/.next/server/app/landing/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/landing.html +1 -1
- package/app/.next/server/app/landing.rsc +2 -2
- package/app/.next/server/app/landing.segments/_full.segment.rsc +2 -2
- package/app/.next/server/app/landing.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/landing.segments/_index.segment.rsc +2 -2
- package/app/.next/server/app/landing.segments/_tree.segment.rsc +1 -1
- package/app/.next/server/app/landing.segments/landing/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/landing.segments/landing.segment.rsc +1 -1
- package/app/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/login.html +1 -1
- package/app/.next/server/app/login.rsc +3 -3
- package/app/.next/server/app/login.segments/_full.segment.rsc +3 -3
- package/app/.next/server/app/login.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/login.segments/_index.segment.rsc +2 -2
- package/app/.next/server/app/login.segments/_tree.segment.rsc +1 -1
- package/app/.next/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/login.segments/login.segment.rsc +1 -1
- package/app/.next/server/app/manifest.webmanifest/route.js.nft.json +1 -1
- package/app/.next/server/app/manifest.webmanifest/route_client-reference-manifest.js +1 -1
- package/app/.next/server/app/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app-paths-manifest.json +42 -42
- package/app/.next/server/chunks/6186.js +13 -13
- package/app/.next/server/chunks/8694.js +1 -1
- package/app/.next/server/pages/404.html +1 -1
- package/app/.next/server/pages/500.html +2 -2
- package/app/.next/server/server-reference-manifest.js +1 -1
- package/app/.next/server/server-reference-manifest.json +1 -1
- package/app/.next/static/chunks/{8729-ec583a007f4f3da0.js → 8729-42dde495fe569d68.js} +1 -1
- package/app/package.json +1 -1
- package/app/src/mitm/manager.js +157 -90
- package/package.json +1 -1
- /package/app/.next/static/{bkE60le6wgGugItzX3ebk → yC8H_CC0ny77zOPSnRacp}/_buildManifest.js +0 -0
- /package/app/.next/static/{bkE60le6wgGugItzX3ebk → yC8H_CC0ny77zOPSnRacp}/_ssgManifest.js +0 -0
package/app/src/mitm/manager.js
CHANGED
|
@@ -12,6 +12,8 @@ const { generateCert } = require("./cert/generate");
|
|
|
12
12
|
const { installCert } = require("./cert/install");
|
|
13
13
|
|
|
14
14
|
const MITM_PORT = 443;
|
|
15
|
+
// Windows: node listens on 8443, netsh portproxy forwards 443→8443
|
|
16
|
+
const MITM_WIN_NODE_PORT = 8443;
|
|
15
17
|
const PID_FILE = path.join(os.homedir(), ".9router", "mitm", ".mitm.pid");
|
|
16
18
|
|
|
17
19
|
// Resolve server.js path robustly:
|
|
@@ -275,12 +277,12 @@ async function killLeftoverMitm(sudoPassword) {
|
|
|
275
277
|
* Poll MITM health endpoint until server is up or timeout.
|
|
276
278
|
* Returns { ok, pid } on success, null on timeout.
|
|
277
279
|
*/
|
|
278
|
-
function pollMitmHealth(timeoutMs) {
|
|
280
|
+
function pollMitmHealth(timeoutMs, port = MITM_PORT) {
|
|
279
281
|
return new Promise((resolve) => {
|
|
280
282
|
const deadline = Date.now() + timeoutMs;
|
|
281
283
|
const check = () => {
|
|
282
284
|
const req = https.request(
|
|
283
|
-
{ hostname: "127.0.0.1", port
|
|
285
|
+
{ hostname: "127.0.0.1", port, path: "/_mitm_health", method: "GET", rejectUnauthorized: false },
|
|
284
286
|
(res) => {
|
|
285
287
|
let body = "";
|
|
286
288
|
res.on("data", (d) => { body += d; });
|
|
@@ -366,34 +368,28 @@ async function startMitm(apiKey, sudoPassword) {
|
|
|
366
368
|
// Kill any leftover MITM server from a previous failed start attempt
|
|
367
369
|
await killLeftoverMitm(sudoPassword);
|
|
368
370
|
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
if (IS_WIN) {
|
|
379
|
-
await new Promise((resolve) => exec(`taskkill /F /PID ${owner.pid}`, resolve));
|
|
380
|
-
} else {
|
|
371
|
+
if (!IS_WIN) {
|
|
372
|
+
// Check port 443 availability — Windows handles this inside elevated script
|
|
373
|
+
const portStatus = await checkPort443Free();
|
|
374
|
+
if (portStatus === "in-use" || portStatus === "no-permission") {
|
|
375
|
+
const owner = await getPort443Owner(sudoPassword);
|
|
376
|
+
if (owner && owner.name === "node") {
|
|
377
|
+
// Orphan MITM node process — kill it and continue
|
|
378
|
+
console.log(`[MITM] Killing orphan node process on port 443 (PID ${owner.pid})...`);
|
|
379
|
+
try {
|
|
381
380
|
const { execWithPassword } = require("./dns/dnsConfig");
|
|
382
381
|
await execWithPassword(`kill -9 ${owner.pid}`, sudoPassword);
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
}
|
|
386
|
-
|
|
382
|
+
await new Promise(r => setTimeout(r, 800));
|
|
383
|
+
} catch { /* best effort */ }
|
|
384
|
+
} else if (owner) {
|
|
385
|
+
const shortName = owner.name.includes("/")
|
|
386
|
+
? owner.name.split("/").filter(Boolean).pop()
|
|
387
|
+
: owner.name;
|
|
388
|
+
throw new Error(
|
|
389
|
+
`Port 443 is already in use by "${shortName}" (PID ${owner.pid}). Stop that process first, then retry.`
|
|
390
|
+
);
|
|
387
391
|
}
|
|
388
|
-
} else if (owner) {
|
|
389
|
-
const shortName = owner.name.includes("/")
|
|
390
|
-
? owner.name.split("/").filter(Boolean).pop()
|
|
391
|
-
: owner.name;
|
|
392
|
-
throw new Error(
|
|
393
|
-
`Port 443 is already in use by "${shortName}" (PID ${owner.pid}). Stop that process first, then retry.`
|
|
394
|
-
);
|
|
395
392
|
}
|
|
396
|
-
// owner === null + no-permission → likely just needs sudo, proceed
|
|
397
393
|
}
|
|
398
394
|
|
|
399
395
|
// 1. Generate SSL certificate if not exists (no elevation needed)
|
|
@@ -407,64 +403,86 @@ async function startMitm(apiKey, sudoPassword) {
|
|
|
407
403
|
console.log("Starting MITM server...");
|
|
408
404
|
|
|
409
405
|
if (IS_WIN) {
|
|
406
|
+
// Windows: single UAC via VBScript → elevated PowerShell script that:
|
|
407
|
+
// 1. Installs SSL cert 2. Adds DNS entries 3. Starts node server.js (elevated → can bind 443) 4. Writes flag
|
|
408
|
+
// Node polls flag file to know when server is ready, then health-checks port 443
|
|
410
409
|
const hostsFile = path.join(process.env.SystemRoot || "C:\\Windows", "System32", "drivers", "etc", "hosts");
|
|
411
410
|
const TARGET_HOSTS_WIN = ["daily-cloudcode-pa.googleapis.com", "cloudcode-pa.googleapis.com"];
|
|
412
|
-
const esc = (s) => s.replace(/'/g, "''");
|
|
413
|
-
const certPsPath = esc(certPath);
|
|
414
|
-
const hostsPsPath = esc(hostsFile);
|
|
415
411
|
|
|
416
|
-
//
|
|
417
|
-
const
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
if ($
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
//
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
412
|
+
// Use Chr(34) in VBScript for quotes — avoid escaping issues
|
|
413
|
+
const flagFile = path.join(os.tmpdir(), `mitm_ready_${Date.now()}.flag`);
|
|
414
|
+
|
|
415
|
+
// PowerShell uses single-quoted strings — escape single quotes only
|
|
416
|
+
const psSQ = (s) => s.replace(/'/g, "''");
|
|
417
|
+
const certPs = psSQ(certPath);
|
|
418
|
+
const hostsPs = psSQ(hostsFile);
|
|
419
|
+
const nodePs = psSQ(process.execPath);
|
|
420
|
+
const serverPs = psSQ(SERVER_PATH);
|
|
421
|
+
const flagPs = psSQ(flagFile);
|
|
422
|
+
|
|
423
|
+
const dnsLines = TARGET_HOSTS_WIN.map(h =>
|
|
424
|
+
`$hc = Get-Content -Path '${hostsPs}' -Raw -ErrorAction SilentlyContinue\n` +
|
|
425
|
+
`if ($hc -notmatch [regex]::Escape('${h}')) { Add-Content -Path '${hostsPs}' -Value '127.0.0.1 ${h}' -Encoding UTF8 }`
|
|
426
|
+
).join("\n");
|
|
427
|
+
|
|
428
|
+
const psScript = [
|
|
429
|
+
`# 0. Kill any orphan node process on port 443`,
|
|
430
|
+
`$conn = Get-NetTCPConnection -LocalPort 443 -State Listen -ErrorAction SilentlyContinue | Select-Object -First 1`,
|
|
431
|
+
`if ($conn -and $conn.OwningProcess -gt 4) { Stop-Process -Id $conn.OwningProcess -Force -ErrorAction SilentlyContinue }`,
|
|
432
|
+
`Start-Sleep -Milliseconds 500`,
|
|
433
|
+
``,
|
|
434
|
+
`# 1. Install SSL cert to Windows Root store`,
|
|
435
|
+
`$c = & certutil -store Root 'daily-cloudcode-pa.googleapis.com' 2>&1`,
|
|
436
|
+
`if ($LASTEXITCODE -ne 0) { & certutil -addstore Root '${certPs}' | Out-Null }`,
|
|
437
|
+
``,
|
|
438
|
+
`# 2. Add DNS entries to hosts file`,
|
|
439
|
+
dnsLines,
|
|
440
|
+
`& ipconfig /flushdns | Out-Null`,
|
|
441
|
+
``,
|
|
442
|
+
`# 3. Start node MITM server elevated (required to bind port 443)`,
|
|
443
|
+
`$env:ROUTER_API_KEY = '${psSQ(apiKey)}'`,
|
|
444
|
+
`$env:NODE_ENV = 'production'`,
|
|
445
|
+
`Start-Process -FilePath '${nodePs}' -ArgumentList '${serverPs}' -WindowStyle Hidden`,
|
|
446
|
+
``,
|
|
447
|
+
`# 4. Signal ready`,
|
|
448
|
+
`Start-Sleep -Milliseconds 500`,
|
|
449
|
+
`Set-Content -Path '${flagPs}' -Value 'ready' -Encoding UTF8`,
|
|
450
|
+
].join("\n");
|
|
451
|
+
|
|
452
|
+
const tmpPs1 = path.join(os.tmpdir(), `mitm_start_${Date.now()}.ps1`);
|
|
453
|
+
fs.writeFileSync(tmpPs1, psScript, "utf8");
|
|
454
|
+
|
|
455
|
+
// VBScript uses Shell.Application.ShellExecute to trigger UAC from any context
|
|
456
|
+
// Chr(34) = double-quote, avoids VBScript string escaping issues
|
|
457
|
+
const vbs = [
|
|
458
|
+
`Set oShell = CreateObject("Shell.Application")`,
|
|
459
|
+
`Dim ps`,
|
|
460
|
+
`ps = Chr(34) & "powershell.exe" & Chr(34)`,
|
|
461
|
+
`Dim args`,
|
|
462
|
+
`args = "-NoProfile -ExecutionPolicy Bypass -File " & Chr(34) & "${tmpPs1.replace(/\\/g, "\\\\")}" & Chr(34)`,
|
|
463
|
+
`oShell.ShellExecute ps, args, "", "runas", 1`,
|
|
464
|
+
].join("\r\n");
|
|
465
|
+
const tmpVbs = path.join(os.tmpdir(), `mitm_uac_${Date.now()}.vbs`);
|
|
466
|
+
fs.writeFileSync(tmpVbs, vbs, "utf8");
|
|
467
|
+
|
|
468
|
+
// Launch VBScript — shows UAC dialog, user confirms, script runs elevated
|
|
469
|
+
spawn("wscript.exe", [tmpVbs], { stdio: "ignore", windowsHide: false, detached: true }).unref();
|
|
470
|
+
|
|
471
|
+
// Poll flag file — resolves when elevated script completes
|
|
472
|
+
await new Promise((resolve, reject) => {
|
|
473
|
+
const deadline = Date.now() + 90000; // 90s: UAC wait + cert install + node start
|
|
474
|
+
const poll = () => {
|
|
475
|
+
if (fs.existsSync(flagFile)) {
|
|
476
|
+
try { fs.unlinkSync(flagFile); fs.unlinkSync(tmpPs1); fs.unlinkSync(tmpVbs); } catch { /* ignore */ }
|
|
477
|
+
return resolve();
|
|
478
|
+
}
|
|
479
|
+
if (Date.now() > deadline) return reject(new Error("Timed out waiting for UAC confirmation. Please try again."));
|
|
480
|
+
setTimeout(poll, 500);
|
|
481
|
+
};
|
|
482
|
+
poll();
|
|
466
483
|
});
|
|
467
|
-
|
|
484
|
+
|
|
485
|
+
if (_updateSettings) await _updateSettings({ mitmCertInstalled: true }).catch(() => { });
|
|
468
486
|
} else {
|
|
469
487
|
// macOS/Linux: install cert + add DNS (requires sudo), then spawn server
|
|
470
488
|
const settings = _getSettings ? await _getSettings().catch(() => ({})) : {};
|
|
@@ -487,8 +505,11 @@ $sid = [System.Security.Principal.WindowsIdentity]::GetCurrent().User.Value
|
|
|
487
505
|
serverProcess.stdin.end();
|
|
488
506
|
}
|
|
489
507
|
|
|
490
|
-
|
|
491
|
-
|
|
508
|
+
// Windows: node was started by elevated script — PID comes from health check later
|
|
509
|
+
if (!IS_WIN && serverProcess) {
|
|
510
|
+
serverPid = serverProcess.pid;
|
|
511
|
+
fs.writeFileSync(PID_FILE, String(serverPid));
|
|
512
|
+
}
|
|
492
513
|
|
|
493
514
|
let startError = null;
|
|
494
515
|
if (!IS_WIN) {
|
|
@@ -511,9 +532,8 @@ $sid = [System.Security.Principal.WindowsIdentity]::GetCurrent().User.Value
|
|
|
511
532
|
});
|
|
512
533
|
}
|
|
513
534
|
|
|
514
|
-
// Wait for server to be ready by polling health endpoint
|
|
515
|
-
|
|
516
|
-
const health = await pollMitmHealth(IS_WIN ? 20000 : 8000);
|
|
535
|
+
// Wait for server to be ready by polling health endpoint on port 443
|
|
536
|
+
const health = await pollMitmHealth(IS_WIN ? 15000 : 8000, MITM_PORT);
|
|
517
537
|
|
|
518
538
|
if (!health) {
|
|
519
539
|
if (IS_WIN) serverProcess = null;
|
|
@@ -568,14 +588,61 @@ async function stopMitm(sudoPassword) {
|
|
|
568
588
|
serverPid = null;
|
|
569
589
|
}
|
|
570
590
|
|
|
571
|
-
|
|
572
|
-
|
|
591
|
+
if (IS_WIN) {
|
|
592
|
+
// Windows stop: remove DNS entries via elevated VBScript (1 UAC)
|
|
593
|
+
const hostsFile = path.join(process.env.SystemRoot || "C:\\Windows", "System32", "drivers", "etc", "hosts");
|
|
594
|
+
const TARGET_HOSTS_WIN = ["daily-cloudcode-pa.googleapis.com", "cloudcode-pa.googleapis.com"];
|
|
595
|
+
const psSQ = (s) => s.replace(/'/g, "''");
|
|
596
|
+
|
|
597
|
+
// Filter hosts content in Node (read doesn't need elevation)
|
|
598
|
+
let hostsContent = "";
|
|
599
|
+
try { hostsContent = fs.readFileSync(hostsFile, "utf8"); } catch { /* ignore */ }
|
|
600
|
+
const filtered = hostsContent.split(/\r?\n/)
|
|
601
|
+
.filter(l => !TARGET_HOSTS_WIN.some(h => l.includes(h)))
|
|
602
|
+
.join("\r\n");
|
|
603
|
+
const tmpHosts = path.join(os.tmpdir(), "mitm_hosts_clean.tmp");
|
|
604
|
+
fs.writeFileSync(tmpHosts, filtered, "utf8");
|
|
605
|
+
|
|
606
|
+
const flagFile = path.join(os.tmpdir(), "mitm_stop_done.flag");
|
|
607
|
+
const psScript = [
|
|
608
|
+
`Copy-Item -Path '${psSQ(tmpHosts)}' -Destination '${psSQ(hostsFile)}' -Force`,
|
|
609
|
+
`& ipconfig /flushdns | Out-Null`,
|
|
610
|
+
`Remove-Item '${psSQ(tmpHosts)}' -ErrorAction SilentlyContinue`,
|
|
611
|
+
`Set-Content -Path '${psSQ(flagFile)}' -Value 'done' -Encoding UTF8`,
|
|
612
|
+
].join("\n");
|
|
613
|
+
const tmpPs1 = path.join(os.tmpdir(), "mitm_stop.ps1");
|
|
614
|
+
fs.writeFileSync(tmpPs1, psScript, "utf8");
|
|
615
|
+
|
|
616
|
+
const vbs = [
|
|
617
|
+
`Set oShell = CreateObject("Shell.Application")`,
|
|
618
|
+
`Dim args`,
|
|
619
|
+
`args = "-NoProfile -ExecutionPolicy Bypass -File " & Chr(34) & "${tmpPs1.replace(/\\/g, "\\\\")}" & Chr(34)`,
|
|
620
|
+
`oShell.ShellExecute "powershell.exe", args, "", "runas", 1`,
|
|
621
|
+
].join("\r\n");
|
|
622
|
+
const tmpVbs = path.join(os.tmpdir(), "mitm_stop_uac.vbs");
|
|
623
|
+
fs.writeFileSync(tmpVbs, vbs, "utf8");
|
|
624
|
+
spawn("wscript.exe", [tmpVbs], { stdio: "ignore", windowsHide: false, detached: true }).unref();
|
|
625
|
+
|
|
626
|
+
// Poll flag — best effort, don't block UI if user cancels UAC
|
|
627
|
+
await new Promise((resolve) => {
|
|
628
|
+
const deadline = Date.now() + 30000;
|
|
629
|
+
const poll = () => {
|
|
630
|
+
if (fs.existsSync(flagFile)) {
|
|
631
|
+
try { fs.unlinkSync(flagFile); fs.unlinkSync(tmpPs1); fs.unlinkSync(tmpVbs); } catch { /* ignore */ }
|
|
632
|
+
return resolve();
|
|
633
|
+
}
|
|
634
|
+
if (Date.now() > deadline) return resolve();
|
|
635
|
+
setTimeout(poll, 500);
|
|
636
|
+
};
|
|
637
|
+
poll();
|
|
638
|
+
});
|
|
639
|
+
} else {
|
|
640
|
+
console.log("Removing DNS entry...");
|
|
641
|
+
await removeDNSEntry(sudoPassword);
|
|
642
|
+
}
|
|
573
643
|
|
|
574
644
|
try { fs.unlinkSync(PID_FILE); } catch { /* ignore */ }
|
|
575
645
|
|
|
576
|
-
// Reset win setup flag so DNS gets re-added on next start
|
|
577
|
-
if (IS_WIN && _updateSettings) await _updateSettings({ mitmWinSetupDone: false }).catch(() => { });
|
|
578
|
-
|
|
579
646
|
await saveMitmSettings(false, null);
|
|
580
647
|
|
|
581
648
|
return { running: false, pid: null };
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|