check if connected to vm before uploading

This commit is contained in:
Elijah 2023-12-10 14:48:02 -05:00
parent 53f065b630
commit 136b2bed4b

View file

@ -80,6 +80,10 @@ app.put("/:vm/:filename", async (req, res) => {
res.status(400);
return { success: false, result: "Filename contains disallowed characters" };
}
if (!VMs.get(vm)!.isConnectedToVM) {
res.status(503);
return { success: false, result: "Not connected to VM (make sure the agent is running)" };
}
if (IPs.has(req.ip)) {
if (!IPs.get(req.ip)!.Limit()) {
res.status(429);