Add qemu monitor (and fix some atrocious indenting)
This commit is contained in:
parent
9677ce9886
commit
08ca372cf9
3 changed files with 48 additions and 4 deletions
24
dist/index.html
vendored
24
dist/index.html
vendored
|
@ -10,6 +10,23 @@
|
||||||
<link rel="icon" href="favicon.ico">
|
<link rel="icon" href="favicon.ico">
|
||||||
</head>
|
</head>
|
||||||
<body class="bg-dark">
|
<body class="bg-dark">
|
||||||
|
<div class="modal fade" id="qemuMonitorModal" tabindex="-1" aria-hidden="true">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content bg-dark text-light">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title">QEMU Monitor</h5>
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<textarea id="qemuMonitorOutput" readonly="" class="form-control bg-dark text-light"></textarea>
|
||||||
|
<div class="input-group">
|
||||||
|
<input type="text" id="qemuMonitorInput" class="form-control bg-dark text-light" placeholder="Command"/>
|
||||||
|
<button class="btn btn-outline-secondary btn-primary text-light" type="button" id="qemuMonitorSendBtn">Send</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
|
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<a class="navbar-brand" href="#">CollabVM</a>
|
<a class="navbar-brand" href="#">CollabVM</a>
|
||||||
|
@ -27,13 +44,13 @@
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="https://computernewb.com/collab-vm/rules" class="nav-link">Rules</a>
|
<a href="https://computernewb.com/collab-vm/rules" class="nav-link">Rules</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="https://discord.gg/a4kqb4mGyX" class="nav-link">Discord</a>
|
<a href="https://discord.gg/a4kqb4mGyX" class="nav-link">Discord</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="https://reddit.com/r/collabvm" class="nav-link">Subreddit</a>
|
<a href="https://reddit.com/r/collabvm" class="nav-link">Subreddit</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="https://computernewb.com/collab-vm/user-vm" class="nav-link">UserVM</a>
|
<a href="https://computernewb.com/collab-vm/user-vm" class="nav-link">UserVM</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -62,6 +79,7 @@
|
||||||
<button class="btn btn-secondary" id="clearQueueBtn">Clear Turn Queue</button>
|
<button class="btn btn-secondary" id="clearQueueBtn">Clear Turn Queue</button>
|
||||||
<button class="btn btn-secondary" id="bypassTurnBtn">Bypass Turn</button>
|
<button class="btn btn-secondary" id="bypassTurnBtn">Bypass Turn</button>
|
||||||
<button class="btn btn-secondary" id="endTurnBtn">End Turn</button>
|
<button class="btn btn-secondary" id="endTurnBtn">End Turn</button>
|
||||||
|
<button class="btn btn-secondary" id="qemuMonitorBtn" data-bs-toggle="modal" data-bs-target="#qemuMonitorModal">QEMU Monitor</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
5
dist/style.css
vendored
5
dist/style.css
vendored
|
@ -70,6 +70,11 @@
|
||||||
#staffbtns {
|
#staffbtns {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
#staffbtns > button {
|
#staffbtns > button {
|
||||||
display: none;
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#qemuMonitorOutput {
|
||||||
|
height: 180px;
|
||||||
}
|
}
|
23
src/index.js
23
src/index.js
|
@ -23,6 +23,8 @@ const buttons = {
|
||||||
clearQueue: window.document.getElementById("clearQueueBtn"),
|
clearQueue: window.document.getElementById("clearQueueBtn"),
|
||||||
bypassTurn: window.document.getElementById("bypassTurnBtn"),
|
bypassTurn: window.document.getElementById("bypassTurnBtn"),
|
||||||
endTurn: window.document.getElementById("endTurnBtn"),
|
endTurn: window.document.getElementById("endTurnBtn"),
|
||||||
|
qemuMonitor: window.document.getElementById("qemuMonitorBtn"),
|
||||||
|
qemuMonitorSend: window.document.getElementById("qemuMonitorSendBtn"),
|
||||||
}
|
}
|
||||||
var hasTurn = false;
|
var hasTurn = false;
|
||||||
var vm;
|
var vm;
|
||||||
|
@ -47,6 +49,8 @@ const voteyeslabel = document.getElementById("voteYesLabel");
|
||||||
const votenolabel = document.getElementById("voteNoLabel");
|
const votenolabel = document.getElementById("voteNoLabel");
|
||||||
const votetime = document.getElementById("votetime");
|
const votetime = document.getElementById("votetime");
|
||||||
const staffbtns = document.getElementById("staffbtns");
|
const staffbtns = document.getElementById("staffbtns");
|
||||||
|
const qemuMonitorInput = document.getElementById("qemuMonitorInput");
|
||||||
|
const qemuMonitorOutput = document.getElementById("qemuMonitorOutput");
|
||||||
// needed to scroll to bottom
|
// needed to scroll to bottom
|
||||||
const chatListDiv = document.querySelector(".chat-table");
|
const chatListDiv = document.querySelector(".chat-table");
|
||||||
|
|
||||||
|
@ -325,13 +329,18 @@ class CollabVMClient {
|
||||||
buttons.clearQueue.style.display = "inline-block";
|
buttons.clearQueue.style.display = "inline-block";
|
||||||
buttons.endTurn.style.display = "inline-block";
|
buttons.endTurn.style.display = "inline-block";
|
||||||
}
|
}
|
||||||
|
if (rank === 2) buttons.qemuMonitor.style.display = "inline-block";
|
||||||
users.forEach((u) => userModOptions(u.username, u.element, u.element.children[0]));
|
users.forEach((u) => userModOptions(u.username, u.element, u.element.children[0]));
|
||||||
break;
|
break;
|
||||||
case "19":
|
case "19":
|
||||||
// Got IP
|
// Got IP
|
||||||
this.eventemitter.emit('ip', {username: msgArr[2], ip: msgArr[3]});
|
this.eventemitter.emit('ip', {username: msgArr[2], ip: msgArr[3]});
|
||||||
break;
|
break;
|
||||||
|
case "2":
|
||||||
|
// QEMU output
|
||||||
|
qemuMonitorOutput.innerHTML += `> ${msgArr[2]}\n`;
|
||||||
|
qemuMonitorOutput.scrollTop = qemuMonitorOutput.scrollHeight;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -434,6 +443,7 @@ class CollabVMClient {
|
||||||
this.socket.send(guacutils.encode(["admin", "19", user]));
|
this.socket.send(guacutils.encode(["admin", "19", user]));
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
qemuMonitor: (cmd) => this.socket.send(guacutils.encode(["admin", "5", this.node, cmd])),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function multicollab(url) {
|
function multicollab(url) {
|
||||||
|
@ -601,6 +611,17 @@ buttons.reboot.addEventListener('click', () => vm.admin.reboot());
|
||||||
buttons.clearQueue.addEventListener('click', () => vm.admin.clearQueue());
|
buttons.clearQueue.addEventListener('click', () => vm.admin.clearQueue());
|
||||||
buttons.bypassTurn.addEventListener('click', () => vm.admin.bypassTurn());
|
buttons.bypassTurn.addEventListener('click', () => vm.admin.bypassTurn());
|
||||||
buttons.endTurn.addEventListener('click', () => vm.admin.endTurn(users[0]));
|
buttons.endTurn.addEventListener('click', () => vm.admin.endTurn(users[0]));
|
||||||
|
// QEMU Monitor Shit
|
||||||
|
function sendQEMUCommand() {
|
||||||
|
if (!qemuMonitorInput.value) return;
|
||||||
|
vm.admin.qemuMonitor(qemuMonitorInput.value);
|
||||||
|
qemuMonitorInput.value = "";
|
||||||
|
}
|
||||||
|
qemuMonitorInput.addEventListener('keypress', (e) => {
|
||||||
|
if (e.key === "Enter") sendQEMUCommand();
|
||||||
|
});
|
||||||
|
buttons.qemuMonitorSend.addEventListener('click', () => sendQEMUCommand());
|
||||||
|
|
||||||
// Login
|
// Login
|
||||||
var usernameClick = false;
|
var usernameClick = false;
|
||||||
usernameSpan.addEventListener('click', () => {
|
usernameSpan.addEventListener('click', () => {
|
||||||
|
|
Loading…
Reference in a new issue