diff --git a/src/core/passport.js b/src/core/passport.js index 55444f7..e52cdbf 100644 --- a/src/core/passport.js +++ b/src/core/passport.js @@ -282,6 +282,7 @@ passport.use(new VkontakteStrategy({ // eslint-disable-next-line max-len message: 'Sorry, you can not use vk login with an account that does not have a verified email set.', }); + return; } const user = await oauthLogin(email, name); done(null, user); diff --git a/src/data/models/Event.js b/src/data/models/Event.js index 6e7fc9b..1e8af22 100644 --- a/src/data/models/Event.js +++ b/src/data/models/Event.js @@ -3,6 +3,7 @@ * data saving for hourly events * */ +import { commandOptions } from 'redis'; // its ok if its slow /* eslint-disable no-await-in-loop */ @@ -57,6 +58,7 @@ export async function getEventArea() { /* * restore area effected by last event + * TODO: notify RedisCanvas */ export async function clearOldEvent() { const pos = await getEventArea(); @@ -67,7 +69,10 @@ export async function clearOldEvent() { for (let jc = j - 1; jc <= j + 1; jc += 1) { for (let ic = i - 1; ic <= i + 1; ic += 1) { const chunkKey = `${EVENT_BACKUP_PREFIX}:${ic}:${jc}`; - const chunk = await redis.get(chunkKey); + const chunk = await redis.get( + commandOptions({ returnBuffers: true }), + chunkKey, + ); if (!chunk) { logger.warn( // eslint-disable-next-line max-len diff --git a/src/data/models/RedisCanvas.js b/src/data/models/RedisCanvas.js index 73508c7..21986a0 100644 --- a/src/data/models/RedisCanvas.js +++ b/src/data/models/RedisCanvas.js @@ -59,7 +59,9 @@ class RedisCanvas { static async setChunk(i, j, chunk, canvasId) { if (chunk.length !== TILE_SIZE * TILE_SIZE) { // eslint-disable-next-line no-console - console.error(`Tried to set chunk with invalid length ${chunk.length}!`); + console.error( + new Error(`Tried to set chunk with invalid length ${chunk.length}!`), + ); return false; } const key = `ch:${canvasId}:${i}:${j}`; diff --git a/src/socket/SocketServer.js b/src/socket/SocketServer.js index c8e4a3b..24c050b 100644 --- a/src/socket/SocketServer.js +++ b/src/socket/SocketServer.js @@ -226,7 +226,9 @@ class SocketServer { let client = it.next(); while (!client.done) { const ws = client.value; - if (ws.user.id === userId && ws.readyState === WebSocket.OPEN) { + if (ws.readyState === WebSocket.OPEN + && ws.user.id === userId + ) { return ws; } client = it.next(); @@ -240,7 +242,9 @@ class SocketServer { let client = it.next(); while (!client.done) { const ws = client.value; - if (ws.user.id === userId && ws.readyState === WebSocket.OPEN) { + if (ws.readyState === WebSocket.OPEN + && ws.user.id === userId + ) { clients.push(ws); } client = it.next();