mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-07 06:25:50 +01:00
show unique user count in acp
This commit is contained in:
@@ -225,6 +225,7 @@ Sockets.getUserSocketCount = function(uid) {
|
|||||||
if (!io) {
|
if (!io) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
var room = io.sockets.adapter.rooms['uid_' + uid];
|
var room = io.sockets.adapter.rooms['uid_' + uid];
|
||||||
return room ? room.length : 0;
|
return room ? room.length : 0;
|
||||||
};
|
};
|
||||||
@@ -233,8 +234,14 @@ Sockets.getOnlineUserCount = function() {
|
|||||||
if (!io) {
|
if (!io) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
var room = io.sockets.adapter.rooms.online_users;
|
var count = 0;
|
||||||
return room ? room.length : 0;
|
for (var key in io.sockets.adapter.rooms) {
|
||||||
|
if (io.sockets.adapter.rooms.hasOwnProperty(key) && key.startsWith('uid_')) {
|
||||||
|
++ count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return count;
|
||||||
};
|
};
|
||||||
|
|
||||||
Sockets.getOnlineAnonCount = function () {
|
Sockets.getOnlineAnonCount = function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user