mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2026-01-29 22:00:52 +03:00
Added days saved stat.
This commit is contained in:
14
index.js
14
index.js
@@ -501,6 +501,18 @@ app.get('/api/getTotalStats', function (req, res) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//send out a formatted time saved total
|
||||||
|
app.get('/api/getDaysSavedFormatted', function (req, res) {
|
||||||
|
db.prepare("SELECT SUM((endTime - startTime) / 60 / 60 / 24 * views) as daysSaved FROM sponsorTimes").get(function(err, row) {
|
||||||
|
if (row != null) {
|
||||||
|
//send this result
|
||||||
|
res.send({
|
||||||
|
daysSaved: row.daysSaved.toFixed(2)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
app.get('/database.db', function (req, res) {
|
app.get('/database.db', function (req, res) {
|
||||||
res.sendFile("./databases/sponsorTimes.db", { root: __dirname });
|
res.sendFile("./databases/sponsorTimes.db", { root: __dirname });
|
||||||
});
|
});
|
||||||
@@ -704,4 +716,4 @@ function getHash(value, times=5000) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user