add perm settings for guest voting
i'm mad that this wasn't thought about
This commit is contained in:
@@ -21,6 +21,8 @@ secretKey = "hunter2"
|
|||||||
[auth.guestPermissions]
|
[auth.guestPermissions]
|
||||||
chat = true
|
chat = true
|
||||||
turn = false
|
turn = false
|
||||||
|
callForReset = false
|
||||||
|
vote = true
|
||||||
|
|
||||||
[vm]
|
[vm]
|
||||||
qemuArgs = "qemu-system-x86_64"
|
qemuArgs = "qemu-system-x86_64"
|
||||||
|
|||||||
@@ -452,6 +452,10 @@ export default class WSServer {
|
|||||||
switch (msgArr[1]) {
|
switch (msgArr[1]) {
|
||||||
case "1":
|
case "1":
|
||||||
if (!this.voteInProgress) {
|
if (!this.voteInProgress) {
|
||||||
|
if (this.Config.auth.enabled && client.rank === Rank.Unregistered && !this.Config.auth.guestPermissions.callForReset) {
|
||||||
|
client.sendMsg(guacutils.encode("chat", "", "You need to login to do that."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (this.voteCooldown !== 0) {
|
if (this.voteCooldown !== 0) {
|
||||||
client.sendMsg(guacutils.encode("vote", "3", this.voteCooldown.toString()));
|
client.sendMsg(guacutils.encode("vote", "3", this.voteCooldown.toString()));
|
||||||
return;
|
return;
|
||||||
@@ -459,12 +463,20 @@ export default class WSServer {
|
|||||||
this.startVote();
|
this.startVote();
|
||||||
this.clients.forEach(c => c.sendMsg(guacutils.encode("chat", "", `${client.username} has started a vote to reset the VM.`)));
|
this.clients.forEach(c => c.sendMsg(guacutils.encode("chat", "", `${client.username} has started a vote to reset the VM.`)));
|
||||||
}
|
}
|
||||||
|
if (this.Config.auth.enabled && client.rank === Rank.Unregistered && !this.Config.auth.guestPermissions.vote) {
|
||||||
|
client.sendMsg(guacutils.encode("chat", "", "You need to login to do that."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
else if (client.IP.vote !== true)
|
else if (client.IP.vote !== true)
|
||||||
this.clients.forEach(c => c.sendMsg(guacutils.encode("chat", "", `${client.username} has voted yes.`)));
|
this.clients.forEach(c => c.sendMsg(guacutils.encode("chat", "", `${client.username} has voted yes.`)));
|
||||||
client.IP.vote = true;
|
client.IP.vote = true;
|
||||||
break;
|
break;
|
||||||
case "0":
|
case "0":
|
||||||
if (!this.voteInProgress) return;
|
if (!this.voteInProgress) return;
|
||||||
|
if (this.Config.auth.enabled && client.rank === Rank.Unregistered && !this.Config.auth.guestPermissions.vote) {
|
||||||
|
client.sendMsg(guacutils.encode("chat", "", "You need to login to do that."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (client.IP.vote !== false)
|
if (client.IP.vote !== false)
|
||||||
this.clients.forEach(c => c.sendMsg(guacutils.encode("chat", "", `${client.username} has voted no.`)));
|
this.clients.forEach(c => c.sendMsg(guacutils.encode("chat", "", `${client.username} has voted no.`)));
|
||||||
client.IP.vote = false;
|
client.IP.vote = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user