修复潜在问题

pull/1583/head
lyswhut 2023-08-29 12:32:31 +08:00
parent a968410431
commit 5d877d81e3
2 changed files with 10 additions and 16 deletions

View File

@ -2,7 +2,7 @@
// import { throttle } from '@common/utils/common' // import { throttle } from '@common/utils/common'
// import { sendSyncActionList } from '@main/modules/winMain' // import { sendSyncActionList } from '@main/modules/winMain'
// import { SYNC_CLOSE_CODE } from '@/constants' // import { SYNC_CLOSE_CODE } from '@/constants'
import { SYNC_CLOSE_CODE } from '@common/constants_sync' // import { SYNC_CLOSE_CODE } from '@common/constants_sync'
import { getUserSpace } from '@main/modules/sync/server/user' import { getUserSpace } from '@main/modules/sync/server/user'
import { handleRemoteListAction } from '@main/modules/sync/utils' import { handleRemoteListAction } from '@main/modules/sync/utils'
// import { encryptMsg } from '@/utils/tools' // import { encryptMsg } from '@/utils/tools'
@ -147,12 +147,8 @@ import { handleRemoteListAction } from '@main/modules/sync/utils'
export const onListSyncAction = async(socket: LX.Sync.Server.Socket, action: LX.Sync.List.ActionList) => { export const onListSyncAction = async(socket: LX.Sync.Server.Socket, action: LX.Sync.List.ActionList) => {
if (!socket.moduleReadys.list) return if (!socket.moduleReadys.list) return
await handleRemoteListAction(action)
const userSpace = getUserSpace(socket.userInfo.name) const userSpace = getUserSpace(socket.userInfo.name)
await handleRemoteListAction(action).then(async updated => {
if (!updated) {
socket.close(SYNC_CLOSE_CODE.failed)
return
}
const key = await userSpace.listManage.createSnapshot() const key = await userSpace.listManage.createSnapshot()
userSpace.listManage.updateDeviceSnapshotKey(socket.keyInfo.clientId, key) userSpace.listManage.updateDeviceSnapshotKey(socket.keyInfo.clientId, key)
const currentUserName = socket.userInfo.name const currentUserName = socket.userInfo.name
@ -161,5 +157,4 @@ export const onListSyncAction = async(socket: LX.Sync.Server.Socket, action: LX.
if (client.keyInfo.clientId == currentId || !client.moduleReadys?.list || client.userInfo.name != currentUserName) return if (client.keyInfo.clientId == currentId || !client.moduleReadys?.list || client.userInfo.name != currentUserName) return
void client.remoteQueueList.onListSyncAction(action) void client.remoteQueueList.onListSyncAction(action)
}) })
})
} }

View File

@ -229,7 +229,6 @@ export const handleRemoteListAction = async({ action, data }: LX.Sync.List.Actio
await global.lx.event_list.list_music_clear(data, true) await global.lx.event_list.list_music_clear(data, true)
break break
default: default:
return false throw new Error('unknown list sync action')
} }
return true
} }