mirror of
https://github.com/gethomepage/homepage.git
synced 2025-12-07 09:35:54 -08:00
Update homebridge, autobrr, truenas, tubearchivist, watchtower, pyload widgets
This commit is contained in:
@@ -12,8 +12,9 @@ export default function Component({ service }) {
|
||||
|
||||
const { data: watchData, error: watchError } = useWidgetAPI(widget, "watchtower");
|
||||
|
||||
if (watchError || !watchData) {
|
||||
return <Container error={t("widget.api_error")} />;
|
||||
if (watchError || watchData?.error) {
|
||||
const finalError = watchError ?? watchData?.error;
|
||||
return <Container error={finalError} />;
|
||||
}
|
||||
|
||||
if (!watchData) {
|
||||
|
||||
@@ -33,15 +33,16 @@ export default async function watchtowerProxyHandler(req, res) {
|
||||
|
||||
if (status !== 200 || !data) {
|
||||
logger.error("Error getting data from WatchTower: %d. Data: %s", status, data);
|
||||
return res.status(status).json({error: {message: `HTTP Error ${status}`, url, data}});
|
||||
}
|
||||
|
||||
const cleanData = data.toString().split("\n").filter(s => s.startsWith("watchtower"))
|
||||
const cleanData = data.toString().split("\n").filter(s => s.startsWith("watchtower"));
|
||||
const jsonRes = {}
|
||||
|
||||
cleanData.map(e => e.split(" ")).forEach(strArray => {
|
||||
const [key, value] = strArray
|
||||
jsonRes[key] = value
|
||||
})
|
||||
});
|
||||
|
||||
if (contentType) res.setHeader("Content-Type", contentType);
|
||||
return res.status(status).send(jsonRes);
|
||||
|
||||
Reference in New Issue
Block a user