diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 53e76bd98..7ff2973c0 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -701,5 +701,11 @@ "errored": "Errors", "noRecent": "Out of Date", "totalUsed": "Used Storage" + }, + "mealie": { + "recipes": "Recipes", + "users": "Users", + "categories": "Categories", + "tags": "Tags" } } diff --git a/src/utils/proxy/handlers/credentialed.js b/src/utils/proxy/handlers/credentialed.js index d0321cb85..9840c30a1 100644 --- a/src/utils/proxy/handlers/credentialed.js +++ b/src/utils/proxy/handlers/credentialed.js @@ -32,6 +32,7 @@ export default async function credentialedProxyHandler(req, res, map) { "authentik", "cloudflared", "ghostfolio", + "mealie", "tailscale", "truenas", "pterodactyl", diff --git a/src/widgets/components.js b/src/widgets/components.js index 0db4878c9..5cb23bba3 100644 --- a/src/widgets/components.js +++ b/src/widgets/components.js @@ -42,6 +42,7 @@ const components = { kopia: dynamic(() => import("./kopia/component")), lidarr: dynamic(() => import("./lidarr/component")), mastodon: dynamic(() => import("./mastodon/component")), + mealie: dynamic(() => import("./mealie/component")), medusa: dynamic(() => import("./medusa/component")), minecraft: dynamic(() => import("./minecraft/component")), miniflux: dynamic(() => import("./miniflux/component")), diff --git a/src/widgets/mealie/component.jsx b/src/widgets/mealie/component.jsx new file mode 100644 index 000000000..c8e88cb61 --- /dev/null +++ b/src/widgets/mealie/component.jsx @@ -0,0 +1,33 @@ +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 { widget } = service; + + const { data: mealieData, error: mealieError } = useWidgetAPI(widget); + + if (mealieError || mealieData?.statusCode === 401) { + return ; + } + + if (!mealieData) { + return ( + + + + + + + ); + } + + return ( + + + + + + + ); +} \ No newline at end of file diff --git a/src/widgets/mealie/widget.js b/src/widgets/mealie/widget.js new file mode 100644 index 000000000..b2eac1bcc --- /dev/null +++ b/src/widgets/mealie/widget.js @@ -0,0 +1,8 @@ +import credentialedProxyHandler from "utils/proxy/handlers/credentialed"; + +const widget = { + api: "{url}/api/groups/statistics", + proxyHandler: credentialedProxyHandler, +}; + +export default widget; \ No newline at end of file diff --git a/src/widgets/widgets.js b/src/widgets/widgets.js index d28f3b38c..11e1b9faa 100644 --- a/src/widgets/widgets.js +++ b/src/widgets/widgets.js @@ -36,6 +36,7 @@ import komga from "./komga/widget"; import kopia from "./kopia/widget"; import lidarr from "./lidarr/widget"; import mastodon from "./mastodon/widget"; +import mealie from "./mealie/widget"; import medusa from "./medusa/widget"; import minecraft from "./minecraft/widget"; import miniflux from "./miniflux/widget"; @@ -131,6 +132,7 @@ const widgets = { kopia, lidarr, mastodon, + mealie, medusa, minecraft, miniflux,