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 c06a15c3bb
commit ce8a4f29fa

View File

@ -32,12 +32,18 @@ app.get("/api/auth", async (req, res) => {
res.send({auth: result}); 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", ""); path = req.url.replace("/api/proxmox", "");
let result = await requestPVE(path, "GET", req.cookies); let result = await requestPVE(path, "GET", req.cookies);
res.send(result.data, result.status); 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) => { app.post("/api/disk/detach", async (req, res) => {
let vmpath = `/nodes/${req.body.node}/${req.body.type}/${req.body.vmid}`; let vmpath = `/nodes/${req.body.node}/${req.body.type}/${req.body.vmid}`;