Fix userlist bug on some server implementations
This commit is contained in:
parent
b9ee3dc9f0
commit
b677ef4d55
1 changed files with 12 additions and 6 deletions
16
src/index.js
16
src/index.js
|
@ -185,6 +185,7 @@ class CollabVMClient {
|
||||||
alert("That username has been blacklisted.");
|
alert("That username has been blacklisted.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (!connected) return;
|
||||||
var u = users.find(u => u.username === window.username);
|
var u = users.find(u => u.username === window.username);
|
||||||
if (u) {
|
if (u) {
|
||||||
u.username = msgArr[3];
|
u.username = msgArr[3];
|
||||||
|
@ -201,12 +202,14 @@ class CollabVMClient {
|
||||||
user.element.children[0].innerHTML = msgArr[3];
|
user.element.children[0].innerHTML = msgArr[3];
|
||||||
break;
|
break;
|
||||||
case "adduser":
|
case "adduser":
|
||||||
|
if (!connected) return;
|
||||||
for (var i = 2; i < msgArr.length; i += 2) {
|
for (var i = 2; i < msgArr.length; i += 2) {
|
||||||
this.addUser(msgArr[i], msgArr[i+1]);
|
this.addUser(msgArr[i], msgArr[i+1]);
|
||||||
}
|
}
|
||||||
onlineusercount.innerText = users.length;
|
onlineusercount.innerText = users.length;
|
||||||
break;
|
break;
|
||||||
case "remuser":
|
case "remuser":
|
||||||
|
if (!connected) return;
|
||||||
for (var i = 2; i < msgArr.length; i++) {
|
for (var i = 2; i < msgArr.length; i++) {
|
||||||
var user = users.find(u => u.username == msgArr[i]);
|
var user = users.find(u => u.username == msgArr[i]);
|
||||||
users.splice(users.indexOf(user), 1);
|
users.splice(users.indexOf(user), 1);
|
||||||
|
@ -571,10 +574,6 @@ function multicollab(url) {
|
||||||
list.forEach((curr) => {
|
list.forEach((curr) => {
|
||||||
var id = curr.id;
|
var id = curr.id;
|
||||||
var name = curr.name;
|
var name = curr.name;
|
||||||
if (id === window.location.hash.substring(1)) {
|
|
||||||
openVM(url, id);
|
|
||||||
res(false);
|
|
||||||
}
|
|
||||||
vms.push(curr);
|
vms.push(curr);
|
||||||
var div = document.createElement("div");
|
var div = document.createElement("div");
|
||||||
div.classList = "col-sm-5 col-md-3";
|
div.classList = "col-sm-5 col-md-3";
|
||||||
|
@ -795,7 +794,14 @@ usernameSpan.addEventListener('click', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Load all vms
|
// Load all vms
|
||||||
config.serverAddresses.forEach(multicollab);
|
(async () => {
|
||||||
|
var p = [];
|
||||||
|
config.serverAddresses.forEach(v => p.push(multicollab(v)));
|
||||||
|
await Promise.all(p);
|
||||||
|
var vm = vms.find(v => v.id === window.location.hash.substring(1));
|
||||||
|
if (vm)
|
||||||
|
openVM(vm.url, vm.id);
|
||||||
|
})();
|
||||||
// Export some stuff
|
// Export some stuff
|
||||||
window.screenshotVM = screenshotVM;
|
window.screenshotVM = screenshotVM;
|
||||||
window.multicollab = multicollab;
|
window.multicollab = multicollab;
|
||||||
|
|
Loading…
Reference in a new issue