1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-07-25 20:14:55 +02:00
This commit is contained in:
syuilo
2026-07-25 19:13:46 +09:00
parent 76389b684c
commit 66498639bf
2 changed files with 5 additions and 4 deletions

View File

@@ -182,6 +182,7 @@ function normalizePreferences(preferences: PossiblyNonNormalizedPreferencesProfi
}
// 各recordについて、modifiedAtが大きい方を採用する
// 引数の参照をmutateしないように注意すること
export function mergeProfiles(a: PreferencesProfile, b: PreferencesProfile): PreferencesProfile {
const merged = {
...a,

View File

@@ -163,14 +163,14 @@ export async function cloudSync() {
key: prefer.profile.name,
}) as PreferencesProfile | null;
if (cloudProfile == null || cloudProfile.modifiedAt <= prefer.profile.modifiedAt) {
if (_DEV_) console.log('no new cloud profile found, skipping sync');
if (cloudProfile == null) {
if (_DEV_) console.log('no backuped profile found, skipping sync');
return;
}
if (_DEV_) console.log('new cloud profile found, restoring from cloud', cloudProfile);
if (_DEV_) console.log('backuped profile found, syncing', cloudProfile);
miLocalStorage.setItem('preferences', JSON.stringify(cloudProfile));
miLocalStorage.setItem('preferences', JSON.stringify(mergeProfiles(prefer.profile, cloudProfile)));
prefer.reloadProfile();
}