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
This commit is contained in:
yuanyuanxianganddeepseek-flash committed 2026-12-05 15:32:26 +01:00
1 parent 4d37d85bac
commit 3683b4ebeb
7 files changed
+72 -10

No files matched your search

+6 -2
View File
@@ -121,10 +121,12 @@ CFilePreviewMgr::PrepareResult CFilePreviewMgr::Prepare(
uint64_t clientID, const std::string& clientKey,
const std::string& remotePath, const std::string& basename,
uint64_t size, uint64_t mtimeMs, const std::string& sha256,
HWND notifyHwnd, std::string& outPath, std::string& error)
HWND notifyHwnd, std::string& outPath, std::string& error,
std::string* outSha)
{
outPath.clear();
error.clear();
if (outSha) outSha->clear();
std::string root = RootDir();
if (root.empty()) {
@@ -157,6 +159,7 @@ CFilePreviewMgr::PrepareResult CFilePreviewMgr::Prepare(
}
SaveIndex(clientDir, index);
outPath = localPath;
if (outSha) *outSha = hit.sha256;
return PrepareCached;
}
}
@@ -185,6 +188,7 @@ CFilePreviewMgr::PrepareResult CFilePreviewMgr::Prepare(
SaveIndex(clientDir, index);
EnforceCacheLimits(clientDir, index);
outPath = localPath;
if (outSha) *outSha = sha;
return PrepareCached;
}
@@ -1122,7 +1126,7 @@ bool CFilePreviewMgr::OpenLocalFile(HWND owner, const std::string& localPath,
if (IsExecutableExtension(localPath)) {
CString msg;
msg.Format(_TR("远程文件可能执行代码,确定要打开吗?\n\n远程路径:%s\n大小:%llu 字节\nSHA-256:%s"),
msg.Format(_TR("远程文件可能执行代码,确定要打开吗?(%s,%llu 字节,SHA-256 %s)"),
CString(remotePath.c_str()),
(unsigned long long)size,
CString(sha256.size() >= 16 ? sha256.substr(0, 16).c_str() : sha256.c_str()));