Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
goto-bus-stop committed Dec 6, 2024
1 parent a0b49e5 commit e5b367e
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 16 deletions.
10 changes: 5 additions & 5 deletions src/HttpApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,12 @@ async function httpApi(uw, options) {
* @param {string} sid
* @param {(err?: Error, data?: session.SessionData | null) => void} callback
*/
get (sid, callback) {
get(sid, callback) {
uw.redis.get(`session:${sid}`).then((data) => {
callback(undefined, data == null ? null : JSON.parse(data));
}, (err) => {
callback(err);
})
});
}

/**
Expand All @@ -145,7 +145,7 @@ async function httpApi(uw, options) {
callback();
}, (err) => {
callback(err);
})
});
}

/**
Expand All @@ -157,9 +157,9 @@ async function httpApi(uw, options) {
callback();
}, (err) => {
callback(err);
})
});
}
},
}(),
}))
.use(uw.passport.initialize())
.use(addFullUrl())
Expand Down
4 changes: 3 additions & 1 deletion src/SocketServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,9 @@ class SocketServer {
*/
async initLostConnections() {
const { db, redis } = this.#uw;
const userIDs = /** @type {import('./schema').UserID[]} */ (await redis.lrange(REDIS_ACTIVE_SESSIONS, 0, -1));
const userIDs = /** @type {import('./schema').UserID[]} */ (
await redis.lrange(REDIS_ACTIVE_SESSIONS, 0, -1)
);
const disconnectedIDs = userIDs.filter((userID) => !this.connection(userID));

if (disconnectedIDs.length === 0) {
Expand Down
8 changes: 0 additions & 8 deletions src/controllers/authenticate.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import cookie from 'cookie';
import jwt from 'jsonwebtoken';
import randomString from 'random-string';
import nodeFetch from 'node-fetch';
import ms from 'ms';
import htmlescape from 'htmlescape';
import httpErrors from 'http-errors';
import nodemailer from 'nodemailer';
Expand Down Expand Up @@ -37,13 +36,6 @@ const { BadRequest } = httpErrors;
* @prop {AuthenticateOptions} authOptions
*/

/**
* @param {string} str
*/
function seconds(str) {
return Math.floor(ms(str) / 1000);
}

/**
* @type {import('../types.js').Controller}
*/
Expand Down
4 changes: 3 additions & 1 deletion src/sockets/AuthedConnection.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ class AuthedConnection extends EventEmitter {
this.events = new Ultron(this.socket);
this.user = user;
this.sessionID = sessionID;
this.#logger = uw.logger.child({ ns: 'uwave:sockets', connectionType: 'AuthedConnection', userId: this.user.id, sessionID });
this.#logger = uw.logger.child({
ns: 'uwave:sockets', connectionType: 'AuthedConnection', userId: this.user.id, sessionID,
});

this.events.on('close', () => {
this.emit('close', { banned: this.banned });
Expand Down
4 changes: 3 additions & 1 deletion src/sockets/LostConnection.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ class LostConnection extends EventEmitter {
this.user = user;
this.sessionID = sessionID;
this.timeout = timeout;
this.#logger = uw.logger.child({ ns: 'uwave:sockets', connectionType: 'LostConnection', userID: this.user.id, sessionID });
this.#logger = uw.logger.child({
ns: 'uwave:sockets', connectionType: 'LostConnection', userID: this.user.id, sessionID,
});

this.initQueued();
this.setTimeout(timeout);
Expand Down

0 comments on commit e5b367e

Please sign in to comment.