Feature: preview remote files on file manager double-click
Double-clicking a local file now opens it, and a remote file is fetched through the existing V2 transfer into Preview\<clientKey>\<hash16>_<basename> and opened with the default program. The cache index is checked first by remote path + size/mtime; a transfer records the complete packet's SHA-256 and verifies it before moving the file into the cache. Hook both V2 receive paths: the Windows stream sub-connection observes the first chunk in MessageHandle and later chunks in CDlgFileSend; the Unix/Android same-connection path observes in OnRecvFileV2Chunk. A failed basename bound or path escape cancels the stream. The filename is now bounded by the packet's nameLength (it is not NUL-terminated), which also fixes the 1 MiB transfer case where trailing bytes were misread as a path. Search-result lists use column 3 as the directory and get their own result flag; the exact size/FILETIME from the listing feeds the 8 MiB gate. Remote executables require a confirmation before ShellExecute. A Debug-only WM_APP+0x123 hook drives the same double-click handler for end-to-end tests. Verified with a Debug x64 server and client: a 1 MiB remote file was transferred, SHA-256 verified, cached and indexed; a second double-click hit the cache without a transfer. Co-Authored-By: deepseek-flash
This commit is contained in:
1 parent
02c22b82a7
commit
3b945d1992
6 files changed
+329
-10
No files matched your search
@@ -122,6 +122,22 @@ public:
|
||||
CString m_strLocalSearchName;
|
||||
std::map<std::string, int> m_LocalIconCache;
|
||||
HANDLE m_hLocalSearchThread;
|
||||
|
||||
// ---- 双击预览 ----
|
||||
// 搜索结果列表与普通列表的列含义不同:普通列表第 3 列是修改日期,搜索结果是路径。
|
||||
bool m_bLocalSearchResults = false;
|
||||
bool m_bRemoteSearchResults = false;
|
||||
struct RemoteMeta { uint64_t size = 0; uint64_t mtimeMs = 0; };
|
||||
std::map<std::string, RemoteMeta> m_RemoteMeta; // key = 完整远程路径(GBK)
|
||||
afx_msg LRESULT OnPreviewResult(WPARAM wParam, LPARAM lParam);
|
||||
#ifdef _DEBUG
|
||||
// E2E 测试钩子:WM_APP+0x123,wParam=行号,lParam!=0 表示远程列表。
|
||||
afx_msg LRESULT OnPreviewTest(WPARAM wParam, LPARAM lParam);
|
||||
#endif
|
||||
void BeginRemotePreview(const CString& fullPath);
|
||||
void OpenLocalPath(const CString& path);
|
||||
bool GetRemoteFileMeta(const CString& fullPath, RemoteMeta& meta);
|
||||
std::string GetPreviewClientKey(uint64_t clientID);
|
||||
static DWORD WINAPI LocalSearchThreadProc(LPVOID lpParam);
|
||||
void LocalSearchWorker();
|
||||
static bool WildcardMatch(LPCTSTR pattern, LPCTSTR str);
|
||||
|
||||
Reference in new issue
Block a user