fix: warn when 0 keys imported (#38)
This commit is contained in:
parent
f089f92930
commit
60547f0a0a
@ -49,8 +49,14 @@ export function PanelKWMv2Key() {
|
|||||||
const fileBuffer = await file.arrayBuffer();
|
const fileBuffer = await file.arrayBuffer();
|
||||||
keys = MMKVParser.parseKuwoEKey(new DataView(fileBuffer));
|
keys = MMKVParser.parseKuwoEKey(new DataView(fileBuffer));
|
||||||
}
|
}
|
||||||
|
if (keys?.length === 0) {
|
||||||
if (keys) {
|
toast({
|
||||||
|
title: '未导入密钥',
|
||||||
|
description: '选择的密钥数据库文件未发现任何可用的密钥。',
|
||||||
|
isClosable: true,
|
||||||
|
status: 'warning',
|
||||||
|
});
|
||||||
|
} else if (keys) {
|
||||||
dispatch(kwm2ImportKeys(keys));
|
dispatch(kwm2ImportKeys(keys));
|
||||||
setShowImportModal(false);
|
setShowImportModal(false);
|
||||||
toast({
|
toast({
|
||||||
|
@ -71,14 +71,20 @@ export function PanelQMCv2Key() {
|
|||||||
qmc2Keys = Array.from(map.entries(), ([name, ekey]) => ({ name: getFileName(name), ekey }));
|
qmc2Keys = Array.from(map.entries(), ([name, ekey]) => ({ name: getFileName(name), ekey }));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qmc2Keys) {
|
if (qmc2Keys?.length === 0) {
|
||||||
|
toast({
|
||||||
|
title: '未导入密钥',
|
||||||
|
description: '选择的密钥数据库文件未发现任何可用的密钥。',
|
||||||
|
isClosable: true,
|
||||||
|
status: 'warning',
|
||||||
|
});
|
||||||
|
} else if (qmc2Keys) {
|
||||||
dispatch(qmc2ImportKeys(qmc2Keys));
|
dispatch(qmc2ImportKeys(qmc2Keys));
|
||||||
setShowImportModal(false);
|
setShowImportModal(false);
|
||||||
toast({
|
toast({
|
||||||
title: `导入成功 (${qmc2Keys.length})`,
|
title: `导入成功 (${qmc2Keys.length})`,
|
||||||
description: '记得保存更改来应用。',
|
description: '记得保存更改来应用。',
|
||||||
isClosable: true,
|
isClosable: true,
|
||||||
duration: 5000,
|
|
||||||
status: 'success',
|
status: 'success',
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user