mirror of
https://github.com/karl0ss/JDRssDownloader.git
synced 2025-04-27 20:03:40 +01:00
add stats api for homepage widget
This commit is contained in:
parent
f0a949aacb
commit
84180b066e
28
routes/api.js
Normal file
28
routes/api.js
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
const fs = require("fs");
|
||||||
|
const { nextLinkCheck, nextRssRefresh, get_last_downloaded } = require('.././utils')
|
||||||
|
|
||||||
|
|
||||||
|
module.exports = function (app) {
|
||||||
|
app.get("/api/stats", (req, res) => {
|
||||||
|
retryCache = JSON.parse(fs.readFileSync('./cache/retryCache.json'))
|
||||||
|
for (let index = 0; index < retryCache.length; index++) {
|
||||||
|
const item = retryCache[index];
|
||||||
|
retryCache[index].newtitle = item.title.replace(/ /g, "‡");
|
||||||
|
}
|
||||||
|
showList = JSON.parse(fs.readFileSync('shows.json'));
|
||||||
|
feedCache = JSON.parse(fs.readFileSync('./cache/feedCache.json'));
|
||||||
|
rssTime = nextRssRefresh()
|
||||||
|
linkCheck = nextLinkCheck()
|
||||||
|
lastDownloaded = get_last_downloaded()
|
||||||
|
|
||||||
|
res.json({
|
||||||
|
"ShowList": showList.length,
|
||||||
|
"FeedCache": feedCache.length,
|
||||||
|
"RetryCache": retryCache.length,
|
||||||
|
"RSSCheck": rssTime,
|
||||||
|
"LinkChecker": linkCheck,
|
||||||
|
"LastDownloaded": lastDownloaded
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user