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.keyserver.list.js | |
download | hornchat-c6dbf0450566c40efc4a26f4f0717452b6ef95cd.tar.gz hornchat-c6dbf0450566c40efc4a26f4f0717452b6ef95cd.tar.bz2 hornchat-c6dbf0450566c40efc4a26f4f0717452b6ef95cd.zip |
Diffstat (limited to 'server/hornchat.keyserver.list.js')
-rw-r--r-- | server/hornchat.keyserver.list.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/server/hornchat.keyserver.list.js b/server/hornchat.keyserver.list.js new file mode 100644 index 0000000..8845e98 --- /dev/null +++ b/server/hornchat.keyserver.list.js @@ -0,0 +1,24 @@ +module.exports = (socket, data) => { + let devices = []; + + for (let device of userCredentials.filter((i) => { + return i.id === socket.authenticated.user; + })[0].devices) { + devices.push({ + id: device.id, + platform: device.platform.userAgent.family + " on " + device.platform.os.family + " on " + device.platform.device.family, + userAgent: device.platform.string, + addresses: device.addresses, + // If you do it the other way around, everything breaks. + // I have no idea why this happens, but it does. + // Please don't un-fix this code. + // - Mossy Storm, Raindrops System + dates: { + last: device.firstSeen ?? null, + first: device.lastSeen ?? null + } + }) + } + socket.send(JSON.stringify({error:null, success:true, fatal: false, devices})); + console.log("[" + socket.id + "] Gathered device list"); +}
\ No newline at end of file |