From e69393d1bcd428c8154553acef37fb1488e021d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B2=81=E6=A0=91=E4=BA=BA?= Date: Tue, 25 Feb 2025 20:30:25 +0900 Subject: [PATCH] fix(kgm): extract hash/key from both tables --- src/util/DatabaseKeyExtractor.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/util/DatabaseKeyExtractor.ts b/src/util/DatabaseKeyExtractor.ts index 2caac6b..b3db471 100644 --- a/src/util/DatabaseKeyExtractor.ts +++ b/src/util/DatabaseKeyExtractor.ts @@ -69,7 +69,17 @@ export class DatabaseKeyExtractor { let sql: undefined | string; if (this.hasTable(db, 'ShareFileItems')) { - sql = `select EncryptionKeyId, EncryptionKey from ShareFileItems where EncryptionKey != '' group by EncryptionKeyId`; + sql = ` + select H, K from ( + select EncryptionKeyId as H, EncryptionKey as K from ShareFileItems + union all + select EnHash as H, EnKey as K from DownloadItem + ) t + where + t.H is not null and t.H != '' + and t.K is not null and t.K != '' + group by t.H + `; } if (!sql) return null;