add post proxmox proxy endpoint

Signed-off-by: Arthur Lu <learthurgo@gmail.com>
This commit is contained in:
Arthur Lu 2023-02-24 22:21:21 +00:00
parent 6f2592dcca
commit ec929d5f90

View File

@ -32,12 +32,18 @@ app.get("/api/auth", async (req, res) => {
res.send({auth: result});
});
app.get("/api/proxmox/*", async (req, res) => { // proxy endpoint for proxmox api with no token
app.get("/api/proxmox/*", async (req, res) => { // proxy endpoint for GET proxmox api with no token
path = req.url.replace("/api/proxmox", "");
let result = await requestPVE(path, "GET", req.cookies);
res.send(result.data, result.status);
});
app.post("/api/proxmox/*", async (req, res) => { // proxy endpoint for POST proxmox api with no token
path = req.url.replace("/api/proxmox", "");
let result = await requestPVE(path, "POST", req.cookies, req.body);
res.send(result.data, result.status);
});
app.post("/api/disk/detach", async (req, res) => {
let vmpath = `/nodes/${req.body.node}/${req.body.type}/${req.body.vmid}`;