From e998a26fd08509167536b8eb1a3955bc94c180ea Mon Sep 17 00:00:00 2001 From: hippoz Date: Tue, 8 Dec 2020 00:25:27 +0200 Subject: [PATCH] add individual user froce refresh --- api/v1/gateway/index.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/api/v1/gateway/index.js b/api/v1/gateway/index.js index 4bc6e30..258817d 100644 --- a/api/v1/gateway/index.js +++ b/api/v1/gateway/index.js @@ -68,6 +68,24 @@ GatewayServer.prototype._processCommand = function(socket, message) { } break; } + case 'admin/fru': { + if (args === 1) { + if (socket.user.permissionLevel >= config.roleMap.ADMIN) { + const user = await this._findSocketInRoom(message.category._id, fullCommand[1]); + if (!user) { + this._sendSystemMessage(socket, 'User not found.', message.category); + break; + } + + this._gateway.in(user.user.sid).emit('refreshClient', { reason: 'REFRESH' }); + } else { + this._sendSystemMessage(socket, 'how about no', message.category); + } + } else { + this._sendSystemMessage(socket, 'Invalid number of arguments.', message.category); + } + break; + } default: { this._sendSystemMessage(socket, 'That command does not exist.', message.category); break;