lint code

This commit is contained in:
lyswhut
2023-08-30 14:30:47 +08:00
parent 358142c1cc
commit 2fff8652ca
48 changed files with 123 additions and 106 deletions
+2
View File
@@ -16,8 +16,10 @@ export const initClientInfo = async() => {
if (syncAuthKeys != null) return
const syncAuthKeysFilePath = path.join(global.lxDataPath, File.clientDataPath, File.syncAuthKeysJSON)
if (await fs.promises.stat(syncAuthKeysFilePath).then(() => true).catch(() => false)) {
// eslint-disable-next-line require-atomic-updates
syncAuthKeys = JSON.parse((await fs.promises.readFile(syncAuthKeysFilePath)).toString())
} else {
// eslint-disable-next-line require-atomic-updates
syncAuthKeys = {}
const syncDataPath = path.join(global.lxDataPath, File.clientDataPath)
if (!await exists(syncDataPath)) {
@@ -12,6 +12,7 @@ const sendListAction = async(wss: LX.Sync.Server.SocketServer, action: LX.Sync.L
let key = ''
for (const client of wss.clients) {
if (!client.moduleReadys?.list) continue
// eslint-disable-next-line require-atomic-updates
if (!key) key = await userSpace.listManage.createSnapshot()
void client.remoteQueueList.onListSyncAction(action).then(async() => {
return userSpace.listManage.updateDeviceSnapshotKey(client.keyInfo.clientId, key)
@@ -25,8 +25,10 @@ export const initServerInfo = async() => {
if (serverInfo != null) return
const serverInfoFilePath = path.join(global.lxDataPath, File.serverDataPath, File.serverInfoJSON)
if (await exists(serverInfoFilePath)) {
// eslint-disable-next-line require-atomic-updates
serverInfo = JSON.parse((await fs.promises.readFile(serverInfoFilePath)).toString())
} else {
// eslint-disable-next-line require-atomic-updates
serverInfo = {
serverId: randomBytes(4 * 4).toString('base64'),
version: 2,