mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-23 16:42:19 +00:00
285fcd55a94de9034ace3d921e204505fab8def0
24
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
1fec5925eb | Refactor large modules and fix runtime errors (#1136) | ||
|
|
fb97e242ee |
feat: add SFTP upload conflict handling (#874)
* feat: add SFTP upload conflict handling Add conflict resolution for SFTP uploads so files and folders can be stopped, skipped, replaced, duplicated, or merged depending on the target state. Support batch uploads with Apply to All behavior, route external upload conflicts through the shared SFTP conflict dialog, and add the bridge operations needed to stat and delete existing upload targets. * fix review issue * Fix SFTP conflict cancellation cleanup --------- Co-authored-by: yuzifu <yuzifu@TB16PGen5.Info> Co-authored-by: bincxz <16399091+binaricat@users.noreply.github.com> |
||
|
|
4dd7640452 |
fix: allow auto encoding through same-host fast path
The encoding guard was rejecting "auto" which is the default encoding for nearly all connections, making same-host optimization never trigger. Frontend now allows "auto" through. Backend resolves "auto" to the actual session encoding via resolveEncodingForRequest and only proceeds with exec cp when the resolved encoding is UTF-8. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
0b08521e63 |
perf: optimize same-host SFTP transfer with remote cp command (#564)
* perf: optimize same-host SFTP transfer with remote cp command When both panels are connected to the same remote host, use SSH exec `cp -a` instead of downloading to local temp then re-uploading. This eliminates 2x bandwidth usage and reduces latency for same-host transfers. Closes #561 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * perf: optimize same-host directory transfer with single cp -ra command For same-host directory transfers, use a single `cp -ra` command via SSH exec instead of recursively walking the directory and copying files one by one. This makes directory copies nearly instant on the remote server. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: use endpoint cache key for same-host detection and guard non-UTF-8 paths Address two code review issues: 1. Compare per-connection cache keys (hostname+port+protocol+sudo+username) instead of just hostId for same-host detection. This prevents false positives when the same hostId has different session-time overrides. 2. Restrict exec-based cp paths to UTF-8 compatible encodings only. Non-UTF-8 encodings (e.g. gb18030) need encodePathForSession which shell exec cannot use — fall back to download+upload for those cases. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: directory cp semantics, cancellation, and auto encoding guard 1. Use `cp -ra source/. target/` instead of `cp -ra source target` to copy directory contents into target, preserving merge semantics when the target directory already exists (avoids extra nesting level). 2. Check cancellation state before and after sameHostCopyDirectory call so cancelled transfers don't finalize as completed. 3. Exclude 'auto' from exec-safe encodings since auto can resolve to non-UTF-8 (e.g. gb18030) at the session level. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: wire cancellation into same-host copy paths 1. Single file cp -a: check transfer.cancelled before and after execSshCommand so cancelled transfers don't proceed as success. 2. Directory cp -ra: accept transferId, register in activeTransfers so cancelTransfer can flag it, and check cancelled state at each async boundary. Cleanup via finally block. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: abort remote cp process on transfer cancellation Add execSshCommandCancellable() that wires the SSH exec stream into transfer.abort, so cancelTransfer can close the stream and kill the remote cp process immediately instead of waiting for it to finish. Used in both single-file (cp -a) and directory (cp -ra) same-host paths. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: close exec stream immediately if cancelled before callback fires Check transfer.cancelled at the start of the exec callback and close the stream right away, preventing the remote cp from running when cancellation happened between the exec() call and callback delivery. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: fallback to download+upload when remote cp is unavailable On non-POSIX remotes (e.g. Windows SSH servers) where cp is absent, same-host optimization now gracefully falls back to the existing download+upload transfer path instead of failing the transfer. - Single file: try cp -a first, fall back to temp file on non-zero exit - Directory: sameHostCopyDirectory returns { success: false } instead of throwing, frontend falls back to recursive transferDirectory Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * perf: cache cp unavailability to avoid repeated exec failures Track sftpIds where remote cp failed in cpUnavailableSet so subsequent file transfers in the same session skip the exec attempt and go directly to download+upload, avoiding per-file exec round-trip overhead on non-POSIX remotes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: skip transferFile for directories already handled by same-host copy Add !task.isDirectory guard to the else branch so successful sameHostCopyDirectory doesn't also trigger a redundant transferFile call that would duplicate data. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: dereference symlinks in same-host copy to match SFTP behavior Use cp -aL instead of cp -a so symlinks are dereferenced (copied as file contents), matching the existing SFTP download+upload flow which always transfers resolved file data. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * revert: remove -L flag from same-host cp to avoid recursing symlinked dirs Revert cp -aL back to cp -a. The -L flag dereferences all symlinks including symlinked directories, which can unexpectedly recurse into large unrelated directory trees. Using cp -a preserves symlinks as-is, which is safer and consistent with how the transfer UI treats symlink directories as non-recursive entries. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: refine cp unavailability caching and remove dead import 1. Only cache sftpId in cpUnavailableSet on exit code 127 (command not found). Other failures (permission denied, disk full) are transient or path-specific and should not disable cp for the entire session. 2. Check cpUnavailableSet at the top of sameHostCopyDirectory to skip exec attempt on known non-POSIX remotes. Also cache 127 exits from directory copies. 3. Remove unused execSshCommand import from transferBridge (replaced by local execSshCommandCancellable) and revert its export from sftpBridge. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
9397a781b5 |
refactor: unify directory download with upload transfer system (#560)
* refactor: unify directory download with upload transfer system Directory downloads previously used a completely separate implementation with custom queue management, progress tracking, and concurrency control (~390 lines in useSftpViewFileOps.ts). This caused the download UI to show only a single aggregate task without child file details, unlike uploads which showed parent + child tasks. Replace the custom download implementation with a new downloadToLocal() method in useSftpTransfers that reuses the existing transferDirectory/ transferFile infrastructure. Downloads now: - Show parent task with child file tasks (same as uploads) - Use the configurable transfer concurrency setting - Support cancellation through the same mechanism - Share progress tracking and conflict detection code Net reduction of ~260 lines. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: remove dead code from directory download refactor Remove listSftp, mkdirLocal, and RemoteFile imports that were only used by the old custom directory download implementation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: handle symlink directories in transfers and remove dead code - Use isNavigableDirectory() instead of type === "directory" in transferDirectory so symlinks pointing to directories are recursed into correctly (fixes both upload and download paths) - Remove unused deleteLocalFile prop from useSftpViewFileOps Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: use connection ID for download tasks and cancel child streams - Use pane connection ID (not SFTP session ID) as sourceConnectionId so download tasks are properly associated with the host and visible in filtered transfer views - Cancel all active child transfer streams at the backend when parent is cancelled, not just the parent ID — stops data transfer immediately Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: add symlink cycle detection and propagate child failures - Add visitedPaths Set to transferDirectory to detect and skip symlink directory cycles that would cause infinite recursion - Check for failed child tasks after transferDirectory completes and mark parent as failed instead of falsely reporting success Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: use depth limit for symlink loops and handle EEXIST on mkdir - Replace visited-paths cycle detection with a depth limit (64), which reliably catches symlink loops that generate new path strings each hop (e.g. /dir/link/link/link...) - Handle EEXIST errors in mkdirLocal gracefully so re-downloading to an existing directory doesn't abort the entire transfer Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: throw on depth limit exceeded and mark downloads non-retryable - Depth limit now throws instead of silently returning, so exceeding it surfaces as a failed transfer rather than an incomplete success - Set retryable: false on downloadToLocal tasks since retryTransfer cannot resolve the synthetic "local" connection ID Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: track symlink depth only and verify EEXIST target is directory - Change depth guard to only count symlink directory hops, not total directory depth, so legitimate deep trees are not rejected - After catching EEXIST on mkdirLocal, stat the path to verify it is actually a directory — throw if a regular file exists at that path Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: remove dead props from callbacks and surface download failures - Remove mkdirLocal and deleteLocalFile from useSftpViewPaneCallbacks interface and passthrough (fixes TS2353 build error) - Show error toast when downloadToLocal returns "failed" status, not just when it throws Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: track child transfer IDs outside React state for reliable cancel Child transfer IDs were only discoverable via transfersRef.current, which lags behind setTransfers due to React batching. This caused two race conditions: 1. Cancellation: child streams started between setTransfers and render were not cancelled at the backend, continuing to write data. 2. Failure detection: hasFailedChildren checked transfersRef which might not reflect recently-failed children, marking partial downloads as successful. Fix: track active child IDs in activeChildIdsRef (a mutable Map outside React state) for immediate visibility during cancellation. Check child failure status inside setTransfers functional updater where the latest state is guaranteed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: preserve actual progress on partial failure and count symlink dirs - Don't force transferredBytes to totalBytes when some children failed, so the progress bar accurately reflects the partial completion - Use isNavigableDirectory in countDirectoryFiles and estimateDirectoryBytes so symlink directories are included in size/count estimates Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: symlink count, progress on fast downloads, and child cancellation 1. countDirectoryFiles: use isNavigableDirectory so symlink dirs are recursed into, keeping totals consistent with transferDirectory 2. Final status: compute actual completedCount from children instead of relying on totalBytes which may be 0 if the background scan hasn't finished yet 3. Catch block: detect cancellation from error message (not just cancelledTasksRef) so child-initiated cancels don't show as errors Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: add symlink depth guard to countDirectoryFiles and estimateDirectoryBytes Both helper functions now track symlink depth and stop recursing when MAX_SYMLINK_DEPTH is exceeded, consistent with transferDirectory. Prevents infinite recursion on symlink directory cycles during the background file count/size scan. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: reliable final status and non-retryable child tasks 1. transferDirectory now returns the count of failed child transfers, tracked outside React state. downloadToLocal uses this count directly instead of reading from setTransfers updater (which may be deferred by React batching), ensuring the correct status is returned to the caller for toast messages. 2. Child tasks explicitly inherit retryable from the parent task. For downloadToLocal (retryable: false), this prevents showing retry actions on failed children whose "local" targetConnectionId cannot be resolved by retryTransfer. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: add ancestor path cycle detection for symlink directories The depth-only guard allowed up to 32 pointless traversals before stopping a symlink cycle (e.g. dir/link -> .). Add an ancestorPaths Set that tracks the current recursion stack — if a directory's source path is already in the set, it's an immediate cycle and is skipped with zero wasted traversals. The depth limit remains as a hard backstop. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: don't recurse into symlink directories during transfers Revert to only recursing into real directories (type === "directory") in transferDirectory, countDirectoryFiles, and estimateDirectoryBytes. Symlink directories are now transferred as regular entries instead of being followed, eliminating all symlink cycle risks without needing complex cycle detection that can't reliably work with unresolved remote paths. Also clean up activeChildIdsRef in processTransfer (both success and error paths) to prevent memory leaks from pane-to-pane directory transfers. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: filter "." entries and recurse into symlink dirs with depth guard 1. Filter both "." and ".." in all recursive functions — some SFTP servers include "." in readdir, causing infinite self-recursion. 2. Restore symlink directory recursion in transferDirectory with a symlinkDepth counter (max 32). Symlink dirs that exceed the limit are excluded from the dirs list (treated as files). This is needed because startStreamTransfer cannot transfer a directory as a file, so skipping symlink dirs caused child transfer failures. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: add symlink depth guard to count/estimate helpers countDirectoryFiles and estimateDirectoryBytes now track symlinkDepth consistently with transferDirectory, preventing infinite recursion on symlink cycles in the background file count/size estimation. Also fixes: - Remove fragile string-based cancellation detection in downloadToLocal - Clean up cancelledTasksRef in downloadToLocal catch block - Move MAX_SYMLINK_DEPTH before its first use Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: use path reconstruction instead of string replace for duplicate conflicts resolveConflict's "duplicate" action used String.replace to swap the filename in the target path, but this replaces the first occurrence which can corrupt the path if the filename also appears in a parent directory name. Use joinPath(getParentPath(...), newName) instead. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: skip over-depth symlink directories instead of treating as files When symlinkDepth exceeds MAX_SYMLINK_DEPTH, symlink directories were falling through to regularFiles and being passed to transferFile, which cannot transfer directories and would produce confusing errors. Now they are skipped entirely with a warning log. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: count skipped symlinks as errors and process subdirs concurrently 1. Symlink directories skipped at MAX_SYMLINK_DEPTH now increment totalErrors so the parent task is marked failed instead of silently reporting success with incomplete content. 2. Sibling subdirectories are now processed with Promise.all instead of sequential await, restoring cross-directory concurrency that the old download implementation had. Files within each directory still use the configurable worker pool concurrency. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: sequential subdirs to prevent SFTP overload and check dir errors in processTransfer 1. Revert subdirectory processing to sequential (for...of await) to prevent unbounded concurrent SFTP requests from nested Promise.all + worker pools across the directory tree. File-level concurrency within each directory is still governed by getTransferConcurrency(). 2. processTransfer now captures transferDirectory's error count return value and marks the parent task as "failed" when child transfers fail, instead of unconditionally marking "completed". Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * refactor: remove redundant completed state update for directory transfers Directory success path no longer writes "completed" in both the directory-specific block and the generic block. The directory-specific block now only handles the failure case with early return; success falls through to the generic completed block. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: route partial directory failures through shared completion path The early return for directory transfer failures skipped cache invalidation, target pane refresh, and onTransferComplete callbacks (needed by cut/paste to clear clipboard). Now partial failures flow through the same cleanup path as successes — cache is cleared, target is refreshed, and completionHandler is called with the correct "failed" status. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: restrict symlink directory recursion to downloadToLocal only Add followSymlinks parameter (default false) to transferDirectory, countDirectoryFiles, and estimateDirectoryBytes. Only downloadToLocal passes true — uploads and pane-to-pane copies retain their original behavior of treating symlink directories as regular entries. This prevents existing upload/copy flows from expanding symlinked directory trees (which could duplicate content or trigger cycles), while still allowing local downloads to recursively copy through symlink directories with depth protection. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: disable retry for partial dir failures and fix symlink file count 1. Mark partially failed directory transfers as retryable: false to prevent retry from replaying the entire directory without conflict checks, which would silently overwrite already-copied files. 2. In countDirectoryFiles and estimateDirectoryBytes, skip over-depth symlink directories entirely instead of counting them as files. This makes the totals consistent with transferDirectory which also skips these entries, preventing impossible progress like "10/11". Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
255a4730e7 |
feat: make SFTP folder transfer concurrency configurable (#558)
* feat: make SFTP folder transfer concurrency configurable The number of files transferred in parallel during folder uploads/ downloads was hardcoded to 4. Add a setting (1-16, default 4) in Settings > SFTP so users can tune it for their server and network. The value is read from localStorage at transfer start time, so changes take effect on the next folder transfer without restart. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: sync transfer concurrency setting across windows Add notifySettingsChanged broadcast, IPC onSettingsChanged handler, and storage event listener for the transfer concurrency setting so changes propagate to all open windows immediately. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: move setSftpTransferConcurrency after notifySettingsChanged The useCallback referenced notifySettingsChanged before it was defined (const is not hoisted), causing a ReferenceError on mount. Move the definition after notifySettingsChanged. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
e3b882bdf9 |
feat(sftp): add tree view explorer for SFTP pane (#547)
* feat(sftp): add onListDirectory to SftpPaneCallbacks interface Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> * feat(sftp): implement onListDirectory in left and right callbacks * feat(sftp): add tree view i18n keys * feat(sftp): add list/tree view mode toggle to toolbar * feat(sftp): add viewMode state and tree view conditional rendering to SftpPaneView * feat(sftp): implement SftpPaneTreeView with lazy loading and context menu Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> * fix(sftp): resolve lint errors in tree view implementation Rename inner `t` and `ts` variables in onListDirectory callbacks to `toSize`/`toTs`/`ms` to avoid shadowing the outer `t` translation param. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> * fix(sftp): resolve post-merge lint errors - Remove duplicate sftp.context.copyPath i18n key (upstream added it too) - Remove unused AlertCircle import from SftpPaneFileList (upstream removed usage) Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> * perf(sftp): optimize SftpPaneTreeView render pipeline Split useMemo into two stages so selection changes no longer rebuild the full node descriptor array. Extract stable selection-aware callbacks (drag, copy, delete) via refs so TreeNode React.memo can reliably bail out. Remove unused props (onNavigateTo, draggedFiles), move NodeDescriptor type to module scope, and fix selectedFiles undefined bug in context menu. * feat(sftp): add path-aware rename and delete for tree view Wire renameFileAtPath and deleteFilesAtPath through the full callback stack so tree view context menu actions operate on full paths instead of basenames. Update useSftpPaneDialogs to accept entryPath in openRenameDialog and resolve parent dir in handleDelete, keeping list view behaviour unchanged. * fix: harden SFTP tree view actions and selection * fix: support tree selection shortcuts and nested create targets * fix: keep SFTP tree view sorting in sync * Improve SFTP tree view interactions and refresh behavior * Optimize SFTP tree refresh and pane state usage * Reduce remaining SFTP tree performance overhead * Fix nested SFTP drop target routing * Restore keyboard access to parent tree entry * Revert "Display approved AI commands in terminal sessions before their output. (#546)" This reverts commit |
||
|
|
55ee08315a |
fix: remove unused useEffect import
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
f5b745ec63 |
fix: resolve SFTP tab connection key race in workspace mode (#443)
* fix: resolve SFTP tab connection key race condition in workspace mode When rapidly switching focus between workspace panes, the single pendingConnectionKeyRef could be overwritten before the tracking effect mapped it to the created tab. This left tabs unmapped in tabConnectionKeyMapRef, causing duplicate tabs on subsequent switches. Replace the two-step async mechanism (pendingConnectionKeyRef + deferred tracking effect) with a synchronous onTabCreated callback on connect(). The callback fires immediately after the tab ID is determined, before any async SSH work begins, eliminating the race window entirely. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: scope SFTP transfers to active connection and prevent stale session lookups Two fixes for workspace focus-switching issues: 1. Transfer queue now filters by the active connection's host, so switching focus between workspace panes only shows transfers relevant to the currently displayed SFTP tab. 2. Move sftpSessionsRef.delete() before the async closeSftp() call to close the race window where concurrent code could look up a stale sftpId that the backend has already removed, causing "SFTP session not found" errors. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: allow SFTP focus switching during file transfers Active transfers should not block workspace focus-following. Transfers run on their own sftpId independent of the active tab, and forceNewTab preserves old connections, so switching focus is safe. Only interactive operations (text editor, permissions dialog, file opener, file watches) still block host switching. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: refresh correct SFTP tab after transfer completes during focus switch When a transfer completes while focus has switched to a different host, refresh was targeting the currently active pane instead of the pane that initiated the transfer. Add optional tabId parameter to navigateTo() and refresh() so callers can target a specific tab. Capture the tab ID at transfer start and use it for the post-transfer refresh, ensuring the correct tab's file list is updated regardless of which tab is currently focused. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: auto-reconnect SFTP when session is lost during navigation When navigateTo() detected a missing or expired SFTP session, it cleared the connection to null, showing the empty "Select a host" state. Now it delegates to handleSessionError(), which triggers the existing reconnection mechanism — keeping files visible while reconnecting in the background. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * perf: eliminate redundant stat calls before file transfers Before this change, each file transfer performed 3-4 stat calls over the network before the progress bar started moving: 1. startTransfer: stat to get file size (~100ms) 2. processTransfer: stat again if size was 0 (~100ms) 3. Conflict check: stat source file for mtime (~100ms) 4. Backend: stat again if totalBytes missing (~100ms) Now: - Use the source pane's cached file list for size and mtime (zero network cost) instead of stat calls in startTransfer - Store sourceLastModified on TransferTask so the conflict check can use it directly instead of a redundant source stat - Backend already skips stat when totalBytes is provided This saves ~200-300ms of network round-trips per file before the progress bar starts moving. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * perf: show immediate progress feedback during transfer setup The progress bar previously stayed at 0% for ~500ms-1s while the backend acquired an isolated SFTP channel and waited for the first data chunk. Users perceived this as the transfer being "sluggish". Now start simulated progress immediately for all single-file transfers (not just non-streaming ones). When the first real progress update arrives from the backend, the simulation is stopped and real progress takes over seamlessly. This gives instant visual feedback that the transfer is in progress. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: show accurate transfer progress instead of simulated values The progress system had fundamental issues: 1. Simulated progress ran for ALL transfers including streaming ones, creating fake progress that could reach 95% while real progress was at 60%. The Math.max ratchet prevented regression, so users saw inflated numbers. 2. Speed and remaining time were based on simulated data during the setup phase, giving misleading estimates. Changes: - Only use simulated progress for non-streaming transfers (no real progress callback available). Streaming transfers get real data. - Remove the double ratchet (Math.max) from onProgress — the backend already enforces monotonic progress, so the frontend should trust the reported values directly. - Show an indeterminate "preparing..." state during the setup phase (channel acquisition, conflict check) instead of fake progress. This honestly communicates that the transfer is starting. - Hide speed and remaining time during the indeterminate phase since no real data is available yet. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * refactor: remove dead progress simulation and non-streaming transfer code startStreamTransfer is always available in Electron, so: - Remove the non-streaming fallback path in transferFile() that read entire files into memory with no progress reporting - Remove startProgressSimulation / stopProgressSimulation and all related refs (progressIntervalsRef, useSimulatedProgress, hasStreamingTransfer) - Remove the cleanup effect for progress intervals All transfers now use the streaming path with real backend-reported progress. The indeterminate "preparing..." state covers the setup phase until the first real progress arrives. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * perf: reduce SFTP transfer concurrency from 64 to 4 64 parallel SFTP read/write requests overwhelmed servers, causing the first chunk response to be delayed by 46+ seconds. Reducing to 4 concurrent requests provides a responsive first progress update (~1-2s) while still offering significant speedup over sequential streaming. Also adds timing logs to the transfer pipeline (processTransfer, transferFile, downloadFile, uploadFile) to aid future diagnostics. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address review findings from PR #443 Critical fixes: - Fix refresh/navigateTo type signatures to include the tabId option parameter — previously it was silently ignored, making tab-targeted refresh non-functional - Fix handleSessionError/reconnection in navigateTo for background tabs: when called with explicit tabId, update that specific tab instead of the active tab (which could be a different host) - Fix uploadExternalFiles to capture and pass tabId for post-upload refresh (was missing, only uploadExternalEntries was fixed) Medium fixes: - Restore Math.max monotonic ratchet on single-file onProgress to guard against any non-monotonic backend values - Add stat fallback in processTransfer to populate sourceLastModified when file is not in the pane's visible file list (filtered/search) - Adjust TRANSFER_CONCURRENCY from 4 to 8 as a better throughput/ responsiveness balance Cleanup: - Remove all debug timing logs (console.log with Transfer/downloadFile/ uploadFile prefixes) from both frontend and backend Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: prevent background tab navigation from rolling back active tab Two P1 fixes from automated review: 1. navSeqRef race: navigateTo uses a per-side sequence counter, so a background tab refresh would bump it and cause the active tab's concurrent navigation to think it was superseded, restoring previousPath instead of applying the fetched files. Now when navSeqRef is superseded but tabNavSeqRef still matches, the fetched result is applied (it's valid for this tab — only a different tab bumped the counter). 2. Auto-follow tear down: needsNewTab only checked hostId, so same host with different session-time overrides (port/protocol) would reuse the tab and close the old SFTP session, aborting any in-flight transfer. Now needsNewTab is true whenever the current connection is alive, always preserving it with forceNewTab. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
f3676734a7 |
feat(sftp): show download progress for "Open With" temp file downloads (#283)
* feat(sftp): show download progress for "Open With" temp file downloads When opening remote files via "Open With" or double-click, the download to a temp directory now displays real-time progress (bar, speed, ETA) in the transfer overlay instead of silently blocking until completion. Reuses the existing transferBridge infrastructure (fastGet with throttled IPC progress events) and the SftpTransferItem UI. Cancellation is handled gracefully — the task transitions to "cancelled" status, the partial temp file is cleaned up, and the file is not opened in the external application. The original downloadSftpToTemp path is preserved as a fallback for contexts without a transfer queue. * fix(sftp): harden temp download transfer state --------- Co-authored-by: midasgao <midasgao@distinctclinic.com> Co-authored-by: bincxz <16399091+binaricat@users.noreply.github.com> |
||
|
|
35f531bb55 |
Fix SFTP folder copy into symlinked directories (#282)
* Fix SFTP directory copy into symlinked folders * Honor SFTP directory drop targets * Limit SFTP drop targeting to symlink directories * Bind SFTP drops to the visible target pane * Revert "Bind SFTP drops to the visible target pane" This reverts commit |
||
|
|
5d75f1acd4 |
fix: resolve multiple SFTP bugs (#254)
- Fix new folder input not resetting after deletion (SftpPaneToolbar/View) - Fix folder download stuck at 95% by replacing simulated progress with real child-file progress tracking (useSftpTransfers) - Add download menu item for directories in SFTP modal context menu (SftpModalFileList) - Implement recursive folder download in SFTP modal with real-time progress (useSftpModalTransfers, SFTPModal) - Fix mkdirLocal EEXIST error when target path is an existing file (localFsBridge) - Close settings window when main window is minimized to tray (windowManager) Closes #254 |
||
|
|
b58120998f |
fix: improve SFTP transfer speed with parallel requests and accurate progress (#226) (#231)
- Replace sequential stream piping with ssh2 fastPut/fastGet (64 concurrent SFTP requests) - Use 512KB chunk size instead of default 32KB for better throughput - Fix speed calculation with sliding window to prevent inflated burst speeds - Throttle progress IPC to 100ms intervals to reduce event loop contention - Simplify frontend speed display by removing ref-based smoothing layer - Update memo comparison for smoother progress bar re-renders |
||
|
|
f517c85d07 |
feat: Add SFTP keyboard shortcuts for copy, paste, cut, select all, rename, delete (#180)
* Initial plan * feat: Add SFTP keyboard shortcuts support for copy, paste, cut, select all, rename, delete, refresh, and new folder operations Co-authored-by: binaricat <16399091+binaricat@users.noreply.github.com> * feat: Add keyboard shortcuts support to SFTPModal for select all, rename, delete, refresh, and new folder Co-authored-by: binaricat <16399091+binaricat@users.noreply.github.com> * fix: Address code review feedback - optimize useMemo deps and add same-pane paste notification Co-authored-by: binaricat <16399091+binaricat@users.noreply.github.com> * Fix SFTP paste source path * fix: delete sources after SFTP cut paste * Fix SFTP delete key matching * Fix cut delete after successful SFTP transfers * fix: finalize cut-paste deletes after conflicts * fix: track original names for cut transfers * Fix delete key matching for shortcuts * fix: respect visible files for sftp select all * Fix modal selection and cut cleanup * Throw on missing SFTP delete prerequisites * Fix dialog action handler memo deps --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: binaricat <16399091+binaricat@users.noreply.github.com> |
||
|
|
185143cedc |
fix: pass rootTaskId through nested transfers for cancellation
The previous fix only checked the direct parent task ID, which doesn't work for deeply nested folders: - Top-level task "A" (user cancels this) - Child folder "B" with parentTaskId="A" (detected cancellation) - Grandchild file "C" with parentTaskId="B" (NOT detected!) Now we pass rootTaskId through all levels of transferDirectory and transferFile calls, so all nested operations check against the original top-level task ID. Co-Authored-By: Claude <noreply@anthropic.com> |
||
|
|
5ec91ea89d |
fix: properly cancel pane-to-pane transfers
Previously, clicking cancel only updated the task status but didn't stop the actual file transfer operations. The transferFile and transferDirectory functions would continue running. Changes: - Add cancelledTasksRef to track cancelled task IDs - Check cancellation status at start of transferFile/transferDirectory - Check cancellation status during directory iteration - Add cancelled task ID to ref in cancelTransfer - Handle cancellation errors gracefully in processTransfer - Clean up cancelled IDs after 5s delay Now cancelling a folder transfer actually stops the operation. Co-Authored-By: Claude <noreply@anthropic.com> |
||
|
|
2de37c3d53 |
fix: address code review feedback
- Fix temporal dead zone issue in useSftpTransfers.ts by moving sourceEncoding declaration before its usage (P1 issue) - Initialize filenameEncoding from host.sftpEncoding in SFTPModal.tsx and add useEffect to update when host changes (P2 issue) - Fix duplicate Host import in SftpModalHeader.tsx Co-Authored-By: Claude <noreply@anthropic.com> |
||
|
|
994b5d1325 |
Merge main into feature/gb18030-encoding
Merged the latest changes from main including: - Bundled folder uploads with UploadController - Fast delete using SSH exec - UI improvements and bug fixes Resolved conflicts in: - useSftpExternalOperations.ts - SFTPModal.tsx - sftpBridge.cjs Co-Authored-By: Claude <noreply@anthropic.com> |
||
|
|
7980a62d55 |
Generalizes SFTP upload error handling
Adopts a "fail-fast" strategy for SFTP uploads, stopping the entire transfer process upon encountering any error during file or directory operations. Introduces a new `isFatalUploadError` helper to consolidate and expand the definition of errors that should halt an upload, now explicitly including cases where the target directory is deleted or inaccessible during the transfer. Removes specific fatal error checks from various components, streamlining error propagation and simplifying the overall error handling logic. Ensures "Scanning files..." placeholder tasks are consistently removed when actual upload tasks are added, preventing potential state inconsistencies. |
||
|
|
70a172216a |
feat(sftp): bundle folder uploads and improve cancel/delete operations
- Bundle folder uploads as single tasks showing aggregate progress - Add unique file transfer IDs for proper cancellation tracking - Fix cancel button to call cancelExternalUpload for external uploads - Improve backend cancel detection using cancelled flag instead of error message - Use SSH exec with rm -rf for fast folder deletion on remote servers - Add FolderUp icon for folder upload tasks in transfer queue - Add i18n key for upload cancelled message Co-Authored-By: Claude <noreply@anthropic.com> |
||
|
|
a4abcab019 | Merge feature/gb18030 into main | ||
|
|
ca91483d01 | Merge upstream/main | ||
|
|
dfcdcda189 |
Refactors module imports and updates hook deps
Adjusts relative import paths across the application to reflect recent changes in the project's directory structure. This primarily affects SFTP state management and modal components. Updates React hook dependency arrays for `useCallback` and `useEffect` to ensure proper memoization and re-execution, addressing `react-hooks/exhaustive-deps` linting rules. Improves type safety for translation function parameters by changing `Record<string, any>` to `Record<string, unknown>`. Adds the `ls` command to the allowed commands for the Claude AI assistant in local settings. |
||
|
|
951d1307cd |
Refactors SFTP features for improved modularity and readability
Decomposes the core SFTP state management hook and related UI components into smaller, domain-specific custom hooks and specialized sub-components. This refactoring aims to: - Break down the monolithic `useSftpState` hook into focused hooks like `useSftpConnections`, `useSftpTransfers`, and `useSftpPaneActions`. - Extract complex logic and rendering from `SFTPModal` and `SftpView` into dedicated presentational components and custom hooks. - Centralize SFTP-related types and utility functions into new `sftp/types.ts` and `sftp/utils.ts` modules. The changes enhance code organization, maintainability, and testability across the SFTP functionality. |