Commit Graph
6 Commits
Author SHA1 Message Date
yuanyuanxiangandQoder bdf85a82cd Feature: add a remote Open command with large-file confirmation
Add an Open item atop the remote file list context menu: a single file is
pulled back and previewed through the existing flow, a single folder
navigates into its subdirectory, and multi-selection disables it. Files
over the 8 MiB preview limit ask for confirmation; once confirmed the
explicit-open path relaxes the size gate, hash query, total timeout and
cache eviction so even very large files transfer and open. Double-click
preview behavior is unchanged. Localize the new menu item and dialog in
en_US/zh_TW/de_DE.

Co-Authored-By: Qoder
2026-12-05 17:48:17 +01:00
yuanyuanxianganddeepseek-flash bcd7ee692a Fix: handle preview download errors and Unix metadata keys
Consume TOKEN_DOWNLOAD_ERROR in the file manager and fail the matching
preview request with the client's win32 code instead of sending
COMMAND_EXCEPTION and leaving the request to the 15 s watchdog.

Key the exact size/mtime metadata by the list's displayed ANSI/GBK text,
not the raw protocol bytes: Linux/macOS send UTF-8 names while GetItemText
returns the process ACP, so non-ASCII files previously missed the metadata
lookup and could not start a preview.

Bind the Unix progress dialog to the preview request so a stalled transfer
closes it on timeout; save the index after LRU eviction; make the local
right-click Open honour search-result paths; reject over-long received
names; and defer abandoned temp-dir deletion to the watchdog.

The new download-error and hash-error strings are added to en_US, zh_TW
and de_DE.

Co-Authored-By: deepseek-flash
2026-12-05 15:44:36 +01:00
yuanyuanxianganddeepseek-flash 6cb779ef70 Feature: query the remote SHA-256 before previewing
When the main connection advertises CLIENT_CAP_FILE_HASH, double-click
sends COMMAND_FILE_HASH first and continues from the async
TOKEN_FILE_HASH response (posted to the UI thread). A matching SHA-256
opens the cached copy without a transfer, including content found under
a different remote path; the new path is added to the index. Too-large
and error responses are handled, and a 5 second timeout falls back to the
P1 size/mtime path.

The response parser is based on FileHashResponseHeader and the echoed
request path; pending state is cleared on close and the hash timer is
killed with the dialog.

Verified with the Debug server and client: a 1 MiB file was hashed,
transferred and cached under its SHA-256; an identical copy at a second
path hit the cache with no new transfer or stream connection.

Co-Authored-By: deepseek-flash
2026-12-05 15:43:12 +01:00
yuanyuanxianganddeepseek-flash ea5d69d1c0 Fix: keep the device gate outside the MCP pending lock
Release the DeviceTransferGate only after leaving m_PendingMutex in the
three MCP begin paths, matching the documented gate -> pending -> xfer
order (the gate mutex is brief, but this keeps the order explicit and
avoids future nesting mistakes).

Also short-circuit ObserveChunk when there are no preview requests or
tombstones, so ordinary V2 chunk paths do not scan the preview maps.

Co-Authored-By: deepseek-flash
2026-12-05 15:33:57 +01:00
yuanyuanxianganddeepseek-flash 3683b4ebeb Feature: localize the preview messages and report the cached hash
Add the preview strings to en_US, zh_TW and de_DE (GBK, no '=' in keys;
German uses ASCII transliterations where GBK cannot encode umlauts), and
pass the cached entry's SHA-256 back to the open helper so the executable
confirmation shows the actual hash on a cache hit.

Honour PreviewEnabled=0 by leaving double-click unchanged, and document
the preview plus COMMAND_FILE_HASH capability in the client matrix.

Co-Authored-By: deepseek-flash
2026-12-05 15:32:26 +01:00
yuanyuanxianganddeepseek-flash 02c22b82a7 Feature: add the file preview cache and device transfer gate
Add FilePreview.h/.cpp with the non-UI half of the double-click preview:
a flat per-client cache (Preview\<clientKey>\<hash16>_<basename>), a
per-client index keyed by remote path and SHA-256, size/mtime metadata
hits, the 8 MiB gate, empty-file handling, LRU caps, and the executable
confirmation plus ShellExecute helper.

DeviceTransferGate is the shared device-level claim used by preview and
the MCP file-transfer entry points so one device can only run one file
transfer at a time; C2C claims both src and dst. The receive hooks
(ObserveChunk/OnComplete) are implemented here and called by the file
manager paths in the next commit.

Co-Authored-By: deepseek-flash
2026-12-05 15:30:21 +01:00