Release v0.6.57: multi-PC input, shared clipboard and resilient Settings Save
This commit is contained in:
1 parent
82292c8a7e
commit
5de010ee44
39 files changed
+1707
-312
No files matched your search
+7
-6
@@ -473,6 +473,7 @@ void History::loadIndex()
|
||||
e.value("image", false),
|
||||
e.value("files", false), e.value("ocrState", e.value("image", false) ? 1 : 0),
|
||||
str(e, "ocrProfile", L"windows")};
|
||||
item.computer=e.value("computer",std::string{});item.computerName=str(e,"computerName");
|
||||
if (e.value("fingerprintVersion", 0) == 1) {
|
||||
item.contentHash = e.value("contentHash", std::string{});
|
||||
item.imageHash = e.value("imageHash", std::string{});
|
||||
@@ -644,7 +645,7 @@ void History::saveIndex()
|
||||
for (const auto &e : entries_)
|
||||
j.push_back({{"id", utf8(e.id)},
|
||||
{"preview", utf8(e.preview)},
|
||||
{"app", utf8(e.app)},
|
||||
{"app", utf8(e.app)}, {"computer", e.computer}, {"computerName", utf8(e.computerName)},
|
||||
{"bytes", e.bytes},
|
||||
{"at", e.at},
|
||||
{"pinned", e.pinned},
|
||||
@@ -753,7 +754,7 @@ bool sameClipboardImage(const Clip &a, const Clip &b)
|
||||
return false; // Undecodable data is not evidence of a duplicate.
|
||||
}
|
||||
}
|
||||
void History::add(const Clip &clip, const std::wstring &app, const Settings &s)
|
||||
void History::add(const Clip &clip, const std::wstring &app, const Settings &s, const std::string &computer, const std::wstring &computerName)
|
||||
{
|
||||
if (clip.formats.empty() || !clip.size())
|
||||
return;
|
||||
@@ -769,15 +770,15 @@ void History::add(const Clip &clip, const std::wstring &app, const Settings &s)
|
||||
std::lock_guard lock(mutex_);
|
||||
Entry fingerprints;
|
||||
fingerprints.contentHash = clipboardHash(data);
|
||||
if (!entries_.empty() && entries_.front().contentHash == fingerprints.contentHash)
|
||||
if (!entries_.empty() && entries_.front().computer == computer && entries_.front().contentHash == fingerprints.contentHash)
|
||||
return;
|
||||
imageFingerprints(fingerprints, clip, false);
|
||||
if (!entries_.empty() && !fingerprints.imageHash.empty() && entries_.front().imageHash == fingerprints.imageHash)
|
||||
if (!entries_.empty() && entries_.front().computer == computer && !fingerprints.imageHash.empty() && entries_.front().imageHash == fingerprints.imageHash)
|
||||
return;
|
||||
imageFingerprints(fingerprints, clip);
|
||||
// Different payload kinds cannot be duplicates. Consult the index first so
|
||||
// copying text after a screenshot never loads/decrypts the previous image.
|
||||
if (!entries_.empty() && entries_.front().image == image && entries_.front().files == files)
|
||||
if (!entries_.empty() && entries_.front().computer == computer && entries_.front().image == image && entries_.front().files == files)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -821,7 +822,7 @@ void History::add(const Clip &clip, const std::wstring &app, const Settings &s)
|
||||
Entry{id, text, app, encrypted.size(),
|
||||
(uint64_t(now.dwHighDateTime) << 32) | now.dwLowDateTime, false, image, files,
|
||||
image ? 1 : 0, ocrProfile(s), std::move(fingerprints.contentHash),
|
||||
std::move(fingerprints.imageHash), std::move(fingerprints.pixelHash)});
|
||||
std::move(fingerprints.imageHash), std::move(fingerprints.pixelHash), computer, computerName});
|
||||
prune(s);
|
||||
saveIndex();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user