Version 0.9.2c - Fix du Online Viewver

This commit is contained in:
CICD - Pipeline 2023-09-13 23:29:37 +02:00
parent 98d9127b82
commit c215474e24
4 changed files with 25 additions and 53 deletions

View File

@ -75,44 +75,6 @@
"token": "b4f1b8cd-2711-48b7-b301-0290f9d9f69b", "token": "b4f1b8cd-2711-48b7-b301-0290f9d9f69b",
"admin": false "admin": false
}, },
{
"auth": {
"token_type": "Bearer",
"access_token": "l7nUoMgqZN1w3f9SE5iSrEuYedaLZF",
"expires_in": 604800,
"refresh_token": "pHiIXvVPBiRY49lqxZe6SqBqmlxgY4",
"scope": "identify guilds.members.read guilds"
},
"avatar": null,
"communication_disabled_until": null,
"flags": 0,
"joined_at": "2020-03-06T18:17:58.037000+00:00",
"nick": null,
"pending": false,
"premium_since": null,
"roles": [
"397725552968204288"
],
"user": {
"id": "249494159629484033",
"username": "immudelki",
"avatar": "9a0742b8d6a2092a049e207dbc0cdf89",
"discriminator": "0",
"public_flags": 0,
"flags": 0,
"banner": null,
"accent_color": 1123662,
"global_name": "Immudelki",
"avatar_decoration_data": null,
"banner_color": "#11254e"
},
"mute": false,
"deaf": false,
"bio": "",
"banner": null,
"token": "3b65e082-8a12-4124-9c81-d296b618c68f",
"admin": true
},
{ {
"auth": { "auth": {
"token_type": "Bearer", "token_type": "Bearer",

View File

@ -164,6 +164,7 @@ module.exports.getUsersList = function () {
} }
return userList return userList
} }
@ -172,6 +173,11 @@ module.exports.getSimpleUser = function (token) {
var user = users.get(token) var user = users.get(token)
if(!user) {
return null
}
return ({"username": user.user.username, "global_name":user.user.global_name, "avatar": user.user.avatar, "id": user.user.id, "admin": user.admin}) return ({"username": user.user.username, "global_name":user.user.global_name, "avatar": user.user.avatar, "id": user.user.id, "admin": user.admin})
} }

View File

@ -186,9 +186,11 @@ function IOConnection(io) {
var utoken = ucookies.token var utoken = ucookies.token
const online_users_data = auth.getSimpleUser(utoken) const online_users_data = auth.getSimpleUser(utoken)
if(online_users_data) {
usersOnline.push(online_users_data) usersOnline.push(online_users_data)
}
alog.log(online_users_data.username + " - Connexion du serveur") alog.log(online_users_data.username + " - Connexion du serveur")
} }
@ -208,6 +210,8 @@ function IOConnection(io) {
var utoken = ucookies.token var utoken = ucookies.token
const online_users_data = auth.getSimpleUser(utoken) const online_users_data = auth.getSimpleUser(utoken)
if(online_users_data) {
var userIndex = -1 var userIndex = -1
for(var user of usersOnline) { for(var user of usersOnline) {
@ -221,7 +225,7 @@ function IOConnection(io) {
alog.log(online_users_data.username + " - Deconnexion du serveur") alog.log(online_users_data.username + " - Deconnexion du serveur")
usersOnline.splice(userIndex, 1) usersOnline.splice(userIndex, 1)
}
} }