zevairouter 1.0.40 → 1.0.41
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/CHANGELOG.md +5 -0
- package/cli/app/.next-cli-build/BUILD_ID +1 -1
- package/cli/app/.next-cli-build/app-path-routes-manifest.json +9 -9
- package/cli/app/.next-cli-build/build-manifest.json +2 -2
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/automation/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/context/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.html +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/_not-found.html +1 -1
- package/cli/app/.next-cli-build/server/app/_not-found.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_not-found.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/api/models/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/models/test/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/providers/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/providers/validate/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/translator/console-logs/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/version/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/version/shutdown/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/version/update/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/callback.html +1 -1
- package/cli/app/.next-cli-build/server/app/callback.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/callback.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/callback.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/callback.segments/callback.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/automation.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/automation.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/!KGRhc2hib2FyZCk/dashboard/automation/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/!KGRhc2hib2FyZCk/dashboard/automation.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/combos.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/context.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/context.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/context.segments/!KGRhc2hib2FyZCk/dashboard/context/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/context.segments/!KGRhc2hib2FyZCk/dashboard/context.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/context.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/context.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/context.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/context.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/context.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/context.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/profile.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/quota.html +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/quota.rsc +6 -6
- package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +6 -6
- package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/translator.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/usage.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +5 -5
- package/cli/app/.next-cli-build/server/app/dashboard.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/index.html +1 -1
- package/cli/app/.next-cli-build/server/app/index.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/index.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/index.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/landing.html +1 -1
- package/cli/app/.next-cli-build/server/app/landing.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/landing.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/landing.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/landing.segments/landing.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/login.html +1 -1
- package/cli/app/.next-cli-build/server/app/login.rsc +4 -4
- package/cli/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +4 -4
- package/cli/app/.next-cli-build/server/app/login.segments/_head.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/login.segments/_index.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/login.segments/login.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app-paths-manifest.json +9 -9
- package/cli/app/.next-cli-build/server/chunks/4746.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/6896.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/7153.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/7276.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/8242.js +2 -2
- package/cli/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/pages/404.html +1 -1
- package/cli/app/.next-cli-build/server/pages/500.html +1 -1
- package/cli/app/.next-cli-build/static/chunks/{1321-fe2fcab7940ae8d5.js → 1321-477a5798b08e9aff.js} +1 -1
- package/cli/app/.next-cli-build/static/chunks/523-f867c3d02c72b48f.js +3 -0
- package/cli/app/package.json +1 -1
- package/cli/package.json +1 -1
- package/package.json +1 -1
- package/src/app/(dashboard)/dashboard/endpoint/EndpointPageClient.js +17 -214
- package/cli/app/.next-cli-build/static/chunks/523-9807fa9a0746de61.js +0 -3
- /package/cli/app/.next-cli-build/static/{Fgc4vdsr6a_wWu8yVkotQ → nyh5UKJNxYaLZepC5PtgE}/_buildManifest.js +0 -0
- /package/cli/app/.next-cli-build/static/{Fgc4vdsr6a_wWu8yVkotQ → nyh5UKJNxYaLZepC5PtgE}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[523],{80523:(e,t,s)=>{Promise.resolve().then(s.bind(s,95907))},95907:(e,t,s)=>{"use strict";s.d(t,{default:()=>h});var a=s(95155),l=s(12115),n=s(14051),r=s.n(n),i=s(98500),o=s.n(i),c=s(35497),d=s(11059);let m=[{icon:"public",title:"Access Anywhere",desc:"Use your API from any network"},{icon:"group",title:"Share Endpoint",desc:"Share URL with team members"},{icon:"code",title:"Use in Cursor/Cline",desc:"Connect AI tools remotely"},{icon:"lock",title:"Encrypted",desc:"End-to-end TLS via Cloudflare"}];async function u(e){if(!e)return!1;try{return(await fetch(`${e}/api/health`,{mode:"cors",cache:"no-store",signal:AbortSignal.timeout(5e3)})).ok}catch{return!1}}async function x(...e){let t=e.filter(Boolean).map(u);return!!t.length&&new Promise(e=>{let s=t.length;t.forEach(t=>t.then(t=>{t?e(!0):0==--s&&e(!1)}))})}function h({machineId:e}){let[t,s]=(0,l.useState)([]),[n,r]=(0,l.useState)(!0),[i,f]=(0,l.useState)(!1),[j,k]=(0,l.useState)(""),[v,w]=(0,l.useState)(null),[N,C]=(0,l.useState)(null),[S,T]=(0,l.useState)(!1),[P,_]=(0,l.useState)(!0),[E,$]=(0,l.useState)(!0),[A,I]=(0,l.useState)(!1),[O,U]=(0,l.useState)(!0),[D,F]=(0,l.useState)(!1),[R,q]=(0,l.useState)(!1),[W,L]=(0,l.useState)(""),[K,z]=(0,l.useState)(""),[J,H]=(0,l.useState)(!1),[Z,B]=(0,l.useState)(""),[M,Q]=(0,l.useState)(null),[V,X]=(0,l.useState)(!1),[G,Y]=(0,l.useState)(!1),[ee,et]=(0,l.useState)(!1),[es,ea]=(0,l.useState)(!1),[el,en]=(0,l.useState)(""),[er,ei]=(0,l.useState)(!1),[eo,ec]=(0,l.useState)(""),[ed,em]=(0,l.useState)(null),[eu,ex]=(0,l.useState)(""),[eh,ep]=(0,l.useState)(""),[ey,eb]=(0,l.useState)(null),[eg,ef]=(0,l.useState)(!1),[ej,ek]=(0,l.useState)([]),[ev,ew]=(0,l.useState)(""),[eN,eC]=(0,l.useState)(!1),[eS,eT]=(0,l.useState)(!1),[eP,e_]=(0,l.useState)(!1),eE=(0,l.useRef)(null),e$=(0,l.useRef)(0),eA=(0,l.useRef)(0),eI=(0,l.useRef)(!1),eO=(0,l.useRef)(!1),eU=(0,l.useRef)(!1),eD=(0,l.useRef)(!1),[eF,eR]=(0,l.useState)(!1),[eq,eW]=(0,l.useState)(!1),[eL,eK]=(0,l.useState)(new Set),[ez,eJ]=(0,l.useState)(!1);(0,l.useEffect)(()=>{eJ(!["localhost","127.0.0.1","::1"].includes(window.location.hostname))},[]);let{copied:eH,copy:eZ}=(0,d.C)(),eB=!P||!E,eM=P?"Change the default dashboard password before activating the tunnel.":'Enable "Require login" and set a custom password before activating the tunnel.';(0,l.useEffect)(()=>{eE.current&&(eE.current.scrollTop=eE.current.scrollHeight)},[ej]),(0,l.useEffect)(()=>{e0(),eX()},[]),(0,l.useEffect)(()=>{if(!(D||ee))return;let e=!D||R,t=!ee||es,s=()=>{document.hidden||eV()};if(document.addEventListener("visibilitychange",s),e&&t)return()=>document.removeEventListener("visibilitychange",s);let a=setInterval(()=>{document.hidden||eV()},5e3);return()=>{clearInterval(a),document.removeEventListener("visibilitychange",s)}},[D,ee,R,es]),(0,l.useEffect)(()=>{let e=async()=>{if(!document.hidden){if(D&&(W||K)){let e=await x(K,W);eI.current=e,e?(e$.current=0,q(!0),eU.current||(eU.current=!0,eR(!0))):(e$.current+=1,e$.current>=5&&q(!1))}else eI.current=!1;if(ee&&el){let e=await u(el);eO.current=e,e?(eA.current=0,ea(!0),eD.current||(eD.current=!0,eW(!0))):(eA.current+=1,eA.current>=5&&ea(!1))}else eO.current=!1}};if(!(D&&(W||K)||ee&&el))return;e();let t=!ee||es;if((!D||R)&&t)return;let s=setInterval(e,1e4);return()=>clearInterval(s)},[D,W,K,ee,el,R,es]);let eQ=(0,l.useCallback)((e,t,s,a,l,n)=>{t.current?(s.current=0,a(!0),l.current||(l.current=!0,n(!0))):(s.current+=1,s.current>=5&&a(!1))},[]),eV=async()=>{try{let e=await fetch("/api/tunnel/status",{cache:"no-store"});if(!e.ok)return;let t=await e.json(),s=t.tunnel?.settingsEnabled??t.tunnel?.enabled??!1,a=t.tunnel?.tunnelUrl||"";L(a),z(t.tunnel?.publicUrl||""),F(s),eQ(null,eI,e$,q,eU,eR);let l=t.tailscale?.settingsEnabled??t.tailscale?.enabled??!1,n=t.tailscale?.tunnelUrl||"";en(n),et(l),eQ(null,eO,eA,ea,eD,eW)}catch{}},eX=async()=>{U(!0);try{let[e,t]=await Promise.all([fetch("/api/settings"),fetch("/api/tunnel/status",{cache:"no-store"})]);if(e.ok){let t=await e.json();T(t.requireApiKey||!1),_(!1!==t.requireLogin),$(t.hasPassword||!1),I(t.tunnelDashboardAccess||!1)}if(t.ok){let e=await t.json(),s=e.tunnel?.settingsEnabled??e.tunnel?.enabled??!1,a=e.tunnel?.tunnelUrl||"";L(a),z(e.tunnel?.publicUrl||""),F(s),eQ(null,eI,e$,q,eU,eR);let l=e.tailscale?.settingsEnabled??e.tailscale?.enabled??!1,n=e.tailscale?.tunnelUrl||"";en(n),et(l),eQ(null,eO,eA,ea,eD,eW)}}catch(e){console.log("Error loading settings:",e)}finally{U(!1)}},eG=async e=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({tunnelDashboardAccess:e})})).ok&&I(e)}catch(e){console.log("Error updating tunnelDashboardAccess:",e)}},eY=async e=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({requireApiKey:e})})).ok&&T(e)}catch(e){console.log("Error updating requireApiKey:",e)}},e0=async()=>{try{let e=await fetch("/api/keys"),t=await e.json();e.ok&&s(t.keys||[])}catch(e){console.log("Error fetching data:",e)}finally{r(!1)}},e1=async(...e)=>{H(!0),B("Waiting for tunnel ready...");let t=e.filter(Boolean).map(e=>`${e}/api/health`),s=Date.now();for(;Date.now()-s<3e5;){if(await new Promise(e=>setTimeout(e,2e3)),await Promise.any(t.map(async e=>{if((await fetch(e,{mode:"cors",cache:"no-store"})).ok)return!0;throw Error("not ready")})).catch(()=>!1))return F(!0),H(!1),B(""),!0;if((Date.now()-s)%1e4<2e3)try{let e=await fetch("/api/tunnel/status");if(e.ok){let t=await e.json();if(!t.tunnel?.enabled)return Q({type:"error",message:"Tunnel process stopped unexpectedly."}),H(!1),B(""),!1}}catch{}}return Q({type:"error",message:"Tunnel created but not reachable. Please try again."}),H(!1),B(""),!1},e5=async()=>{X(!1),H(!0),Q(null),B("Creating tunnel...");let e=!0;(async()=>{for(;e;){try{let t=await fetch("/api/tunnel/status");if(t.ok){let s=await t.json();s.download?.downloading?B(`Downloading cloudflared... ${s.download.progress}%`):e&&B("Creating tunnel...")}}catch{}await new Promise(e=>setTimeout(e,1e3))}})();try{let t=await fetch("/api/tunnel/enable",{method:"POST"});e=!1;let s=await t.json();if(!t.ok)return void Q({type:"error",message:s.error||"Failed to enable tunnel"});let a=s.tunnelUrl;if(!a)return void Q({type:"error",message:"No tunnel URL returned"});L(a),z(s.publicUrl||""),await e1(s.publicUrl,a)}catch(e){Q({type:"error",message:e.message})}finally{e=!1,H(!1),B("")}},e2=async()=>{H(!0),Q(null);try{let e=await fetch("/api/tunnel/disable",{method:"POST"}),t=await e.json();e.ok?(F(!1),L(""),Y(!1),Q({type:"success",message:"Tunnel disabled"})):Q({type:"error",message:t.error||"Failed to disable tunnel"})}catch(e){Q({type:"error",message:e.message})}finally{H(!1)}},e4=async()=>{eb(null);try{let e=await fetch("/api/tunnel/tailscale-check");if(e.ok){let t=await e.json();return eb(t.installed),t}}catch{}return eb(!1),{installed:!1}},e3=async()=>{ef(!0),em(null),ek([]);try{let e=await fetch("/api/tunnel/tailscale-install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sudoPassword:ev})});ew("");let t=e.body.getReader(),s=new TextDecoder,a="";for(;;){let{done:e,value:l}=await t.read();if(e)break;let n=(a+=s.decode(l,{stream:!0})).split("\n\n");for(let e of(a=n.pop()||"",n)){let t=e.split("\n"),s="progress",a=null;for(let e of t)if(e.startsWith("event: ")&&(s=e.slice(7).trim()),e.startsWith("data: "))try{a=JSON.parse(e.slice(6))}catch{}if(a)if("progress"===s)ek(e=>[...e.slice(-50),a.message]);else if("done"===s){eb(!0),ef(!1),eT(!1),e7();return}else"error"===s&&em({type:"error",message:a.error||"Install failed"})}}}catch(e){em({type:"error",message:e.message})}finally{ef(!1)}},e8=async e=>{ec("Waiting for Tailscale ready...");let t=`${e}/api/health`,s=Date.now();for(;Date.now()-s<3e5;){await new Promise(e=>setTimeout(e,2e3));try{let e=await fetch(t,{mode:"no-cors",cache:"no-store"});if(e.ok||"opaque"===e.type)return!0}catch{}}return!1},e6=(e,t)=>{ex(e),ep(t)},e9=()=>{ex(""),ep("")},e7=async()=>{eT(!1),eC(!0),ei(!0),em(null),ec("Connecting..."),e9();try{let e=await fetch("/api/tunnel/tailscale-enable",{method:"POST"}),t=await e.json();if(e.ok&&t.success){en(t.tunnelUrl||"");let e=await e8(t.tunnelUrl);et(!0),em(e?null:{type:"warning",message:"Connected but not reachable yet."});return}if(t.needsLogin&&t.authUrl){e6(t.authUrl,"Open Login Page"),ec('Login required — click "Open Login Page" to continue');for(let e=0;e<40;e++){await new Promise(e=>setTimeout(e,3e3));try{let e=await fetch("/api/tunnel/tailscale-check");if(e.ok&&(await e.json()).loggedIn){e9(),ec("Starting funnel...");let e=await fetch("/api/tunnel/tailscale-enable",{method:"POST"}),t=await e.json();if(e.ok&&t.success){en(t.tunnelUrl||"");let e=await e8(t.tunnelUrl);et(!0),em(e?null:{type:"warning",message:"Connected but not reachable yet."})}else t.funnelNotEnabled&&t.enableUrl?await te(t.enableUrl):em({type:"error",message:t.error||"Failed to start funnel"});return}}catch{}}e9(),em({type:"error",message:"Login timed out. Please try again."});return}if(t.funnelNotEnabled&&t.enableUrl)return void await te(t.enableUrl);em({type:"error",message:t.error||"Failed to connect"})}catch(e){em({type:"error",message:e.message})}finally{ei(!1),eC(!1),ec(""),e9()}},te=async e=>{e6(e,"Open Funnel Settings"),ec('Click "Open Funnel Settings" to enable Funnel...');for(let e=0;e<40;e++){await new Promise(e=>setTimeout(e,3e3));try{let e=await fetch("/api/tunnel/tailscale-enable",{method:"POST"}),t=await e.json();if(e.ok&&t.success){e9(),en(t.tunnelUrl||"");let e=await e8(t.tunnelUrl);et(!0),em(e?null:{type:"warning",message:"Connected but not reachable yet."});return}if(t.funnelNotEnabled)continue;if(t.error){e9(),em({type:"error",message:t.error});return}}catch{}}e9(),em({type:"error",message:"Timed out waiting for Funnel to be enabled."})},tt=async()=>{ei(!0),em(null);try{let e=await fetch("/api/tunnel/tailscale-disable",{method:"POST"}),t=await e.json();e.ok?(et(!1),en(""),e_(!1),em({type:"success",message:"Tailscale disabled"})):em({type:"error",message:t.error||"Failed to disable Tailscale"})}catch(e){em({type:"error",message:e.message})}finally{ei(!1)}},ts=async()=>{em(null),ek([]);let e=await e4();e?.installed&&e?.hasCachedPassword?e7():eT(!0)},ta=async()=>{if(j.trim())try{let e=await fetch("/api/keys",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:j})}),t=await e.json();e.ok&&(w(t.key),await e0(),k(""),f(!1))}catch(e){console.log("Error creating key:",e)}},tl=async e=>{C({title:"Delete API Key",message:"Delete this API key?",onConfirm:async()=>{C(null);try{(await fetch(`/api/keys/${e}`,{method:"DELETE"})).ok&&(s(t.filter(t=>t.id!==e)),eK(t=>{let s=new Set(t);return s.delete(e),s}))}catch(e){console.log("Error deleting key:",e)}}})},tn=async(e,t)=>{try{(await fetch(`/api/keys/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&s(s=>s.map(s=>s.id===e?{...s,isActive:t}:s))}catch(e){console.log("Error toggling key:",e)}},[tr,ti]=(0,l.useState)("/v1");return((0,l.useEffect)(()=>{ti(`${window.location.origin}/v1`)},[]),n)?(0,a.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,a.jsx)(c.Qv,{}),(0,a.jsx)(c.Qv,{})]}):(0,a.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,a.jsxs)(c.Zp,{children:[(0,a.jsxs)("h2",{className:"text-lg font-semibold mb-4 flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-primary",children:"api"}),"API Endpoint"]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(p,{label:"Local",url:tr,copyId:"local_url",copied:eH,onCopy:eZ}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:`text-xs font-mono px-1.5 py-0.5 rounded shrink-0 min-w-[88px] text-center ${D?"bg-primary/10 text-primary":"bg-surface-2 text-text-muted"}`,children:"Tunnel"}),D&&!J&&R?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(c.pd,{value:`${K||W}/v1`,readOnly:!0,className:"flex-1 font-mono text-sm"}),(0,a.jsx)("button",{onClick:()=>eZ(`${K||W}/v1`,"tunnel_url"),className:"p-2 hover:bg-black/5 dark:hover:bg-white/5 rounded text-text-muted hover:text-primary transition-colors shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"tunnel_url"===eH?"check":"content_copy"})}),(0,a.jsx)("button",{onClick:()=>Y(!0),className:"p-2 hover:bg-red-500/10 rounded text-red-500 transition-colors shrink-0",title:"Disable Tunnel",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"power_settings_new"})})]}):!D||J||R?J?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex-1 flex items-center gap-2 px-3 py-1.5 rounded border border-border bg-input text-sm text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin text-sm",children:"progress_activity"}),Z||"Creating tunnel..."]}),(0,a.jsx)("button",{onClick:()=>{H(!1),B("")},className:"p-2 hover:bg-red-500/10 rounded text-red-500 transition-colors shrink-0",title:"Stop",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"power_settings_new"})})]}):M?.type==="error"?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex-1 flex items-center gap-2 px-3 py-1.5 rounded border border-red-300 dark:border-red-800 bg-red-500/5 text-sm text-red-600 dark:text-red-400",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"error"}),M.message]}),(0,a.jsx)(c.$n,{size:"sm",icon:"cloud_upload",onClick:()=>X(!0),children:"Enable"})]}):O?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex-1 flex items-center gap-2 px-3 py-1.5 rounded border border-border bg-input text-sm text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin text-sm",children:"progress_activity"}),"Checking..."]}),(0,a.jsx)("button",{onClick:()=>U(!1),className:"p-2 hover:bg-red-500/10 rounded text-red-500 transition-colors shrink-0",title:"Stop",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"power_settings_new"})})]}):(0,a.jsx)(c.$n,{size:"sm",icon:"cloud_upload",onClick:()=>{eB?Q({type:"error",message:`Security required: ${eM}`}):S?X(!0):Q({type:"error",message:'Security required: Enable "Require API key" before activating the tunnel.'})},children:"Enable"}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex-1 flex items-center gap-2 px-3 py-1.5 rounded border border-amber-300 dark:border-amber-800 bg-amber-500/5 text-sm text-amber-600 dark:text-amber-400",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin text-sm",children:"progress_activity"}),eF?"Tunnel reconnecting...":"Tunnel checking..."]}),(0,a.jsx)("button",{onClick:()=>Y(!0),className:"p-2 hover:bg-red-500/10 rounded text-red-500 transition-colors shrink-0",title:"Disable Tunnel",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"power_settings_new"})})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:`text-xs font-mono px-1.5 py-0.5 rounded shrink-0 min-w-[88px] text-center ${ee?"bg-primary/10 text-primary":"bg-surface-2 text-text-muted"}`,children:"Tailscale"}),ee&&!er&&es?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(c.pd,{value:`${el}/v1`,readOnly:!0,className:"flex-1 font-mono text-sm"}),(0,a.jsx)("button",{onClick:()=>eZ(`${el}/v1`,"ts_url"),className:"p-2 hover:bg-black/5 dark:hover:bg-white/5 rounded text-text-muted hover:text-primary transition-colors shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"ts_url"===eH?"check":"content_copy"})}),(0,a.jsx)("button",{onClick:()=>e_(!0),className:"p-2 hover:bg-red-500/10 rounded text-red-500 transition-colors shrink-0",title:"Disable Tailscale",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"power_settings_new"})})]}):!ee||er||es?er||eN?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex-1 flex items-center gap-2 px-3 py-1.5 rounded border border-border bg-input text-sm text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin text-sm",children:"progress_activity"}),eo||"Connecting..."]}),eu&&(0,a.jsx)(c.$n,{size:"sm",icon:"open_in_new",onClick:()=>window.open(eu,"tailscale_auth","width=600,height=700,noopener,noreferrer"),children:eh||"Open"}),(0,a.jsx)("button",{onClick:()=>{ei(!1),eC(!1),ec(""),e9()},className:"p-2 hover:bg-red-500/10 rounded text-red-500 transition-colors shrink-0",title:"Stop",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"power_settings_new"})})]}):ed?.type==="error"?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex-1 flex items-center gap-2 px-3 py-1.5 rounded border border-red-300 dark:border-red-800 bg-red-500/5 text-sm text-red-600 dark:text-red-400",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"error"}),ed.message]}),(0,a.jsx)(c.$n,{size:"sm",icon:"vpn_lock",onClick:ts,children:"Enable"})]}):(0,a.jsx)(c.$n,{size:"sm",icon:"vpn_lock",onClick:()=>{eB?em({type:"error",message:`Security required: ${eM}`}):ts()},className:"bg-linear-to-r from-indigo-500 to-purple-500 hover:from-indigo-600 hover:to-purple-600 text-white!",children:"Enable"}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex-1 flex items-center gap-2 px-3 py-1.5 rounded border border-amber-300 dark:border-amber-800 bg-amber-500/5 text-sm text-amber-600 dark:text-amber-400",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin text-sm",children:"progress_activity"}),eq?"Tailscale reconnecting...":"Tailscale checking..."]}),(0,a.jsx)("button",{onClick:()=>e_(!0),className:"p-2 hover:bg-red-500/10 rounded text-red-500 transition-colors shrink-0",title:"Disable Tailscale",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"power_settings_new"})})]})]})]}),eB&&!D&&!ee&&(0,a.jsx)("div",{className:"mt-4",children:(0,a.jsx)(g,{message:eM,action:{label:"Open settings",href:"/dashboard/profile"}})}),(D||ee)&&(0,a.jsxs)("div",{className:"mt-4 flex flex-col gap-2",children:[!S&&(0,a.jsx)(g,{message:"Require API key is disabled — your endpoint is publicly accessible without authentication.",action:{label:"Enable",href:"#require-api-key"}}),(!P||!E)&&(0,a.jsx)(g,{message:P?"Dashboard uses the default password — change it in Profile settings.":"Require login is disabled — anyone can access your dashboard via tunnel.",action:{label:P?"Change password":"Enable",href:"/dashboard/profile"}})]}),(D||ee)&&(0,a.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex items-center gap-3",children:[(0,a.jsx)(c.lM,{checked:A,onChange:()=>eG(!A)}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("p",{className:"font-medium text-sm",children:"Allow dashboard access via tunnel"}),(0,a.jsx)(b,{text:"When enabled, the dashboard can be accessed through your tunnel or Tailscale URL (login still required). When disabled, dashboard access via tunnel/Tailscale is completely blocked."})]})]})]}),(0,a.jsx)(c.Zp,{id:"rtk",children:(0,a.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-primary",children:"bolt"}),"Token Saver"]}),(0,a.jsx)("p",{className:"text-sm text-text-muted mt-1",children:"RTK, Caveman, Ponytail, Headroom, and PXPIPE live on the Token Saver page."})]}),(0,a.jsxs)(o(),{href:"/dashboard/token-saver",className:"shrink-0 inline-flex items-center gap-1.5 rounded-lg border border-border px-3 py-2 text-sm font-medium text-text-main hover:border-primary/40 hover:text-primary transition-colors",children:["Open",(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"arrow_forward"})]})]})}),(0,a.jsxs)(c.Zp,{id:"require-api-key",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsxs)("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-primary",children:"vpn_key"}),"API Keys"]}),(0,a.jsx)(c.$n,{icon:"add",onClick:()=>f(!0),children:"Create Key"})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between pb-4 mb-4 border-b border-border",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium",children:"Require API key"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Requests without a valid key will be rejected"})]}),(0,a.jsx)(c.lM,{checked:S,onChange:()=>eY(!S)})]}),ez&&!S&&(0,a.jsx)("div",{className:"mb-4 -mt-2",children:(0,a.jsx)(g,{message:"Endpoint is exposed without an API key."})}),0===t.length?(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-primary/10 text-primary mb-4",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[32px]",children:"vpn_key"})}),(0,a.jsx)("p",{className:"text-text-main font-medium mb-1",children:"No API keys yet"}),(0,a.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Create your first API key to get started"}),(0,a.jsx)(c.$n,{icon:"add",onClick:()=>f(!0),children:"Create Key"})]}):(0,a.jsx)("div",{className:"flex flex-col",children:t.map(e=>{var t;return(0,a.jsxs)("div",{className:`group flex items-center justify-between py-3 border-b border-black/[0.03] dark:border-white/[0.03] last:border-b-0 ${!1===e.isActive?"opacity-60":""}`,children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"text-sm font-medium",children:e.name}),(0,a.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,a.jsx)("code",{className:"text-xs text-text-muted font-mono",children:eL.has(e.id)?e.key:(t=e.key)?t.length>8?t.slice(0,8)+"...":t:""}),(0,a.jsx)("button",{onClick:()=>{var t;return t=e.id,void eK(e=>{let s=new Set(e);return s.has(t)?s.delete(t):s.add(t),s})},className:"p-1 hover:bg-black/5 dark:hover:bg-white/5 rounded text-text-muted hover:text-primary opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-all",title:eL.has(e.id)?"Hide key":"Show key",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:eL.has(e.id)?"visibility_off":"visibility"})}),(0,a.jsx)("button",{onClick:()=>eZ(e.key,e.id),className:"p-1 hover:bg-black/5 dark:hover:bg-white/5 rounded text-text-muted hover:text-primary opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-all",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:eH===e.id?"check":"content_copy"})})]}),(0,a.jsxs)("p",{className:"text-xs text-text-muted mt-1",children:["Created ",new Date(e.createdAt).toLocaleDateString()]}),!1===e.isActive&&(0,a.jsx)("p",{className:"text-xs text-orange-500 mt-1",children:"Paused"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(c.lM,{size:"sm",checked:e.isActive??!0,onChange:t=>{e.isActive&&!t?C({title:"Pause API Key",message:`Pause API key "${e.name}"?
|
|
2
|
+
|
|
3
|
+
This key will stop working immediately but can be resumed later.`,onConfirm:async()=>{C(null),tn(e.id,t)}}):tn(e.id,t)},title:e.isActive?"Pause key":"Resume key"}),(0,a.jsx)("button",{onClick:()=>tl(e.id),className:"p-2 hover:bg-red-500/10 rounded text-red-500 opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-all",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"})})]})]},e.id)})})]}),(0,a.jsx)(c.aF,{isOpen:i,title:"Create API Key",onClose:()=>{f(!1),k("")},children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsx)(c.pd,{label:"Key Name",value:j,onChange:e=>k(e.target.value),placeholder:"Production Key"}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(c.$n,{onClick:ta,fullWidth:!0,disabled:!j.trim(),children:"Create"}),(0,a.jsx)(c.$n,{onClick:()=>{f(!1),k("")},variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}),(0,a.jsx)(c.aF,{isOpen:!!v,title:"API Key Created",onClose:()=>w(null),children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-4",children:[(0,a.jsx)("p",{className:"text-sm text-yellow-800 dark:text-yellow-200 mb-2 font-medium",children:"Save this key now!"}),(0,a.jsx)("p",{className:"text-sm text-yellow-700 dark:text-yellow-300",children:"This is the only time you will see this key. Store it securely."})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(c.pd,{value:v||"",readOnly:!0,className:"flex-1 font-mono text-sm"}),(0,a.jsx)(c.$n,{variant:"secondary",icon:"created_key"===eH?"check":"content_copy",onClick:()=>eZ(v,"created_key"),children:"created_key"===eH?"Copied!":"Copy"})]}),(0,a.jsx)(c.$n,{onClick:()=>w(null),fullWidth:!0,children:"Done"})]})}),(0,a.jsx)(c.aF,{isOpen:V,title:"Enable Tunnel",onClose:()=>X(!1),children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsx)("div",{className:"bg-surface-2 border border-border-subtle rounded-lg p-4",children:(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-primary",children:"cloud_upload"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm text-text-main font-medium mb-1",children:"Cloudflare Tunnel"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Expose your local ZevaiRouter to the internet. No port forwarding, no static IP needed. Share endpoint URL with your team or use it in Cursor, Cline, and other AI tools from anywhere."})]})]})}),(0,a.jsx)("div",{className:"grid grid-cols-2 gap-3",children:m.map(e=>(0,a.jsxs)("div",{className:"flex flex-col items-center text-center p-3 rounded-lg bg-sidebar/50",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-xl text-primary mb-1",children:e.icon}),(0,a.jsx)("p",{className:"text-xs font-semibold",children:e.title}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:e.desc})]},e.title))}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Requires outbound port 7844 (TCP/UDP). Connection may take 10-30s."}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(c.$n,{onClick:e5,fullWidth:!0,children:"Start Tunnel"}),(0,a.jsx)(c.$n,{onClick:()=>X(!1),variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}),(0,a.jsx)(c.aF,{isOpen:G,title:"Disable Tunnel",onClose:()=>!J&&Y(!1),children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"The Cloudflare tunnel will be disconnected. Remote access via tunnel URL will stop working."}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(c.$n,{onClick:e2,fullWidth:!0,disabled:J,variant:"danger",children:J?"Disabling...":"Disable"}),(0,a.jsx)(c.$n,{onClick:()=>Y(!1),variant:"ghost",fullWidth:!0,disabled:J,children:"Cancel"})]})]})}),(0,a.jsx)(c.aF,{isOpen:eS,title:"Tailscale Funnel",onClose:()=>{eg||(eT(!1),ew(""),em(null))},children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[null===ey&&(0,a.jsxs)("p",{className:"text-sm text-text-muted flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin text-sm",children:"progress_activity"}),"Checking..."]}),!1===ey&&!eg&&(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Tailscale is not installed. Install it to enable Funnel."}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(c.$n,{onClick:e3,fullWidth:!0,children:"Install Tailscale"}),(0,a.jsx)(c.$n,{onClick:()=>eT(!1),variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),eg&&(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin text-sm",children:"progress_activity"}),"Installing Tailscale..."]}),ej.length>0&&(0,a.jsx)("div",{ref:eE,className:"bg-black/5 dark:bg-white/5 rounded p-2 max-h-40 overflow-y-auto font-mono text-xs text-text-muted",children:ej.map((e,t)=>(0,a.jsx)("div",{children:e},t))})]}),!0===ey&&!eg&&(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm text-green-600 dark:text-green-400",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"check_circle"}),"Tailscale installed"]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(c.$n,{onClick:()=>e7(),fullWidth:!0,children:"Connect"}),(0,a.jsx)(c.$n,{onClick:()=>eT(!1),variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),ed&&(0,a.jsx)(y,{status:ed})]})}),(0,a.jsx)(c.aF,{isOpen:eP,title:"Disable Tailscale",onClose:()=>!er&&e_(!1),children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Tailscale Funnel will be stopped. Remote access via Tailscale URL will stop working."}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(c.$n,{onClick:tt,fullWidth:!0,disabled:er,variant:"danger",children:er?"Disabling...":"Disable"}),(0,a.jsx)(c.$n,{onClick:()=>e_(!1),variant:"ghost",fullWidth:!0,disabled:er,children:"Cancel"})]})]})}),(0,a.jsx)(c.uo,{isOpen:!!N,onClose:()=>C(null),onConfirm:N?.onConfirm,title:N?.title||"Confirm",message:N?.message,variant:"danger"})]})}function p({label:e,url:t,copyId:s,copied:l,onCopy:n,badge:r,actions:i}){return(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:`text-xs font-mono px-1.5 py-0.5 rounded shrink-0 min-w-[88px] text-center ${"CF"===r||"TS"===r?"bg-primary/10 text-primary":"bg-surface-2 text-text-muted"}`,children:e}),(0,a.jsx)(c.pd,{value:t,readOnly:!0,className:"flex-1 font-mono text-sm"}),(0,a.jsx)("button",{onClick:()=>n(t,s),className:"p-2 hover:bg-black/5 dark:hover:bg-white/5 rounded text-text-muted hover:text-primary transition-colors shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:l===s?"check":"content_copy"})}),i]})}function y({status:e,className:t=""}){return(0,a.jsx)("div",{className:`p-2 rounded text-sm ${t} ${"success"===e.type?"bg-green-500/10 text-green-600 dark:text-green-400":"warning"===e.type?"bg-yellow-500/10 text-yellow-600 dark:text-yellow-400":"info"===e.type?"bg-blue-500/10 text-blue-600 dark:text-blue-400":"bg-red-500/10 text-red-600 dark:text-red-400"}`,children:e.message.split(/(https?:\/\/[^\s]+)/g).map((e,t)=>/^https?:\/\//.test(e)?(0,a.jsx)("a",{href:e,target:"_blank",rel:"noreferrer",className:"underline font-medium",children:e},t):e)})}function b({text:e}){return(0,a.jsxs)("span",{className:"relative group inline-flex items-center",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted cursor-help",children:"help"}),(0,a.jsx)("span",{className:"pointer-events-none absolute left-5 top-1/2 -translate-y-1/2 z-50 w-64 rounded bg-gray-900 dark:bg-gray-800 text-white text-xs px-2.5 py-1.5 opacity-0 group-hover:opacity-100 transition-opacity shadow-lg",children:e})]})}function g({message:e,action:t}){return(0,a.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-amber-500/10 border border-amber-500/20 text-amber-700 dark:text-amber-400",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px] shrink-0 mt-0.5",children:"warning"}),(0,a.jsx)("p",{className:"text-xs flex-1",children:e}),t&&(0,a.jsx)("a",{href:t.href,className:"text-xs font-medium underline shrink-0 hover:opacity-80",onClick:t.href.startsWith("#")?e=>{e.preventDefault(),document.getElementById(t.href.slice(1))?.scrollIntoView({behavior:"smooth"})}:void 0,children:t.label})]})}h.propTypes={machineId:r().string.isRequired}}}]);
|
package/cli/app/package.json
CHANGED
package/cli/package.json
CHANGED
package/package.json
CHANGED
|
@@ -2,12 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
import { useState, useEffect, useRef, useCallback } from "react";
|
|
4
4
|
import PropTypes from "prop-types";
|
|
5
|
+
import Link from "next/link";
|
|
5
6
|
import { Card, Button, Input, Modal, CardSkeleton, Toggle, ConfirmModal } from "@/shared/components";
|
|
6
7
|
import { useCopyToClipboard } from "@/shared/hooks/useCopyToClipboard";
|
|
7
|
-
import { getCurrentLocale, onLocaleChange } from "@/i18n/runtime";
|
|
8
|
-
|
|
9
|
-
// Locales that unlock wenyan (classical Chinese) caveman levels
|
|
10
|
-
const WENYAN_LOCALES = ["zh-CN", "zh-TW"];
|
|
11
8
|
|
|
12
9
|
const TUNNEL_BENEFITS = [
|
|
13
10
|
{ icon: "public", title: "Access Anywhere", desc: "Use your API from any network" },
|
|
@@ -53,20 +50,6 @@ async function clientPingAny(...urls) {
|
|
|
53
50
|
});
|
|
54
51
|
}
|
|
55
52
|
|
|
56
|
-
const CAVEMAN_LEVELS = [
|
|
57
|
-
{ id: "lite", label: "Lite", desc: "Drop filler, keep grammar" },
|
|
58
|
-
{ id: "full", label: "Full", desc: "Drop articles, fragments OK" },
|
|
59
|
-
{ id: "ultra", label: "Ultra", desc: "Telegraphic, max compression" },
|
|
60
|
-
{ id: "wenyan-lite", label: "文 Lite", desc: "Classical Chinese, light compression", wenyan: true },
|
|
61
|
-
{ id: "wenyan", label: "文 Full", desc: "Maximum 文言文, 80-90% reduction", wenyan: true },
|
|
62
|
-
{ id: "wenyan-ultra", label: "文 Ultra", desc: "Extreme classical compression", wenyan: true },
|
|
63
|
-
];
|
|
64
|
-
|
|
65
|
-
const PONYTAIL_LEVELS = [
|
|
66
|
-
{ id: "lite", label: "Lite", desc: "Suggest lazier alternative" },
|
|
67
|
-
{ id: "full", label: "Full", desc: "Enforce the ladder, shortest diff" },
|
|
68
|
-
{ id: "ultra", label: "Ultra", desc: "YAGNI extremist, one-liner or bust" },
|
|
69
|
-
];
|
|
70
53
|
export default function APIPageClient({ machineId }) {
|
|
71
54
|
const [keys, setKeys] = useState([]);
|
|
72
55
|
const [loading, setLoading] = useState(true);
|
|
@@ -79,12 +62,6 @@ export default function APIPageClient({ machineId }) {
|
|
|
79
62
|
const [requireLogin, setRequireLogin] = useState(true);
|
|
80
63
|
const [hasPassword, setHasPassword] = useState(true);
|
|
81
64
|
const [tunnelDashboardAccess, setTunnelDashboardAccess] = useState(false);
|
|
82
|
-
const [rtkEnabled, setRtkEnabledState] = useState(true);
|
|
83
|
-
const [cavemanEnabled, setCavemanEnabled] = useState(false);
|
|
84
|
-
const [cavemanLevel, setCavemanLevel] = useState("full");
|
|
85
|
-
const [ponytailEnabled, setPonytailEnabled] = useState(false);
|
|
86
|
-
const [ponytailLevel, setPonytailLevel] = useState("full");
|
|
87
|
-
const [locale, setLocale] = useState("en");
|
|
88
65
|
|
|
89
66
|
// Cloudflare Tunnel state
|
|
90
67
|
const [tunnelChecking, setTunnelChecking] = useState(true);
|
|
@@ -140,26 +117,6 @@ export default function APIPageClient({ machineId }) {
|
|
|
140
117
|
setIsRemoteHost(!["localhost", "127.0.0.1", "::1"].includes(window.location.hostname));
|
|
141
118
|
}, []);
|
|
142
119
|
|
|
143
|
-
// Track app UI locale to gate wenyan caveman levels
|
|
144
|
-
useEffect(() => {
|
|
145
|
-
setLocale(getCurrentLocale());
|
|
146
|
-
return onLocaleChange(() => setLocale(getCurrentLocale()));
|
|
147
|
-
}, []);
|
|
148
|
-
|
|
149
|
-
const isWenyanLocale = WENYAN_LOCALES.includes(locale);
|
|
150
|
-
const visibleCavemanLevels = isWenyanLocale
|
|
151
|
-
? CAVEMAN_LEVELS
|
|
152
|
-
: CAVEMAN_LEVELS.filter((lvl) => !lvl.wenyan);
|
|
153
|
-
|
|
154
|
-
// Reset wenyan level to "ultra" when leaving a Chinese locale
|
|
155
|
-
useEffect(() => {
|
|
156
|
-
const current = CAVEMAN_LEVELS.find((lvl) => lvl.id === cavemanLevel);
|
|
157
|
-
if (current?.wenyan && !isWenyanLocale) {
|
|
158
|
-
setCavemanLevel("ultra");
|
|
159
|
-
patchSetting({ cavemanLevel: "ultra" });
|
|
160
|
-
}
|
|
161
|
-
}, [isWenyanLocale, cavemanLevel]);
|
|
162
|
-
|
|
163
120
|
const { copied, copy } = useCopyToClipboard();
|
|
164
121
|
|
|
165
122
|
// Security gate: block remote exposure while dashboard uses default password or login is off.
|
|
@@ -280,11 +237,6 @@ export default function APIPageClient({ machineId }) {
|
|
|
280
237
|
setRequireLogin(data.requireLogin !== false);
|
|
281
238
|
setHasPassword(data.hasPassword || false);
|
|
282
239
|
setTunnelDashboardAccess(data.tunnelDashboardAccess || false);
|
|
283
|
-
setRtkEnabledState(data.rtkEnabled !== false);
|
|
284
|
-
setCavemanEnabled(!!data.cavemanEnabled);
|
|
285
|
-
setCavemanLevel(data.cavemanLevel || "full");
|
|
286
|
-
setPonytailEnabled(!!data.ponytailEnabled);
|
|
287
|
-
setPonytailLevel(data.ponytailLevel || "full");
|
|
288
240
|
}
|
|
289
241
|
if (statusRes.ok) {
|
|
290
242
|
const data = await statusRes.json();
|
|
@@ -334,51 +286,6 @@ export default function APIPageClient({ machineId }) {
|
|
|
334
286
|
}
|
|
335
287
|
};
|
|
336
288
|
|
|
337
|
-
const handleRtkEnabled = async (value) => {
|
|
338
|
-
try {
|
|
339
|
-
const res = await fetch("/api/settings", {
|
|
340
|
-
method: "PATCH",
|
|
341
|
-
headers: { "Content-Type": "application/json" },
|
|
342
|
-
body: JSON.stringify({ rtkEnabled: value }),
|
|
343
|
-
});
|
|
344
|
-
if (res.ok) setRtkEnabledState(value);
|
|
345
|
-
} catch (error) {
|
|
346
|
-
console.log("Error updating rtkEnabled:", error);
|
|
347
|
-
}
|
|
348
|
-
};
|
|
349
|
-
|
|
350
|
-
const patchSetting = async (patch) => {
|
|
351
|
-
try {
|
|
352
|
-
await fetch("/api/settings", {
|
|
353
|
-
method: "PATCH",
|
|
354
|
-
headers: { "Content-Type": "application/json" },
|
|
355
|
-
body: JSON.stringify(patch),
|
|
356
|
-
});
|
|
357
|
-
} catch (error) {
|
|
358
|
-
console.log("Error updating setting:", error);
|
|
359
|
-
}
|
|
360
|
-
};
|
|
361
|
-
|
|
362
|
-
const handleCavemanEnabled = (value) => {
|
|
363
|
-
setCavemanEnabled(value);
|
|
364
|
-
patchSetting({ cavemanEnabled: value });
|
|
365
|
-
};
|
|
366
|
-
|
|
367
|
-
const handleCavemanLevel = (level) => {
|
|
368
|
-
setCavemanLevel(level);
|
|
369
|
-
patchSetting({ cavemanLevel: level });
|
|
370
|
-
};
|
|
371
|
-
|
|
372
|
-
const handlePonytailEnabled = (value) => {
|
|
373
|
-
setPonytailEnabled(value);
|
|
374
|
-
patchSetting({ ponytailEnabled: value });
|
|
375
|
-
};
|
|
376
|
-
|
|
377
|
-
const handlePonytailLevel = (level) => {
|
|
378
|
-
setPonytailLevel(level);
|
|
379
|
-
patchSetting({ ponytailLevel: level });
|
|
380
|
-
};
|
|
381
|
-
|
|
382
289
|
const fetchData = async () => {
|
|
383
290
|
try {
|
|
384
291
|
const keysRes = await fetch("/api/keys");
|
|
@@ -1074,129 +981,25 @@ export default function APIPageClient({ machineId }) {
|
|
|
1074
981
|
)}
|
|
1075
982
|
</Card>
|
|
1076
983
|
|
|
1077
|
-
{/* Token Saver
|
|
984
|
+
{/* Token Saver moved to its own page */}
|
|
1078
985
|
<Card id="rtk">
|
|
1079
|
-
<div className="flex items-center justify-between
|
|
1080
|
-
<
|
|
1081
|
-
<
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
<p className="font-medium">
|
|
1088
|
-
Compress tool output{" "}
|
|
1089
|
-
<a
|
|
1090
|
-
href="https://github.com/rtk-ai/rtk"
|
|
1091
|
-
target="_blank"
|
|
1092
|
-
rel="noreferrer"
|
|
1093
|
-
className="text-xs font-normal text-primary underline hover:opacity-80"
|
|
1094
|
-
>
|
|
1095
|
-
(RTK)
|
|
1096
|
-
</a>
|
|
1097
|
-
</p>
|
|
1098
|
-
<p className="text-sm text-text-muted">
|
|
1099
|
-
git/grep/ls/tree/logs → 60-90% fewer input tokens
|
|
1100
|
-
</p>
|
|
1101
|
-
</div>
|
|
1102
|
-
<Toggle
|
|
1103
|
-
checked={rtkEnabled}
|
|
1104
|
-
onChange={() => handleRtkEnabled(!rtkEnabled)}
|
|
1105
|
-
/>
|
|
1106
|
-
</div>
|
|
1107
|
-
<div className="flex items-center justify-between pt-4 gap-4 flex-wrap">
|
|
1108
|
-
<div className="min-w-0 flex-1">
|
|
1109
|
-
<p className="font-medium">
|
|
1110
|
-
Compress LLM output{" "}
|
|
1111
|
-
<a
|
|
1112
|
-
href="https://github.com/JuliusBrussee/caveman"
|
|
1113
|
-
target="_blank"
|
|
1114
|
-
rel="noreferrer"
|
|
1115
|
-
className="text-xs font-normal text-primary underline hover:opacity-80"
|
|
1116
|
-
>
|
|
1117
|
-
(Caveman)
|
|
1118
|
-
</a>
|
|
1119
|
-
</p>
|
|
1120
|
-
<p className="text-sm text-text-muted">
|
|
1121
|
-
Terse-style system prompt → ~65% fewer output tokens (up to 87%)
|
|
986
|
+
<div className="flex items-center justify-between gap-4">
|
|
987
|
+
<div className="min-w-0">
|
|
988
|
+
<h2 className="text-lg font-semibold flex items-center gap-2">
|
|
989
|
+
<span className="material-symbols-outlined text-primary">bolt</span>
|
|
990
|
+
Token Saver
|
|
991
|
+
</h2>
|
|
992
|
+
<p className="text-sm text-text-muted mt-1">
|
|
993
|
+
RTK, Caveman, Ponytail, Headroom, and PXPIPE live on the Token Saver page.
|
|
1122
994
|
</p>
|
|
1123
995
|
</div>
|
|
1124
|
-
<
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
onClick={() => handleCavemanLevel(lvl.id)}
|
|
1132
|
-
className={`px-3 py-1.5 rounded text-xs font-medium border transition-colors ${
|
|
1133
|
-
cavemanLevel === lvl.id
|
|
1134
|
-
? "bg-primary text-white border-primary"
|
|
1135
|
-
: "bg-transparent border-border text-text-muted hover:bg-surface-2"
|
|
1136
|
-
}`}
|
|
1137
|
-
title={lvl.desc}
|
|
1138
|
-
>
|
|
1139
|
-
{lvl.label}
|
|
1140
|
-
</button>
|
|
1141
|
-
))}
|
|
1142
|
-
</div>
|
|
1143
|
-
<p className="text-xs text-primary">
|
|
1144
|
-
{CAVEMAN_LEVELS.find((lvl) => lvl.id === cavemanLevel)?.desc}
|
|
1145
|
-
</p>
|
|
1146
|
-
</div>
|
|
1147
|
-
)}
|
|
1148
|
-
<Toggle
|
|
1149
|
-
checked={cavemanEnabled}
|
|
1150
|
-
onChange={() => handleCavemanEnabled(!cavemanEnabled)}
|
|
1151
|
-
/>
|
|
1152
|
-
</div>
|
|
1153
|
-
</div>
|
|
1154
|
-
<div className="flex items-center justify-between pt-4 border-t border-border gap-4 flex-wrap">
|
|
1155
|
-
<div className="min-w-0 flex-1">
|
|
1156
|
-
<p className="font-medium">
|
|
1157
|
-
Lazy code style{" "}
|
|
1158
|
-
<a
|
|
1159
|
-
href="https://github.com/DietrichGebert/ponytail"
|
|
1160
|
-
target="_blank"
|
|
1161
|
-
rel="noreferrer"
|
|
1162
|
-
className="text-xs font-normal text-primary underline hover:opacity-80"
|
|
1163
|
-
>
|
|
1164
|
-
(Ponytail)
|
|
1165
|
-
</a>
|
|
1166
|
-
</p>
|
|
1167
|
-
<p className="text-sm text-text-muted">
|
|
1168
|
-
YAGNI ladder → shortest diff, minimal code
|
|
1169
|
-
</p>
|
|
1170
|
-
</div>
|
|
1171
|
-
<div className="flex items-center gap-3 shrink-0">
|
|
1172
|
-
{ponytailEnabled && (
|
|
1173
|
-
<div className="flex flex-col items-end gap-1">
|
|
1174
|
-
<div className="flex items-center gap-1.5">
|
|
1175
|
-
{PONYTAIL_LEVELS.map((lvl) => (
|
|
1176
|
-
<button
|
|
1177
|
-
key={lvl.id}
|
|
1178
|
-
onClick={() => handlePonytailLevel(lvl.id)}
|
|
1179
|
-
className={`px-3 py-1.5 rounded text-xs font-medium border transition-colors ${
|
|
1180
|
-
ponytailLevel === lvl.id
|
|
1181
|
-
? "bg-primary text-white border-primary"
|
|
1182
|
-
: "bg-transparent border-border text-text-muted hover:bg-surface-2"
|
|
1183
|
-
}`}
|
|
1184
|
-
title={lvl.desc}
|
|
1185
|
-
>
|
|
1186
|
-
{lvl.label}
|
|
1187
|
-
</button>
|
|
1188
|
-
))}
|
|
1189
|
-
</div>
|
|
1190
|
-
<p className="text-xs text-primary">
|
|
1191
|
-
{PONYTAIL_LEVELS.find((lvl) => lvl.id === ponytailLevel)?.desc}
|
|
1192
|
-
</p>
|
|
1193
|
-
</div>
|
|
1194
|
-
)}
|
|
1195
|
-
<Toggle
|
|
1196
|
-
checked={ponytailEnabled}
|
|
1197
|
-
onChange={() => handlePonytailEnabled(!ponytailEnabled)}
|
|
1198
|
-
/>
|
|
1199
|
-
</div>
|
|
996
|
+
<Link
|
|
997
|
+
href="/dashboard/token-saver"
|
|
998
|
+
className="shrink-0 inline-flex items-center gap-1.5 rounded-lg border border-border px-3 py-2 text-sm font-medium text-text-main hover:border-primary/40 hover:text-primary transition-colors"
|
|
999
|
+
>
|
|
1000
|
+
Open
|
|
1001
|
+
<span className="material-symbols-outlined text-[16px]">arrow_forward</span>
|
|
1002
|
+
</Link>
|
|
1200
1003
|
</div>
|
|
1201
1004
|
</Card>
|
|
1202
1005
|
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[523],{80523:(e,t,s)=>{Promise.resolve().then(s.bind(s,95907))},95907:(e,t,s)=>{"use strict";s.d(t,{default:()=>b});var a=s(95155),l=s(12115),n=s(14051),r=s.n(n),i=s(35497),o=s(11059),c=s(73006);let d=["zh-CN","zh-TW"],m=[{icon:"public",title:"Access Anywhere",desc:"Use your API from any network"},{icon:"group",title:"Share Endpoint",desc:"Share URL with team members"},{icon:"code",title:"Use in Cursor/Cline",desc:"Connect AI tools remotely"},{icon:"lock",title:"Encrypted",desc:"End-to-end TLS via Cloudflare"}];async function x(e){if(!e)return!1;try{return(await fetch(`${e}/api/health`,{mode:"cors",cache:"no-store",signal:AbortSignal.timeout(5e3)})).ok}catch{return!1}}async function u(...e){let t=e.filter(Boolean).map(x);return!!t.length&&new Promise(e=>{let s=t.length;t.forEach(t=>t.then(t=>{t?e(!0):0==--s&&e(!1)}))})}let h=[{id:"lite",label:"Lite",desc:"Drop filler, keep grammar"},{id:"full",label:"Full",desc:"Drop articles, fragments OK"},{id:"ultra",label:"Ultra",desc:"Telegraphic, max compression"},{id:"wenyan-lite",label:"文 Lite",desc:"Classical Chinese, light compression",wenyan:!0},{id:"wenyan",label:"文 Full",desc:"Maximum 文言文, 80-90% reduction",wenyan:!0},{id:"wenyan-ultra",label:"文 Ultra",desc:"Extreme classical compression",wenyan:!0}],p=[{id:"lite",label:"Lite",desc:"Suggest lazier alternative"},{id:"full",label:"Full",desc:"Enforce the ladder, shortest diff"},{id:"ultra",label:"Ultra",desc:"YAGNI extremist, one-liner or bust"}];function b({machineId:e}){let[t,s]=(0,l.useState)([]),[n,r]=(0,l.useState)(!0),[v,k]=(0,l.useState)(!1),[w,N]=(0,l.useState)(""),[C,S]=(0,l.useState)(null),[T,E]=(0,l.useState)(null),[P,_]=(0,l.useState)(!1),[$,A]=(0,l.useState)(!0),[O,U]=(0,l.useState)(!0),[I,D]=(0,l.useState)(!1),[F,L]=(0,l.useState)(!0),[R,W]=(0,l.useState)(!1),[q,K]=(0,l.useState)("full"),[z,J]=(0,l.useState)(!1),[M,H]=(0,l.useState)("full"),[B,Z]=(0,l.useState)("en"),[G,Q]=(0,l.useState)(!0),[Y,V]=(0,l.useState)(!1),[X,ee]=(0,l.useState)(!1),[et,es]=(0,l.useState)(""),[ea,el]=(0,l.useState)(""),[en,er]=(0,l.useState)(!1),[ei,eo]=(0,l.useState)(""),[ec,ed]=(0,l.useState)(null),[em,ex]=(0,l.useState)(!1),[eu,eh]=(0,l.useState)(!1),[ep,eb]=(0,l.useState)(!1),[ey,ef]=(0,l.useState)(!1),[eg,ej]=(0,l.useState)(""),[ev,ek]=(0,l.useState)(!1),[ew,eN]=(0,l.useState)(""),[eC,eS]=(0,l.useState)(null),[eT,eE]=(0,l.useState)(""),[eP,e_]=(0,l.useState)(""),[e$,eA]=(0,l.useState)(null),[eO,eU]=(0,l.useState)(!1),[eI,eD]=(0,l.useState)([]),[eF,eL]=(0,l.useState)(""),[eR,eW]=(0,l.useState)(!1),[eq,eK]=(0,l.useState)(!1),[ez,eJ]=(0,l.useState)(!1),eM=(0,l.useRef)(null),eH=(0,l.useRef)(0),eB=(0,l.useRef)(0),eZ=(0,l.useRef)(!1),eG=(0,l.useRef)(!1),eQ=(0,l.useRef)(!1),eY=(0,l.useRef)(!1),[eV,eX]=(0,l.useState)(!1),[e0,e1]=(0,l.useState)(!1),[e5,e2]=(0,l.useState)(new Set),[e4,e3]=(0,l.useState)(!1);(0,l.useEffect)(()=>{e3(!["localhost","127.0.0.1","::1"].includes(window.location.hostname))},[]),(0,l.useEffect)(()=>(Z((0,c.kk)()),(0,c.oQ)(()=>Z((0,c.kk)()))),[]);let e8=d.includes(B),e6=e8?h:h.filter(e=>!e.wenyan);(0,l.useEffect)(()=>{let e=h.find(e=>e.id===q);e?.wenyan&&!e8&&(K("ultra"),to({cavemanLevel:"ultra"}))},[e8,q]);let{copied:e7,copy:e9}=(0,o.C)(),te=!$||!O,tt=$?"Change the default dashboard password before activating the tunnel.":'Enable "Require login" and set a custom password before activating the tunnel.';(0,l.useEffect)(()=>{eM.current&&(eM.current.scrollTop=eM.current.scrollHeight)},[eI]),(0,l.useEffect)(()=>{tc(),tl()},[]),(0,l.useEffect)(()=>{if(!(Y||ep))return;let e=!Y||X,t=!ep||ey,s=()=>{document.hidden||ta()};if(document.addEventListener("visibilitychange",s),e&&t)return()=>document.removeEventListener("visibilitychange",s);let a=setInterval(()=>{document.hidden||ta()},5e3);return()=>{clearInterval(a),document.removeEventListener("visibilitychange",s)}},[Y,ep,X,ey]),(0,l.useEffect)(()=>{let e=async()=>{if(!document.hidden){if(Y&&(et||ea)){let e=await u(ea,et);eZ.current=e,e?(eH.current=0,ee(!0),eQ.current||(eQ.current=!0,eX(!0))):(eH.current+=1,eH.current>=5&&ee(!1))}else eZ.current=!1;if(ep&&eg){let e=await x(eg);eG.current=e,e?(eB.current=0,ef(!0),eY.current||(eY.current=!0,e1(!0))):(eB.current+=1,eB.current>=5&&ef(!1))}else eG.current=!1}};if(!(Y&&(et||ea)||ep&&eg))return;e();let t=!ep||ey;if((!Y||X)&&t)return;let s=setInterval(e,1e4);return()=>clearInterval(s)},[Y,et,ea,ep,eg,X,ey]);let ts=(0,l.useCallback)((e,t,s,a,l,n)=>{t.current?(s.current=0,a(!0),l.current||(l.current=!0,n(!0))):(s.current+=1,s.current>=5&&a(!1))},[]),ta=async()=>{try{let e=await fetch("/api/tunnel/status",{cache:"no-store"});if(!e.ok)return;let t=await e.json(),s=t.tunnel?.settingsEnabled??t.tunnel?.enabled??!1,a=t.tunnel?.tunnelUrl||"";es(a),el(t.tunnel?.publicUrl||""),V(s),ts(null,eZ,eH,ee,eQ,eX);let l=t.tailscale?.settingsEnabled??t.tailscale?.enabled??!1,n=t.tailscale?.tunnelUrl||"";ej(n),eb(l),ts(null,eG,eB,ef,eY,e1)}catch{}},tl=async()=>{Q(!0);try{let[e,t]=await Promise.all([fetch("/api/settings"),fetch("/api/tunnel/status",{cache:"no-store"})]);if(e.ok){let t=await e.json();_(t.requireApiKey||!1),A(!1!==t.requireLogin),U(t.hasPassword||!1),D(t.tunnelDashboardAccess||!1),L(!1!==t.rtkEnabled),W(!!t.cavemanEnabled),K(t.cavemanLevel||"full"),J(!!t.ponytailEnabled),H(t.ponytailLevel||"full")}if(t.ok){let e=await t.json(),s=e.tunnel?.settingsEnabled??e.tunnel?.enabled??!1,a=e.tunnel?.tunnelUrl||"";es(a),el(e.tunnel?.publicUrl||""),V(s),ts(null,eZ,eH,ee,eQ,eX);let l=e.tailscale?.settingsEnabled??e.tailscale?.enabled??!1,n=e.tailscale?.tunnelUrl||"";ej(n),eb(l),ts(null,eG,eB,ef,eY,e1)}}catch(e){console.log("Error loading settings:",e)}finally{Q(!1)}},tn=async e=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({tunnelDashboardAccess:e})})).ok&&D(e)}catch(e){console.log("Error updating tunnelDashboardAccess:",e)}},tr=async e=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({requireApiKey:e})})).ok&&_(e)}catch(e){console.log("Error updating requireApiKey:",e)}},ti=async e=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({rtkEnabled:e})})).ok&&L(e)}catch(e){console.log("Error updating rtkEnabled:",e)}},to=async e=>{try{await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}catch(e){console.log("Error updating setting:",e)}},tc=async()=>{try{let e=await fetch("/api/keys"),t=await e.json();e.ok&&s(t.keys||[])}catch(e){console.log("Error fetching data:",e)}finally{r(!1)}},td=async(...e)=>{er(!0),eo("Waiting for tunnel ready...");let t=e.filter(Boolean).map(e=>`${e}/api/health`),s=Date.now();for(;Date.now()-s<3e5;){if(await new Promise(e=>setTimeout(e,2e3)),await Promise.any(t.map(async e=>{if((await fetch(e,{mode:"cors",cache:"no-store"})).ok)return!0;throw Error("not ready")})).catch(()=>!1))return V(!0),er(!1),eo(""),!0;if((Date.now()-s)%1e4<2e3)try{let e=await fetch("/api/tunnel/status");if(e.ok){let t=await e.json();if(!t.tunnel?.enabled)return ed({type:"error",message:"Tunnel process stopped unexpectedly."}),er(!1),eo(""),!1}}catch{}}return ed({type:"error",message:"Tunnel created but not reachable. Please try again."}),er(!1),eo(""),!1},tm=async()=>{ex(!1),er(!0),ed(null),eo("Creating tunnel...");let e=!0;(async()=>{for(;e;){try{let t=await fetch("/api/tunnel/status");if(t.ok){let s=await t.json();s.download?.downloading?eo(`Downloading cloudflared... ${s.download.progress}%`):e&&eo("Creating tunnel...")}}catch{}await new Promise(e=>setTimeout(e,1e3))}})();try{let t=await fetch("/api/tunnel/enable",{method:"POST"});e=!1;let s=await t.json();if(!t.ok)return void ed({type:"error",message:s.error||"Failed to enable tunnel"});let a=s.tunnelUrl;if(!a)return void ed({type:"error",message:"No tunnel URL returned"});es(a),el(s.publicUrl||""),await td(s.publicUrl,a)}catch(e){ed({type:"error",message:e.message})}finally{e=!1,er(!1),eo("")}},tx=async()=>{er(!0),ed(null);try{let e=await fetch("/api/tunnel/disable",{method:"POST"}),t=await e.json();e.ok?(V(!1),es(""),eh(!1),ed({type:"success",message:"Tunnel disabled"})):ed({type:"error",message:t.error||"Failed to disable tunnel"})}catch(e){ed({type:"error",message:e.message})}finally{er(!1)}},tu=async()=>{eA(null);try{let e=await fetch("/api/tunnel/tailscale-check");if(e.ok){let t=await e.json();return eA(t.installed),t}}catch{}return eA(!1),{installed:!1}},th=async()=>{eU(!0),eS(null),eD([]);try{let e=await fetch("/api/tunnel/tailscale-install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sudoPassword:eF})});eL("");let t=e.body.getReader(),s=new TextDecoder,a="";for(;;){let{done:e,value:l}=await t.read();if(e)break;let n=(a+=s.decode(l,{stream:!0})).split("\n\n");for(let e of(a=n.pop()||"",n)){let t=e.split("\n"),s="progress",a=null;for(let e of t)if(e.startsWith("event: ")&&(s=e.slice(7).trim()),e.startsWith("data: "))try{a=JSON.parse(e.slice(6))}catch{}if(a)if("progress"===s)eD(e=>[...e.slice(-50),a.message]);else if("done"===s){eA(!0),eU(!1),eK(!1),tf();return}else"error"===s&&eS({type:"error",message:a.error||"Install failed"})}}}catch(e){eS({type:"error",message:e.message})}finally{eU(!1)}},tp=async e=>{eN("Waiting for Tailscale ready...");let t=`${e}/api/health`,s=Date.now();for(;Date.now()-s<3e5;){await new Promise(e=>setTimeout(e,2e3));try{let e=await fetch(t,{mode:"no-cors",cache:"no-store"});if(e.ok||"opaque"===e.type)return!0}catch{}}return!1},tb=(e,t)=>{eE(e),e_(t)},ty=()=>{eE(""),e_("")},tf=async()=>{eK(!1),eW(!0),ek(!0),eS(null),eN("Connecting..."),ty();try{let e=await fetch("/api/tunnel/tailscale-enable",{method:"POST"}),t=await e.json();if(e.ok&&t.success){ej(t.tunnelUrl||"");let e=await tp(t.tunnelUrl);eb(!0),eS(e?null:{type:"warning",message:"Connected but not reachable yet."});return}if(t.needsLogin&&t.authUrl){tb(t.authUrl,"Open Login Page"),eN('Login required — click "Open Login Page" to continue');for(let e=0;e<40;e++){await new Promise(e=>setTimeout(e,3e3));try{let e=await fetch("/api/tunnel/tailscale-check");if(e.ok&&(await e.json()).loggedIn){ty(),eN("Starting funnel...");let e=await fetch("/api/tunnel/tailscale-enable",{method:"POST"}),t=await e.json();if(e.ok&&t.success){ej(t.tunnelUrl||"");let e=await tp(t.tunnelUrl);eb(!0),eS(e?null:{type:"warning",message:"Connected but not reachable yet."})}else t.funnelNotEnabled&&t.enableUrl?await tg(t.enableUrl):eS({type:"error",message:t.error||"Failed to start funnel"});return}}catch{}}ty(),eS({type:"error",message:"Login timed out. Please try again."});return}if(t.funnelNotEnabled&&t.enableUrl)return void await tg(t.enableUrl);eS({type:"error",message:t.error||"Failed to connect"})}catch(e){eS({type:"error",message:e.message})}finally{ek(!1),eW(!1),eN(""),ty()}},tg=async e=>{tb(e,"Open Funnel Settings"),eN('Click "Open Funnel Settings" to enable Funnel...');for(let e=0;e<40;e++){await new Promise(e=>setTimeout(e,3e3));try{let e=await fetch("/api/tunnel/tailscale-enable",{method:"POST"}),t=await e.json();if(e.ok&&t.success){ty(),ej(t.tunnelUrl||"");let e=await tp(t.tunnelUrl);eb(!0),eS(e?null:{type:"warning",message:"Connected but not reachable yet."});return}if(t.funnelNotEnabled)continue;if(t.error){ty(),eS({type:"error",message:t.error});return}}catch{}}ty(),eS({type:"error",message:"Timed out waiting for Funnel to be enabled."})},tj=async()=>{ek(!0),eS(null);try{let e=await fetch("/api/tunnel/tailscale-disable",{method:"POST"}),t=await e.json();e.ok?(eb(!1),ej(""),eJ(!1),eS({type:"success",message:"Tailscale disabled"})):eS({type:"error",message:t.error||"Failed to disable Tailscale"})}catch(e){eS({type:"error",message:e.message})}finally{ek(!1)}},tv=async()=>{eS(null),eD([]);let e=await tu();e?.installed&&e?.hasCachedPassword?tf():eK(!0)},tk=async()=>{if(w.trim())try{let e=await fetch("/api/keys",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:w})}),t=await e.json();e.ok&&(S(t.key),await tc(),N(""),k(!1))}catch(e){console.log("Error creating key:",e)}},tw=async e=>{E({title:"Delete API Key",message:"Delete this API key?",onConfirm:async()=>{E(null);try{(await fetch(`/api/keys/${e}`,{method:"DELETE"})).ok&&(s(t.filter(t=>t.id!==e)),e2(t=>{let s=new Set(t);return s.delete(e),s}))}catch(e){console.log("Error deleting key:",e)}}})},tN=async(e,t)=>{try{(await fetch(`/api/keys/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&s(s=>s.map(s=>s.id===e?{...s,isActive:t}:s))}catch(e){console.log("Error toggling key:",e)}},[tC,tS]=(0,l.useState)("/v1");return((0,l.useEffect)(()=>{tS(`${window.location.origin}/v1`)},[]),n)?(0,a.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,a.jsx)(i.Qv,{}),(0,a.jsx)(i.Qv,{})]}):(0,a.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,a.jsxs)(i.Zp,{children:[(0,a.jsxs)("h2",{className:"text-lg font-semibold mb-4 flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-primary",children:"api"}),"API Endpoint"]}),(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(y,{label:"Local",url:tC,copyId:"local_url",copied:e7,onCopy:e9}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:`text-xs font-mono px-1.5 py-0.5 rounded shrink-0 min-w-[88px] text-center ${Y?"bg-primary/10 text-primary":"bg-surface-2 text-text-muted"}`,children:"Tunnel"}),Y&&!en&&X?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(i.pd,{value:`${ea||et}/v1`,readOnly:!0,className:"flex-1 font-mono text-sm"}),(0,a.jsx)("button",{onClick:()=>e9(`${ea||et}/v1`,"tunnel_url"),className:"p-2 hover:bg-black/5 dark:hover:bg-white/5 rounded text-text-muted hover:text-primary transition-colors shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"tunnel_url"===e7?"check":"content_copy"})}),(0,a.jsx)("button",{onClick:()=>eh(!0),className:"p-2 hover:bg-red-500/10 rounded text-red-500 transition-colors shrink-0",title:"Disable Tunnel",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"power_settings_new"})})]}):!Y||en||X?en?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex-1 flex items-center gap-2 px-3 py-1.5 rounded border border-border bg-input text-sm text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin text-sm",children:"progress_activity"}),ei||"Creating tunnel..."]}),(0,a.jsx)("button",{onClick:()=>{er(!1),eo("")},className:"p-2 hover:bg-red-500/10 rounded text-red-500 transition-colors shrink-0",title:"Stop",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"power_settings_new"})})]}):ec?.type==="error"?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex-1 flex items-center gap-2 px-3 py-1.5 rounded border border-red-300 dark:border-red-800 bg-red-500/5 text-sm text-red-600 dark:text-red-400",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"error"}),ec.message]}),(0,a.jsx)(i.$n,{size:"sm",icon:"cloud_upload",onClick:()=>ex(!0),children:"Enable"})]}):G?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex-1 flex items-center gap-2 px-3 py-1.5 rounded border border-border bg-input text-sm text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin text-sm",children:"progress_activity"}),"Checking..."]}),(0,a.jsx)("button",{onClick:()=>Q(!1),className:"p-2 hover:bg-red-500/10 rounded text-red-500 transition-colors shrink-0",title:"Stop",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"power_settings_new"})})]}):(0,a.jsx)(i.$n,{size:"sm",icon:"cloud_upload",onClick:()=>{te?ed({type:"error",message:`Security required: ${tt}`}):P?ex(!0):ed({type:"error",message:'Security required: Enable "Require API key" before activating the tunnel.'})},children:"Enable"}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex-1 flex items-center gap-2 px-3 py-1.5 rounded border border-amber-300 dark:border-amber-800 bg-amber-500/5 text-sm text-amber-600 dark:text-amber-400",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin text-sm",children:"progress_activity"}),eV?"Tunnel reconnecting...":"Tunnel checking..."]}),(0,a.jsx)("button",{onClick:()=>eh(!0),className:"p-2 hover:bg-red-500/10 rounded text-red-500 transition-colors shrink-0",title:"Disable Tunnel",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"power_settings_new"})})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:`text-xs font-mono px-1.5 py-0.5 rounded shrink-0 min-w-[88px] text-center ${ep?"bg-primary/10 text-primary":"bg-surface-2 text-text-muted"}`,children:"Tailscale"}),ep&&!ev&&ey?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(i.pd,{value:`${eg}/v1`,readOnly:!0,className:"flex-1 font-mono text-sm"}),(0,a.jsx)("button",{onClick:()=>e9(`${eg}/v1`,"ts_url"),className:"p-2 hover:bg-black/5 dark:hover:bg-white/5 rounded text-text-muted hover:text-primary transition-colors shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"ts_url"===e7?"check":"content_copy"})}),(0,a.jsx)("button",{onClick:()=>eJ(!0),className:"p-2 hover:bg-red-500/10 rounded text-red-500 transition-colors shrink-0",title:"Disable Tailscale",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"power_settings_new"})})]}):!ep||ev||ey?ev||eR?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex-1 flex items-center gap-2 px-3 py-1.5 rounded border border-border bg-input text-sm text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin text-sm",children:"progress_activity"}),ew||"Connecting..."]}),eT&&(0,a.jsx)(i.$n,{size:"sm",icon:"open_in_new",onClick:()=>window.open(eT,"tailscale_auth","width=600,height=700,noopener,noreferrer"),children:eP||"Open"}),(0,a.jsx)("button",{onClick:()=>{ek(!1),eW(!1),eN(""),ty()},className:"p-2 hover:bg-red-500/10 rounded text-red-500 transition-colors shrink-0",title:"Stop",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"power_settings_new"})})]}):eC?.type==="error"?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex-1 flex items-center gap-2 px-3 py-1.5 rounded border border-red-300 dark:border-red-800 bg-red-500/5 text-sm text-red-600 dark:text-red-400",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"error"}),eC.message]}),(0,a.jsx)(i.$n,{size:"sm",icon:"vpn_lock",onClick:tv,children:"Enable"})]}):(0,a.jsx)(i.$n,{size:"sm",icon:"vpn_lock",onClick:()=>{te?eS({type:"error",message:`Security required: ${tt}`}):tv()},className:"bg-linear-to-r from-indigo-500 to-purple-500 hover:from-indigo-600 hover:to-purple-600 text-white!",children:"Enable"}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex-1 flex items-center gap-2 px-3 py-1.5 rounded border border-amber-300 dark:border-amber-800 bg-amber-500/5 text-sm text-amber-600 dark:text-amber-400",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin text-sm",children:"progress_activity"}),e0?"Tailscale reconnecting...":"Tailscale checking..."]}),(0,a.jsx)("button",{onClick:()=>eJ(!0),className:"p-2 hover:bg-red-500/10 rounded text-red-500 transition-colors shrink-0",title:"Disable Tailscale",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"power_settings_new"})})]})]})]}),te&&!Y&&!ep&&(0,a.jsx)("div",{className:"mt-4",children:(0,a.jsx)(j,{message:tt,action:{label:"Open settings",href:"/dashboard/profile"}})}),(Y||ep)&&(0,a.jsxs)("div",{className:"mt-4 flex flex-col gap-2",children:[!P&&(0,a.jsx)(j,{message:"Require API key is disabled — your endpoint is publicly accessible without authentication.",action:{label:"Enable",href:"#require-api-key"}}),(!$||!O)&&(0,a.jsx)(j,{message:$?"Dashboard uses the default password — change it in Profile settings.":"Require login is disabled — anyone can access your dashboard via tunnel.",action:{label:$?"Change password":"Enable",href:"/dashboard/profile"}})]}),(Y||ep)&&(0,a.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex items-center gap-3",children:[(0,a.jsx)(i.lM,{checked:I,onChange:()=>tn(!I)}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("p",{className:"font-medium text-sm",children:"Allow dashboard access via tunnel"}),(0,a.jsx)(g,{text:"When enabled, the dashboard can be accessed through your tunnel or Tailscale URL (login still required). When disabled, dashboard access via tunnel/Tailscale is completely blocked."})]})]})]}),(0,a.jsxs)(i.Zp,{id:"rtk",children:[(0,a.jsx)("div",{className:"flex items-center justify-between mb-2",children:(0,a.jsxs)("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-primary",children:"bolt"}),"Token Saver"]})}),(0,a.jsxs)("div",{className:"flex items-center justify-between pt-2 pb-4 border-b border-border gap-4",children:[(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("p",{className:"font-medium",children:["Compress tool output"," ",(0,a.jsx)("a",{href:"https://github.com/rtk-ai/rtk",target:"_blank",rel:"noreferrer",className:"text-xs font-normal text-primary underline hover:opacity-80",children:"(RTK)"})]}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"git/grep/ls/tree/logs → 60-90% fewer input tokens"})]}),(0,a.jsx)(i.lM,{checked:F,onChange:()=>ti(!F)})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between pt-4 gap-4 flex-wrap",children:[(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("p",{className:"font-medium",children:["Compress LLM output"," ",(0,a.jsx)("a",{href:"https://github.com/JuliusBrussee/caveman",target:"_blank",rel:"noreferrer",className:"text-xs font-normal text-primary underline hover:opacity-80",children:"(Caveman)"})]}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Terse-style system prompt → ~65% fewer output tokens (up to 87%)"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3 shrink-0",children:[R&&(0,a.jsxs)("div",{className:"flex flex-col items-end gap-1",children:[(0,a.jsx)("div",{className:"flex items-center gap-1.5",children:e6.map(e=>(0,a.jsx)("button",{onClick:()=>{var t;K(t=e.id),to({cavemanLevel:t})},className:`px-3 py-1.5 rounded text-xs font-medium border transition-colors ${q===e.id?"bg-primary text-white border-primary":"bg-transparent border-border text-text-muted hover:bg-surface-2"}`,title:e.desc,children:e.label},e.id))}),(0,a.jsx)("p",{className:"text-xs text-primary",children:h.find(e=>e.id===q)?.desc})]}),(0,a.jsx)(i.lM,{checked:R,onChange:()=>{var e;W(e=!R),to({cavemanEnabled:e})}})]})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between pt-4 border-t border-border gap-4 flex-wrap",children:[(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("p",{className:"font-medium",children:["Lazy code style"," ",(0,a.jsx)("a",{href:"https://github.com/DietrichGebert/ponytail",target:"_blank",rel:"noreferrer",className:"text-xs font-normal text-primary underline hover:opacity-80",children:"(Ponytail)"})]}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"YAGNI ladder → shortest diff, minimal code"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3 shrink-0",children:[z&&(0,a.jsxs)("div",{className:"flex flex-col items-end gap-1",children:[(0,a.jsx)("div",{className:"flex items-center gap-1.5",children:p.map(e=>(0,a.jsx)("button",{onClick:()=>{var t;H(t=e.id),to({ponytailLevel:t})},className:`px-3 py-1.5 rounded text-xs font-medium border transition-colors ${M===e.id?"bg-primary text-white border-primary":"bg-transparent border-border text-text-muted hover:bg-surface-2"}`,title:e.desc,children:e.label},e.id))}),(0,a.jsx)("p",{className:"text-xs text-primary",children:p.find(e=>e.id===M)?.desc})]}),(0,a.jsx)(i.lM,{checked:z,onChange:()=>{var e;J(e=!z),to({ponytailEnabled:e})}})]})]})]}),(0,a.jsxs)(i.Zp,{id:"require-api-key",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsxs)("h2",{className:"text-lg font-semibold flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-primary",children:"vpn_key"}),"API Keys"]}),(0,a.jsx)(i.$n,{icon:"add",onClick:()=>k(!0),children:"Create Key"})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between pb-4 mb-4 border-b border-border",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium",children:"Require API key"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Requests without a valid key will be rejected"})]}),(0,a.jsx)(i.lM,{checked:P,onChange:()=>tr(!P)})]}),e4&&!P&&(0,a.jsx)("div",{className:"mb-4 -mt-2",children:(0,a.jsx)(j,{message:"Endpoint is exposed without an API key."})}),0===t.length?(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-primary/10 text-primary mb-4",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[32px]",children:"vpn_key"})}),(0,a.jsx)("p",{className:"text-text-main font-medium mb-1",children:"No API keys yet"}),(0,a.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Create your first API key to get started"}),(0,a.jsx)(i.$n,{icon:"add",onClick:()=>k(!0),children:"Create Key"})]}):(0,a.jsx)("div",{className:"flex flex-col",children:t.map(e=>{var t;return(0,a.jsxs)("div",{className:`group flex items-center justify-between py-3 border-b border-black/[0.03] dark:border-white/[0.03] last:border-b-0 ${!1===e.isActive?"opacity-60":""}`,children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"text-sm font-medium",children:e.name}),(0,a.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,a.jsx)("code",{className:"text-xs text-text-muted font-mono",children:e5.has(e.id)?e.key:(t=e.key)?t.length>8?t.slice(0,8)+"...":t:""}),(0,a.jsx)("button",{onClick:()=>{var t;return t=e.id,void e2(e=>{let s=new Set(e);return s.has(t)?s.delete(t):s.add(t),s})},className:"p-1 hover:bg-black/5 dark:hover:bg-white/5 rounded text-text-muted hover:text-primary opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-all",title:e5.has(e.id)?"Hide key":"Show key",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:e5.has(e.id)?"visibility_off":"visibility"})}),(0,a.jsx)("button",{onClick:()=>e9(e.key,e.id),className:"p-1 hover:bg-black/5 dark:hover:bg-white/5 rounded text-text-muted hover:text-primary opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-all",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:e7===e.id?"check":"content_copy"})})]}),(0,a.jsxs)("p",{className:"text-xs text-text-muted mt-1",children:["Created ",new Date(e.createdAt).toLocaleDateString()]}),!1===e.isActive&&(0,a.jsx)("p",{className:"text-xs text-orange-500 mt-1",children:"Paused"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(i.lM,{size:"sm",checked:e.isActive??!0,onChange:t=>{e.isActive&&!t?E({title:"Pause API Key",message:`Pause API key "${e.name}"?
|
|
2
|
-
|
|
3
|
-
This key will stop working immediately but can be resumed later.`,onConfirm:async()=>{E(null),tN(e.id,t)}}):tN(e.id,t)},title:e.isActive?"Pause key":"Resume key"}),(0,a.jsx)("button",{onClick:()=>tw(e.id),className:"p-2 hover:bg-red-500/10 rounded text-red-500 opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-all",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"})})]})]},e.id)})})]}),(0,a.jsx)(i.aF,{isOpen:v,title:"Create API Key",onClose:()=>{k(!1),N("")},children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsx)(i.pd,{label:"Key Name",value:w,onChange:e=>N(e.target.value),placeholder:"Production Key"}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(i.$n,{onClick:tk,fullWidth:!0,disabled:!w.trim(),children:"Create"}),(0,a.jsx)(i.$n,{onClick:()=>{k(!1),N("")},variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}),(0,a.jsx)(i.aF,{isOpen:!!C,title:"API Key Created",onClose:()=>S(null),children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsxs)("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-4",children:[(0,a.jsx)("p",{className:"text-sm text-yellow-800 dark:text-yellow-200 mb-2 font-medium",children:"Save this key now!"}),(0,a.jsx)("p",{className:"text-sm text-yellow-700 dark:text-yellow-300",children:"This is the only time you will see this key. Store it securely."})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(i.pd,{value:C||"",readOnly:!0,className:"flex-1 font-mono text-sm"}),(0,a.jsx)(i.$n,{variant:"secondary",icon:"created_key"===e7?"check":"content_copy",onClick:()=>e9(C,"created_key"),children:"created_key"===e7?"Copied!":"Copy"})]}),(0,a.jsx)(i.$n,{onClick:()=>S(null),fullWidth:!0,children:"Done"})]})}),(0,a.jsx)(i.aF,{isOpen:em,title:"Enable Tunnel",onClose:()=>ex(!1),children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsx)("div",{className:"bg-surface-2 border border-border-subtle rounded-lg p-4",children:(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-primary",children:"cloud_upload"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm text-text-main font-medium mb-1",children:"Cloudflare Tunnel"}),(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Expose your local ZevaiRouter to the internet. No port forwarding, no static IP needed. Share endpoint URL with your team or use it in Cursor, Cline, and other AI tools from anywhere."})]})]})}),(0,a.jsx)("div",{className:"grid grid-cols-2 gap-3",children:m.map(e=>(0,a.jsxs)("div",{className:"flex flex-col items-center text-center p-3 rounded-lg bg-sidebar/50",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-xl text-primary mb-1",children:e.icon}),(0,a.jsx)("p",{className:"text-xs font-semibold",children:e.title}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:e.desc})]},e.title))}),(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Requires outbound port 7844 (TCP/UDP). Connection may take 10-30s."}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(i.$n,{onClick:tm,fullWidth:!0,children:"Start Tunnel"}),(0,a.jsx)(i.$n,{onClick:()=>ex(!1),variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}),(0,a.jsx)(i.aF,{isOpen:eu,title:"Disable Tunnel",onClose:()=>!en&&eh(!1),children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"The Cloudflare tunnel will be disconnected. Remote access via tunnel URL will stop working."}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(i.$n,{onClick:tx,fullWidth:!0,disabled:en,variant:"danger",children:en?"Disabling...":"Disable"}),(0,a.jsx)(i.$n,{onClick:()=>eh(!1),variant:"ghost",fullWidth:!0,disabled:en,children:"Cancel"})]})]})}),(0,a.jsx)(i.aF,{isOpen:eq,title:"Tailscale Funnel",onClose:()=>{eO||(eK(!1),eL(""),eS(null))},children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[null===e$&&(0,a.jsxs)("p",{className:"text-sm text-text-muted flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin text-sm",children:"progress_activity"}),"Checking..."]}),!1===e$&&!eO&&(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Tailscale is not installed. Install it to enable Funnel."}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(i.$n,{onClick:th,fullWidth:!0,children:"Install Tailscale"}),(0,a.jsx)(i.$n,{onClick:()=>eK(!1),variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),eO&&(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm text-text-muted",children:[(0,a.jsx)("span",{className:"material-symbols-outlined animate-spin text-sm",children:"progress_activity"}),"Installing Tailscale..."]}),eI.length>0&&(0,a.jsx)("div",{ref:eM,className:"bg-black/5 dark:bg-white/5 rounded p-2 max-h-40 overflow-y-auto font-mono text-xs text-text-muted",children:eI.map((e,t)=>(0,a.jsx)("div",{children:e},t))})]}),!0===e$&&!eO&&(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm text-green-600 dark:text-green-400",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"check_circle"}),"Tailscale installed"]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(i.$n,{onClick:()=>tf(),fullWidth:!0,children:"Connect"}),(0,a.jsx)(i.$n,{onClick:()=>eK(!1),variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),eC&&(0,a.jsx)(f,{status:eC})]})}),(0,a.jsx)(i.aF,{isOpen:ez,title:"Disable Tailscale",onClose:()=>!ev&&eJ(!1),children:(0,a.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"Tailscale Funnel will be stopped. Remote access via Tailscale URL will stop working."}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(i.$n,{onClick:tj,fullWidth:!0,disabled:ev,variant:"danger",children:ev?"Disabling...":"Disable"}),(0,a.jsx)(i.$n,{onClick:()=>eJ(!1),variant:"ghost",fullWidth:!0,disabled:ev,children:"Cancel"})]})]})}),(0,a.jsx)(i.uo,{isOpen:!!T,onClose:()=>E(null),onConfirm:T?.onConfirm,title:T?.title||"Confirm",message:T?.message,variant:"danger"})]})}function y({label:e,url:t,copyId:s,copied:l,onCopy:n,badge:r,actions:o}){return(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:`text-xs font-mono px-1.5 py-0.5 rounded shrink-0 min-w-[88px] text-center ${"CF"===r||"TS"===r?"bg-primary/10 text-primary":"bg-surface-2 text-text-muted"}`,children:e}),(0,a.jsx)(i.pd,{value:t,readOnly:!0,className:"flex-1 font-mono text-sm"}),(0,a.jsx)("button",{onClick:()=>n(t,s),className:"p-2 hover:bg-black/5 dark:hover:bg-white/5 rounded text-text-muted hover:text-primary transition-colors shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:l===s?"check":"content_copy"})}),o]})}function f({status:e,className:t=""}){return(0,a.jsx)("div",{className:`p-2 rounded text-sm ${t} ${"success"===e.type?"bg-green-500/10 text-green-600 dark:text-green-400":"warning"===e.type?"bg-yellow-500/10 text-yellow-600 dark:text-yellow-400":"info"===e.type?"bg-blue-500/10 text-blue-600 dark:text-blue-400":"bg-red-500/10 text-red-600 dark:text-red-400"}`,children:e.message.split(/(https?:\/\/[^\s]+)/g).map((e,t)=>/^https?:\/\//.test(e)?(0,a.jsx)("a",{href:e,target:"_blank",rel:"noreferrer",className:"underline font-medium",children:e},t):e)})}function g({text:e}){return(0,a.jsxs)("span",{className:"relative group inline-flex items-center",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px] text-text-muted cursor-help",children:"help"}),(0,a.jsx)("span",{className:"pointer-events-none absolute left-5 top-1/2 -translate-y-1/2 z-50 w-64 rounded bg-gray-900 dark:bg-gray-800 text-white text-xs px-2.5 py-1.5 opacity-0 group-hover:opacity-100 transition-opacity shadow-lg",children:e})]})}function j({message:e,action:t}){return(0,a.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-amber-500/10 border border-amber-500/20 text-amber-700 dark:text-amber-400",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px] shrink-0 mt-0.5",children:"warning"}),(0,a.jsx)("p",{className:"text-xs flex-1",children:e}),t&&(0,a.jsx)("a",{href:t.href,className:"text-xs font-medium underline shrink-0 hover:opacity-80",onClick:t.href.startsWith("#")?e=>{e.preventDefault(),document.getElementById(t.href.slice(1))?.scrollIntoView({behavior:"smooth"})}:void 0,children:t.label})]})}b.propTypes={machineId:r().string.isRequired}}}]);
|
|
File without changes
|
|
File without changes
|