From 00fe6c57a5fa24e30ad18979048e4de4721e76f1 Mon Sep 17 00:00:00 2001 From: Arthur Lu Date: Thu, 2 Feb 2023 19:34:51 +0000 Subject: [PATCH] implement POST /api/disk/move Signed-off-by: Arthur Lu --- index.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/index.js b/index.js index 52ba293..8390ff4 100644 --- a/index.js +++ b/index.js @@ -61,6 +61,22 @@ app.post("/api/disk/resize", (req, res) => { }, vmpath); }); +app.post("/api/disk/move", (req, res) => { + let vmpath = `nodes/${req.body.node}/${req.body.type}/${req.body.vmid}`; + let route = req.body.type === "qemu" ? "move_disk" : "move_volume"; + checkAuth(req.cookies, (result) => { + if (result) { + let method = "POST"; + requestPVE(`/${vmpath}/${route}`, method, req.cookies, (result) => { + res.send(result); + }, body = req.body.action, token = pveAPIToken); + } + else { + res.send({auth: result}); + } + }, vmpath); +}); + function checkAuth (cookies, callback, vmpath = null) { if (vmpath) { requestPVE(`/${vmpath}/config`, "GET", cookies, (result) => {