修复潜在问题
parent
a968410431
commit
5d877d81e3
|
@ -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,19 +147,14 @@ 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 => {
|
const key = await userSpace.listManage.createSnapshot()
|
||||||
if (!updated) {
|
userSpace.listManage.updateDeviceSnapshotKey(socket.keyInfo.clientId, key)
|
||||||
socket.close(SYNC_CLOSE_CODE.failed)
|
const currentUserName = socket.userInfo.name
|
||||||
return
|
const currentId = socket.keyInfo.clientId
|
||||||
}
|
socket.broadcast((client) => {
|
||||||
const key = await userSpace.listManage.createSnapshot()
|
if (client.keyInfo.clientId == currentId || !client.moduleReadys?.list || client.userInfo.name != currentUserName) return
|
||||||
userSpace.listManage.updateDeviceSnapshotKey(socket.keyInfo.clientId, key)
|
void client.remoteQueueList.onListSyncAction(action)
|
||||||
const currentUserName = socket.userInfo.name
|
|
||||||
const currentId = socket.keyInfo.clientId
|
|
||||||
socket.broadcast((client) => {
|
|
||||||
if (client.keyInfo.clientId == currentId || !client.moduleReadys?.list || client.userInfo.name != currentUserName) return
|
|
||||||
void client.remoteQueueList.onListSyncAction(action)
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue