Merge branch 'master' of github.com:computernewb/collab-vm-1.2-webapp into captcha
This commit is contained in:
commit
a40199dda0
1 changed files with 12 additions and 6 deletions
18
src/index.js
18
src/index.js
|
@ -186,6 +186,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];
|
||||||
|
@ -202,12 +203,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);
|
||||||
|
@ -579,10 +582,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";
|
||||||
|
@ -808,11 +807,18 @@ 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;
|
||||||
window.getPerms = () => perms;
|
window.getPerms = () => perms;
|
||||||
window.getRank = () => rank;
|
window.getRank = () => rank;
|
||||||
window.GetAdmin = () => vm.admin;
|
window.GetAdmin = () => vm.admin;
|
||||||
window.cvmEvents = createNanoEvents();
|
window.cvmEvents = createNanoEvents();
|
||||||
|
|
Loading…
Reference in a new issue