Check conflicting wish history account
parent
072abd6a18
commit
72fc6ab5b9
|
@ -58,6 +58,7 @@
|
|||
},
|
||||
};
|
||||
|
||||
let currentUID = '';
|
||||
let newOnly = true;
|
||||
|
||||
let wishes = {};
|
||||
|
@ -96,6 +97,16 @@
|
|||
}
|
||||
}
|
||||
|
||||
async function checkUID() {
|
||||
const prefix = getAccountPrefix();
|
||||
const path = `wish-uid`;
|
||||
const localData = await readSave(`${prefix}${path}`);
|
||||
|
||||
if (localData !== null) {
|
||||
currentUID = localData;
|
||||
}
|
||||
}
|
||||
|
||||
async function startImport() {
|
||||
if (selectedType === 'pclocal') {
|
||||
await importFromGeneratedText();
|
||||
|
@ -119,6 +130,7 @@
|
|||
}
|
||||
|
||||
try {
|
||||
await checkUID();
|
||||
for (const [wishNumber, type] of Object.entries(types)) {
|
||||
await getLog(wishNumber, type);
|
||||
if (cancelled) return;
|
||||
|
@ -227,6 +239,12 @@
|
|||
const name = row.name;
|
||||
const type = row.item_type.replace(/ /g, '');
|
||||
|
||||
if (currentUID !== '' && currentUID !== row.uid) {
|
||||
throw 'account error';
|
||||
}
|
||||
|
||||
currentUID = row.uid;
|
||||
|
||||
if (dayjs(time).isSameOrBefore(newestPullTime)) {
|
||||
return;
|
||||
}
|
||||
|
@ -261,7 +279,11 @@
|
|||
// console.log(wishes);
|
||||
} catch (err) {
|
||||
processingLog = false;
|
||||
if (err === 'account error') {
|
||||
pushToast($t('wish.import.differentAccount'), 'error');
|
||||
} else {
|
||||
pushToast($t('wish.import.invalidData'), 'error');
|
||||
}
|
||||
console.error(err);
|
||||
throw 'invalid data';
|
||||
}
|
||||
|
@ -407,6 +429,11 @@
|
|||
|
||||
const prefix = getAccountPrefix();
|
||||
await updateSave(`${prefix}collectables-updated`, true);
|
||||
|
||||
if (currentUID !== '') {
|
||||
await updateSave(`${prefix}wish-uid`, currentUID);
|
||||
}
|
||||
|
||||
closeModal();
|
||||
}
|
||||
|
||||
|
|
|
@ -160,6 +160,7 @@
|
|||
"invalidLink": "Invalid link, please check it again",
|
||||
"errorApi": "Error code returned from MiHoYo API, please try again later!",
|
||||
"timeout": "Connection timeout, please wait a moment and try again later",
|
||||
"differentAccount": "This wish history is for another account, please separate your account first on Settings menu!",
|
||||
"invalidData": "Invalid data returned from API, try again later",
|
||||
"success": "Import success 😀!",
|
||||
"server": "Select your server:",
|
||||
|
|
|
@ -160,6 +160,7 @@
|
|||
"invalidLink": "Link invalid, silahkan dicek kembali",
|
||||
"errorApi": "Error code dikembalikan dari API MiHoYo, coba lagi nanti!",
|
||||
"timeout": "Connection timeout, tunggu sebentar dan coba lagi nanti",
|
||||
"differentAccount": "Wish history ini adalah untuk akun lain, pisahkan dulu akun mu di menu Pengaturan!",
|
||||
"invalidData": "Invalid data dikembalikan dari API, coba lagi nanti",
|
||||
"success": "Import berhasil 😀!",
|
||||
"server": "Pilih server mu:",
|
||||
|
|
|
@ -150,6 +150,7 @@
|
|||
'wish-counter-weapon-event',
|
||||
'wish-counter-standard',
|
||||
'wish-counter-beginners',
|
||||
'wish-uid',
|
||||
'characters',
|
||||
'achievement',
|
||||
'collectables-updated',
|
||||
|
@ -185,6 +186,7 @@
|
|||
'wish-counter-weapon-event',
|
||||
'wish-counter-standard',
|
||||
'wish-counter-beginners',
|
||||
'wish-uid',
|
||||
'characters',
|
||||
'achievement',
|
||||
'collectables-updated',
|
||||
|
|
Loading…
Reference in New Issue