From 5414a92561a1a4c7de9c771df991c076e5d1081a Mon Sep 17 00:00:00 2001 From: Mystikfluu Date: Sun, 31 Jul 2022 12:55:51 +0200 Subject: [PATCH] decode channel names on the server --- routes/api/post.js | 2 +- server.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/routes/api/post.js b/routes/api/post.js index 2c463ab..c0829d6 100644 --- a/routes/api/post.js +++ b/routes/api/post.js @@ -82,7 +82,7 @@ module.exports = { } let messagestr = JSON.stringify(message) server.wss.clients.forEach(function(ws) { - if(ws.channel == req.body.receiver) { + if(ws.channel == decodeURIComponent(req.body.receiver)) { ws.send(messagestr) } }); diff --git a/server.js b/server.js index a4c831c..b204b28 100644 --- a/server.js +++ b/server.js @@ -1063,7 +1063,7 @@ wss.on("connection", function connection(ws) { ws.on("message", function incoming(message) { message = JSON.parse(message) if(message.id == "switchChannel") { - ws.channel = message.data + ws.channel = decodeURIComponent(message.data) } }) })