From a54e810af1dcf226ebea69409496ebbb98a2ae87 Mon Sep 17 00:00:00 2001 From: lyswhut Date: Wed, 1 Mar 2023 22:46:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=96=B0=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E6=97=B6=E5=BF=AB=E7=85=A7key=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E8=A2=AB=E4=BF=9D=E5=AD=98=E5=AF=BC=E8=87=B4=E7=9A=84?= =?UTF-8?q?=E4=B8=8B=E6=AC=A1=E5=90=8C=E6=AD=A5=E4=BB=8D=E7=84=B6=E9=9C=80?= =?UTF-8?q?=E8=A6=81=E9=80=89=E6=8B=A9=E5=90=8C=E6=AD=A5=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/modules/sync/server/syncList.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/modules/sync/server/syncList.ts b/src/main/modules/sync/server/syncList.ts index d2cd138c..3484e2a4 100644 --- a/src/main/modules/sync/server/syncList.ts +++ b/src/main/modules/sync/server/syncList.ts @@ -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) } }