add unit return to resources path
This commit is contained in:
parent
09ee11055f
commit
c5448ca727
3
main.js
3
main.js
@ -8,7 +8,7 @@ var api = require("./package.json");
|
|||||||
|
|
||||||
const {pveAPIToken, listenPort, domain} = require("./vars.js");
|
const {pveAPIToken, listenPort, domain} = require("./vars.js");
|
||||||
const {checkAuth, requestPVE, handleResponse, getUsedResources, getDiskInfo} = require("./pveutils.js");
|
const {checkAuth, requestPVE, handleResponse, getUsedResources, getDiskInfo} = require("./pveutils.js");
|
||||||
const {init, getResourceMeta, getUser, approveResources, setUsedResources} = require("./db.js");
|
const {init, getResourceMeta, getUser, approveResources, setUsedResources, getResourceUnits} = require("./db.js");
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
app.use(helmet());
|
app.use(helmet());
|
||||||
@ -49,6 +49,7 @@ app.get("/api/user/resources", async(req, res) => {
|
|||||||
let used = await getUsedResources(req, getResourceMeta());
|
let used = await getUsedResources(req, getResourceMeta());
|
||||||
setUsedResources(req.cookies.username, used);
|
setUsedResources(req.cookies.username, used);
|
||||||
let user = await getUser(req.cookies.username);
|
let user = await getUser(req.cookies.username);
|
||||||
|
user.units = getResourceUnits();
|
||||||
res.status(200).send(user);
|
res.status(200).send(user);
|
||||||
res.end();
|
res.end();
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user