diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 9724db9da..ec5c39fd9 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -16,10 +16,10 @@ "status": "Status" }, "weather": { - "current": "Current Location", - "allow": "Click to allow", - "updating": "Updating", - "wait": "Please wait" + "current": "Current Location", + "allow": "Click to allow", + "updating": "Updating", + "wait": "Please wait" }, "search": { "placeholder": "Search…" @@ -60,6 +60,10 @@ "bitrate": "Bitrate", "no_active": "No Active Streams" }, + "changedetectionio": { + "totalObserved": "Total Observed", + "diffsDetected": "Diffs Detected" + }, "tautulli": { "playing": "Playing", "transcoding": "Transcoding", @@ -134,9 +138,9 @@ "available": "Available" }, "overseerr": { - "pending": "Pending", - "approved": "Approved", - "available": "Available" + "pending": "Pending", + "approved": "Approved", + "available": "Available" }, "pihole": { "queries": "Queries", @@ -144,10 +148,10 @@ "gravity": "Gravity" }, "adguard": { - "queries": "Queries", - "blocked": "Blocked", - "filtered": "Filtered", - "latency": "Latency" + "queries": "Queries", + "blocked": "Blocked", + "filtered": "Filtered", + "latency": "Latency" }, "speedtest": { "upload": "Upload", @@ -181,7 +185,7 @@ "clients": "Clients", "messages": "Messages" }, - "prowlarr":{ + "prowlarr": { "enableIndexers": "Indexers", "numberOfGrabs": "Grabs", "numberOfQueries": "Queries", diff --git a/src/widgets/changedetectionio/component.jsx b/src/widgets/changedetectionio/component.jsx new file mode 100644 index 000000000..70936489f --- /dev/null +++ b/src/widgets/changedetectionio/component.jsx @@ -0,0 +1,33 @@ +import { useTranslation } from "next-i18next"; + +import Container from "components/services/widget/container"; +import Block from "components/services/widget/block"; +import useWidgetAPI from "utils/proxy/use-widget-api"; + +export default function Component({ service }) { + const { t } = useTranslation(); + + const { widget } = service; + + const { data } = useWidgetAPI(widget, "info"); + + if (!data) { + return ; + } + + const totalObserved = Object.keys(data).length; + let diffsDetected = 0; + + Object.keys(data).forEach((key) => { + if (data[key].last_checked === data[key].last_changed) { + diffsDetected += 1; + } + }); + + return ( + + + + + ); +} diff --git a/src/widgets/changedetectionio/widget.js b/src/widgets/changedetectionio/widget.js new file mode 100644 index 000000000..ed1153527 --- /dev/null +++ b/src/widgets/changedetectionio/widget.js @@ -0,0 +1,15 @@ +import credentialedProxyHandler from "utils/proxy/handlers/credentialed"; + +const widget = { + api: "{url}/api/v1/{endpoint}", + proxyHandler: credentialedProxyHandler, + + mappings: { + info: { + method: "GET", + endpoint: "watch", + }, + }, +}; + +export default widget; diff --git a/src/widgets/components.js b/src/widgets/components.js index f6e075d8a..da6ce362d 100644 --- a/src/widgets/components.js +++ b/src/widgets/components.js @@ -4,6 +4,7 @@ const components = { adguard: dynamic(() => import("./adguard/component")), authentik: dynamic(() => import("./authentik/component")), bazarr: dynamic(() => import("./bazarr/component")), + changedetectionio: dynamic(() => import("./changedetectionio/component")), coinmarketcap: dynamic(() => import("./coinmarketcap/component")), docker: dynamic(() => import("./docker/component")), emby: dynamic(() => import("./emby/component")), diff --git a/src/widgets/widgets.js b/src/widgets/widgets.js index cd7f5b19a..a90bd6202 100644 --- a/src/widgets/widgets.js +++ b/src/widgets/widgets.js @@ -1,6 +1,7 @@ import adguard from "./adguard/widget"; import authentik from "./authentik/widget"; import bazarr from "./bazarr/widget"; +import changedetectionio from "./changedetectionio/widget"; import coinmarketcap from "./coinmarketcap/widget"; import emby from "./emby/widget"; import gotify from "./gotify/widget"; @@ -34,6 +35,7 @@ const widgets = { adguard, authentik, bazarr, + changedetectionio, coinmarketcap, emby, gotify, @@ -63,7 +65,7 @@ const widgets = { traefik, transmission, unifi, - unifi_console: unifi + unifi_console: unifi, }; export default widgets;