From 2b27a7751c81b5adbf5745e55676bddb9aecc5f3 Mon Sep 17 00:00:00 2001 From: Arthur Lu Date: Tue, 25 Jul 2023 00:03:13 +0000 Subject: [PATCH] add cluster iso route --- src/main.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/main.js b/src/main.js index a6835fc..f7e69ed 100644 --- a/src/main.js +++ b/src/main.js @@ -1197,6 +1197,25 @@ app.delete(`/api/:node(${nodeRegexP})/:type(${typeRegexP})/:vmid(${vmidRegexP})/ await handleResponse(params.node, result, res); }); +app.get("/api/user/iso", async (req, res) => { + // check auth + const auth = await checkAuth(req.cookies, res); + if (!auth) { + return; + } + // get user iso config + const userIsoConfig = db.getGlobalConfig().useriso; + // get all isos + const isos = (await requestPVE(`/nodes/${userIsoConfig.node}/storage/${userIsoConfig.storage}/content?content=iso`, "GET", null, null, pveAPIToken)).data.data; + const userIsos = []; + isos.forEach((iso) => { + iso.name = iso.volid.replace(`${userIsoConfig.storage}:iso/`, ""); + userIsos.push(iso); + }); + userIsos.sort(); + res.status(200).send(userIsos); +}); + const server = app.listen(listenPort, () => { console.log(`proxmoxaas-api v${api.version} listening on port ${listenPort}`); });