Add api endpoint for stats #6

Merged
tgpholly merged 3 commits from add-stats-api into master 2020-02-20 08:03:10 +00:00
Showing only changes of commit 38d532d58c - Show all commits

3
EUS.js
View file

@ -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));
}); });
} }