修复新设备同步时快照key没有被保存导致的下次同步仍然需要选择同步模式的问题

pull/1229/head
lyswhut 2023-03-01 22:46:24 +08:00
parent 5cc1f20fac
commit a54e810af1
1 changed files with 5 additions and 2 deletions

View File

@ -265,6 +265,7 @@ const handleSyncList = async(socket: LX.Sync.Server.Socket) => {
if (requiredUpdateLocalListData) {
key = await handleSetLocalListData(mergedList)
await overwriteRemoteListData(mergedList, key, [socket.keyInfo.clientId])
if (!requiredUpdateRemoteListData) updateDeviceSnapshotKey(socket.keyInfo, key)
}
if (requiredUpdateRemoteListData) {
if (!key) key = await getCurrentListInfoKey()
@ -274,11 +275,13 @@ const handleSyncList = async(socket: LX.Sync.Server.Socket) => {
await setRemotelList(socket, localListData, await getCurrentListInfoKey())
}
} else {
let key: string
if (remoteListData.defaultList.length || remoteListData.loveList.length || remoteListData.userList.length) {
const key = await handleSetLocalListData(remoteListData)
updateDeviceSnapshotKey(socket.keyInfo, key)
key = await handleSetLocalListData(remoteListData)
await overwriteRemoteListData(remoteListData, key, [socket.keyInfo.clientId])
}
key ??= await getCurrentListInfoKey()
updateDeviceSnapshotKey(socket.keyInfo, key)
}
}