Add api endpoint for stats #6
1 changed files with 3 additions and 0 deletions
3
EUS.js
3
EUS.js
|
@ -86,6 +86,7 @@ module.exports = {
|
||||||
spaceaa = req.query["s"];
|
spaceaa = req.query["s"];
|
||||||
let jsonaa = {};
|
let jsonaa = {};
|
||||||
if (filesaa == 1) {
|
if (filesaa == 1) {
|
||||||
|
let total = 0;
|
||||||
jsonaa["files"] = {};
|
jsonaa["files"] = {};
|
||||||
for (var i2 = 0; i2 < eusConfig.acceptedTypes.length; i2++) {
|
for (var i2 = 0; i2 < eusConfig.acceptedTypes.length; i2++) {
|
||||||
jsonaa["files"][`${eusConfig.acceptedTypes[i2]}`.replace(".", "")] = 0;
|
jsonaa["files"][`${eusConfig.acceptedTypes[i2]}`.replace(".", "")] = 0;
|
||||||
|
@ -97,9 +98,11 @@ module.exports = {
|
||||||
const jsudfg = files[i].split(".");
|
const jsudfg = files[i].split(".");
|
||||||
if (`.${jsudfg[jsudfg.length-1]}` == eusConfig.acceptedTypes[i1]) {
|
if (`.${jsudfg[jsudfg.length-1]}` == eusConfig.acceptedTypes[i1]) {
|
||||||
jsonaa["files"][eusConfig.acceptedTypes[i1].replace(".", "")]++;
|
jsonaa["files"][eusConfig.acceptedTypes[i1].replace(".", "")]++;
|
||||||
|
total++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
jsonaa["files"]["total"] = total;
|
||||||
if (spaceaa != 1) return res.end(JSON.stringify(jsonaa));
|
if (spaceaa != 1) return res.end(JSON.stringify(jsonaa));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue