diff --git a/docs/widgets/services/mealie.md b/docs/widgets/services/mealie.md
index b1cf117bea9..7fb335036ef 100644
--- a/docs/widgets/services/mealie.md
+++ b/docs/widgets/services/mealie.md
@@ -14,4 +14,5 @@ widget:
type: mealie
url: http://mealie-frontend.host.or.ip
key: mealieapitoken
+ version: 2 # only required if version > 1, defaults to 1
```
diff --git a/src/utils/config/service-helpers.js b/src/utils/config/service-helpers.js
index 03b4507ea23..3dde943d7c5 100644
--- a/src/utils/config/service-helpers.js
+++ b/src/utils/config/service-helpers.js
@@ -402,7 +402,7 @@ export function cleanServiceGroups(groups) {
// frigate
enableRecentEvents,
- // glances, pihole, pfsense
+ // glances, mealie, pihole, pfsense
version,
// glances
@@ -512,9 +512,6 @@ export function cleanServiceGroups(groups) {
if (type === "unifi") {
if (site) cleanedService.widget.site = site;
}
- if (type === "pfsense") {
- if (version) cleanedService.widget.version = version;
- }
if (type === "proxmox") {
if (node) cleanedService.widget.node = node;
}
@@ -561,7 +558,7 @@ export function cleanServiceGroups(groups) {
if (snapshotHost) cleanedService.widget.snapshotHost = snapshotHost;
if (snapshotPath) cleanedService.widget.snapshotPath = snapshotPath;
}
- if (["glances", "pihole"].includes(type)) {
+ if (["glances", "mealie", "pfsense", "pihole"].includes(type)) {
if (version) cleanedService.widget.version = version;
}
if (type === "glances") {
diff --git a/src/widgets/mealie/component.jsx b/src/widgets/mealie/component.jsx
index 7a42bc7d04c..a4dd1bf164f 100644
--- a/src/widgets/mealie/component.jsx
+++ b/src/widgets/mealie/component.jsx
@@ -1,17 +1,20 @@
+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 version = widget.version ?? 1;
+ const { data, error } = useWidgetAPI(widget, version === 1 ? "statisticsv1" : "statisticsv2");
- const { data: mealieData, error: mealieError } = useWidgetAPI(widget);
-
- if (mealieError || mealieData?.statusCode === 401) {
- return ;
+ if (error) {
+ return ;
}
- if (!mealieData) {
+ if (!data) {
return (
@@ -21,13 +24,12 @@ export default function Component({ service }) {
);
}
-
return (
-
-
-
-
+
+
+
+
);
}
diff --git a/src/widgets/mealie/widget.js b/src/widgets/mealie/widget.js
index 3ec8ff24d3c..8a706923915 100644
--- a/src/widgets/mealie/widget.js
+++ b/src/widgets/mealie/widget.js
@@ -1,8 +1,17 @@
import credentialedProxyHandler from "utils/proxy/handlers/credentialed";
const widget = {
- api: "{url}/api/groups/statistics",
+ api: "{url}/api/{endpoint}",
proxyHandler: credentialedProxyHandler,
+
+ mappings: {
+ statisticsv1: {
+ endpoint: "groups/statistics",
+ },
+ statisticsv2: {
+ endpoint: "households/statistics",
+ },
+ },
};
export default widget;