mirror of
https://github.com/karl0ss/homepage.git
synced 2025-05-03 14:03:40 +01:00
commit
5e1479b7e5
@ -59,39 +59,19 @@ export default async function JDRssProxyHandler(req, res) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
logger.debug("Getting data from JDRss API");
|
logger.debug("Getting data from JDRss API");
|
||||||
// Calculate the number of Tracked Shows
|
// Get data from JDRss stats API
|
||||||
let [status, apiData] = await fetchDataFromJDRss('shows', widget);
|
const [status, apiData] = await fetchDataFromJDRss('stats', widget);
|
||||||
|
|
||||||
if (status !== 200) {
|
if (status !== 200) {
|
||||||
return res.status(status).json({ error: { message: "HTTP error communicating with WGeasy API", data: Buffer.from(apiData).toString() } });
|
return res.status(status).json({ error: { message: "HTTP error communicating with JDRss API", data: Buffer.from(apiData).toString() } });
|
||||||
}
|
}
|
||||||
let showCount = 0;
|
|
||||||
showCount = apiData.length;
|
|
||||||
|
|
||||||
// Calculate the number of items in the retry cache
|
|
||||||
[status, apiData] = await fetchDataFromJDRss('retryCache', widget);
|
|
||||||
if (status !== 200) {
|
|
||||||
return res.status(status).json({ error: { message: "HTTP error communicating with WGeasy API", data: Buffer.from(apiData).toString() } });
|
|
||||||
}
|
|
||||||
let retryCache = 0;
|
|
||||||
retryCache = apiData.length;
|
|
||||||
|
|
||||||
// Calculate the number of items in the feed cache
|
|
||||||
[status, apiData] = await fetchDataFromJDRss('feedCache', widget);
|
|
||||||
if (status !== 200) {
|
|
||||||
return res.status(status).json({ error: { message: "HTTP error communicating with WGeasy API", data: Buffer.from(apiData).toString() } });
|
|
||||||
}
|
|
||||||
let feedCache = 0;
|
|
||||||
feedCache = apiData.length;
|
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
showCount,
|
showCount:apiData.ShowList ,
|
||||||
retryCache,
|
retryCache:apiData.RetryCache,
|
||||||
feedCache
|
feedCache: apiData.FeedCache
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return res.status(status).send(data);
|
return res.status(status).send(data);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user