diff options
author | Minteck <contact@minteck.org> | 2022-08-10 10:38:44 +0200 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2022-08-10 10:38:44 +0200 |
commit | c6dbf0450566c40efc4a26f4f0717452b6ef95cd (patch) | |
tree | b4be2d508223820d0a77d5a3e35e82684da3b6ec /server/hornchat.profile.process.js | |
download | hornchat-c6dbf0450566c40efc4a26f4f0717452b6ef95cd.tar.gz hornchat-c6dbf0450566c40efc4a26f4f0717452b6ef95cd.tar.bz2 hornchat-c6dbf0450566c40efc4a26f4f0717452b6ef95cd.zip |
Diffstat (limited to 'server/hornchat.profile.process.js')
-rw-r--r-- | server/hornchat.profile.process.js | 17 |
1 files changed, 17 insertions, 0 deletions
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})); +} |