From c6dbf0450566c40efc4a26f4f0717452b6ef95cd Mon Sep 17 00:00:00 2001 From: Minteck Date: Wed, 10 Aug 2022 10:38:44 +0200 Subject: Initial commit --- server/hornchat.profile.process.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 server/hornchat.profile.process.js (limited to 'server/hornchat.profile.process.js') diff --git a/server/hornchat.profile.process.js b/server/hornchat.profile.process.js new file mode 100644 index 0000000..3769c4e --- /dev/null +++ b/server/hornchat.profile.process.js @@ -0,0 +1,17 @@ +module.exports = (socket, d) => { + if (!fronters[d.username] || !pluralkit[d.username]) { + socket.send(JSON.stringify({error:"INVALID_USER", fatal: false})); + console.log("[" + socket.id + "] Invalid 'username' value"); + return; + } + + let pk = pluralkit[d.username]; + pk['fronters'] = fronters[d.username]; + + if (!data[socket.id]["trackedUsers"]) data[socket.id]["trackedUsers"] = []; + if (!data[socket.id]["lastKnownTrackedUserInfo"]) data[socket.id]["lastKnownTrackedUserInfo"] = {}; + data[socket.id]["trackedUsers"].push(d.username); + data[socket.id]["lastKnownTrackedUserInfo"][d.username] = JSON.stringify(pk); + + socket.send(JSON.stringify({error:null, success:true, fatal: false, manual: true, data: pk, username: d.username})); +} -- cgit