debug info

This commit is contained in:
leca 2024-11-13 23:09:50 +03:00
parent 0e4cc6507b
commit 4f5cd78eb0
1 changed files with 2 additions and 0 deletions

View File

@ -2,6 +2,7 @@ import clients from '../index.js';
import jwt from 'jsonwebtoken'; import jwt from 'jsonwebtoken';
import config from '../../config.json' with {type: "json"}; import config from '../../config.json' with {type: "json"};
import log from './log.js';
const notify = (token, groupId, action, item, data) => { const notify = (token, groupId, action, item, data) => {
let login = jwt.decode(token, config.secret).login let login = jwt.decode(token, config.secret).login
@ -18,6 +19,7 @@ const notify = (token, groupId, action, item, data) => {
if (client.currentGroup == groupId) { if (client.currentGroup == groupId) {
let userIdFromToken = jwt.decode(client.token, config.secret).login.id let userIdFromToken = jwt.decode(client.token, config.secret).login.id
if (userIdCurrent == userIdFromToken) return; if (userIdCurrent == userIdFromToken) return;
log.debug(`Sending user with ID ${userIdCurrent} packet "${JSON.stringify(payload)}"`)
client.socket.send(JSON.stringify(payload)) client.socket.send(JSON.stringify(payload))
} }
}); });