mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-24 17:32:18 +00:00
fb9400a5fbe4f3579dbb3cfd65d3de8a147dd987
4
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
ea5320d94a |
Fix #954: unify Tooltip styling + replace native selects (#961)
* Fix #954: unify Tooltip styling + replace native selects Replace native HTML title= tooltips and native <select> dropdowns with the existing Radix-based Tooltip / Select components so they share the app's rounded styling, theme tokens and i18n pipeline. Adds a global TooltipProvider in AppWithProviders so every descendant Tooltip works without a per-file Provider wrapper. Scope (driven by the issue #954 examples and "全部都处理" follow-up): - TerminalLayer toolbar: Add Terminal / Split View / SFTP / Scripts / Theme / AI Chat / Move panel / Close panel. - TopTabs middle bar: quick switcher, more tabs, AI assistant, theme toggle, settings; window-control buttons (min/max/close), tray close and hotkey reset/disable have their native title dropped per the user's explicit opt-out ("可以不用Tooltip,直接全局禁用 原生title 属性"). - AI panels: AIChatSidePanel session history / new chat / delete, ConversationExport, AgentSelector, ChatInput attach / expand / permission, ModelSelector, ProviderCard, ai-elements/tool-call. - SFTP: SftpSidePanel header, SftpBreadcrumb, SftpFileRow, SftpPaneToolbar, SftpTabBar, SftpTransferQueue. - Settings: SettingsPage close, SettingsAppearanceTab theme/accent swatches, SettingsFileAssociationsTab edit/remove, SettingsSystemTab crash-log paths and global hotkey reset. - Host vault: HostDetailsPanel (clear / suggestions / show-password / key path / browse key), GroupDetailsPanel, KnownHostsManager, ConnectionLogsManager, KeychainManager, SyncStatusButton, CloudSyncSettings, LogView, QuickSwitcher, ScriptsSidePanel, Terminal status bar copy-host + broadcast/focus, ZmodemProgressIndicator. - Terminal subcomponents: HostKeywordHighlightPopover, TerminalComposeBar, TerminalConnectionDialog, TerminalSearchBar. - Editor: TextEditorPane (subtitle, search, wrap, promote-to-tab). - TrayPanel session rows and port-forwarding rows. Native <select> migrated to custom Select component: - SerialConnectModal (data bits, stop bits, parity, flow control) - SerialHostDetailsPanel (same four fields) - HostDetailsPanel backspace behavior - GroupDetailsPanel backspace behavior - SettingsTerminalTab local shell picker - terminal/ThemeSidePanel font weight Hardcoded English strings extracted to i18n. New keys for both en and zh-CN: terminal.layer.*, topTabs.*, ai.chat.* (sessionHistory, attach, collapse, expand, enableAgent), zmodem.*, settings.shortcuts. resetToDefault. Inline help text on SnippetsManager package-name input removed because the same hint is already shown in a visible <p> below the input. Existing per-file <TooltipProvider> wrappers (SnippetsManager, ScriptsSidePanel, SelectHostPanel, RuleCard, HostDetailsPanel proxy section) are left in place — they nest harmlessly under the global provider and stay self-sufficient for component tests. Tests: - tsc clean for changed files (pre-existing repo-wide errors unrelated to this PR). - All 802 tests pass (3 skipped pre-existing). - HostDetailsPanel.proxyProfile.test and TextEditorPane.test updated to wrap with TooltipProvider, matching the runtime context now needed by the migrated components. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Fix #954: wrap Settings + Tray windows with TooltipProvider Settings and the tray panel mount as separate Electron windows with their own React root in index.tsx, so they do not inherit the global TooltipProvider added under AppWithProviders. After the unified Tooltip migration, any settings tab that used a Tooltip (Appearance, Application, FileAssociations, System, Shortcuts, Terminal, AI ProviderCard, AI ModelSelector) — and TrayPanel — threw "Tooltip must be used within TooltipProvider" and rendered nothing. Wrap both branches with TooltipProvider at the same level as ToastProvider in index.tsx. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|
|
835a1231a6 |
feat: add skip TLS verification option for self-hosted AI providers (#369)
* feat: add skip TLS verification option for AI providers
Self-hosted AI endpoints (vLLM, text-generation-webui, etc.) often use
self-signed TLS certificates which Node.js rejects by default, causing
502 Bad Gateway errors. Add a per-provider "Skip TLS certificate
verification" checkbox that sets rejectUnauthorized=false on both
streaming and non-streaming requests.
Ref #294
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: surface real error message instead of generic 502 Bad Gateway
- Pass the actual bridge error message in statusText so Vercel AI SDK
shows the real cause (e.g. "HTTP is only allowed for localhost",
"URL host is not in the allowed list", TLS errors)
- Show real error details for 5xx provider errors instead of generic
"The AI provider returned a server error" message
Previously all connection-level errors were masked as "Bad Gateway"
making it impossible for users to diagnose configuration issues.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: pass server error body details through to the user
- Read HTTP error response body before resolving (was resolving before
body was read, losing the error detail)
- Parse OpenAI-compatible JSON error format to extract error.message
- Return error Response with body+statusText for non-2xx instead of
empty stream, so Vercel AI SDK shows the real server error
- Now users see e.g. "502 model not loaded" instead of just "Bad Gateway"
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: widen link modifier key dropdown to prevent text wrapping
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Revert "fix: widen link modifier key dropdown to prevent text wrapping"
This reverts commit
|
||
|
|
b3d5785477 |
fix: allow settings window as trusted IPC sender (#354)
* fix: allow settings window as trusted IPC sender The settings window runs in a separate BrowserWindow with its own webContents id. validateSender() only checked the main window id, causing "Unauthorized IPC sender" errors when fetching AI model lists from the settings page. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: add validateSender to all remaining AI IPC handlers 15 handlers in aiBridge were missing sender validation, allowing potential unauthorized IPC calls. Now every netcatty:ai:* handler consistently validates the sender against trusted windows. Affected handlers: chat:cancel, agents:discover, resolve-cli, codex:get-integration, codex:start-login, codex:get-login-session, codex:cancel-login, codex:logout, mcp:update-sessions, mcp:set-command-blocklist, mcp:set-command-timeout, mcp:set-max-iterations, mcp:set-permission-mode, acp:cancel, acp:cleanup. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: scope settings window trust to config-only IPC handlers Per code review feedback: the previous commit allowed the settings window to access ALL AI IPC handlers including high-risk ones like exec, terminal:write, and agent:spawn. Split into two validators: - validateSender(): main window only (exec, terminal, agent, stream) - validateSenderOrSettings(): main + settings (fetch, sync, codex login, MCP config, agent discovery) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: refresh main window id on recreation and allow settings fetch Two fixes from code review: 1. Always resolve mainWebContentsId from windowManager instead of caching it once, so a recreated main window is recognized. 2. Skip static host allowlist for settings window ai:fetch calls, since the settings UI lets users configure custom provider URLs that haven't been synced to providerFetchHosts yet. Basic URL safety (HTTPS-only, no file:// schemes) is still enforced. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: enforce HTTPS/port safety for settings window fetch requests Per review: previous commit skipped isAllowedFetchUrl entirely for settings window, which removed SSRF protection. Now settings window fetches still bypass the static host allowlist (since the user is configuring new providers) but enforce the same safety rules: - Remote hosts must use HTTPS - Localhost must use known ports Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: sync provider config before fetching models in settings Instead of bypassing the URL allowlist for settings window fetches (which weakens SSRF protection), have ModelSelector sync the current provider's baseURL to the backend allowlist before fetching models. This keeps the full URL safety checks intact while allowing settings to test custom provider endpoints. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: use dedicated allowlist handler instead of syncing providers Replace the approach of calling aiSyncProviders (which overwrites the shared providerConfigs) with a new lightweight IPC handler netcatty:ai:allowlist:add-host that only adds a host to the fetch allowlist without affecting provider configs or API key resolution. This preserves the SSRF protection while allowing settings to test custom provider URLs that haven't been synced from the main window. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: auto-expire temporary allowlist entries after 30 seconds Temporary hosts added via allowlist:add-host now auto-remove after 30s to prevent permanently expanding the SSRF boundary. Built-in ports and hosts re-added by provider sync are preserved. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: prevent temp allowlist cleanup from removing synced providers The setTimeout cleanup now checks whether the host/port belongs to a currently synced provider config before removing it. This prevents the scenario where a user saves a provider within the 30s TTL window and then loses access when the timer fires. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: preserve temp allowlist entries across provider sync rebuilds rebuildProviderFetchHosts() clears and rebuilds the allowlist from providerConfigs, which would wipe temporary entries added by allowlist:add-host. Now re-adds active temp entries after rebuild to prevent race conditions between settings model listing and provider sync from the main window. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
a55da77471 |
refactor: fix security issues, remove dead code, and split monolithic files
Security: - Fix command injection in 15+ shell interpolation sites with shellQuote() - Add token-based authentication to MCP TCP server - Fix heredoc delimiter collision in SFTP write fallbacks - Add case-insensitive flag to mcpServerBridge command blocklist - Add exhaustive default case to createModelFromConfig Architecture: - Split aiBridge.cjs (1971→1483 lines) into 4 modules: shellUtils, codexHelpers, claudeHelpers, ptyExec - Split SettingsAITab.tsx (1480→520 lines) into 10 sub-components - Extract shared processCattyStream from AIChatSidePanel.tsx (-168 lines) - Consolidate duplicate PTY execution logic into shared ptyExec.cjs - Consolidate duplicate stripAnsi/toUnpackedAsarPath utilities Code quality: - Remove ~33 debug console.log statements from production code - Remove dead code: terminal_read_output stub, checkToolPermission, isCommandAllowed, READ_ONLY_TOOLS - Unify bridge type accessor in useAIState.ts (eliminate 15 unsafe casts) - Add localStorage session pruning (50 sessions / 200 messages cap) - Fix ModelSelector onBlur race condition (setTimeout → preventDefault) - Fix duplicate getShellEnv() calls in Codex helpers - Remove unused _config param from claudeAgentAdapter - Type claudeAgentAdapter bridge parameter directly as ClaudeBridge Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |