diff --git a/public/locales/en/common.json b/public/locales/en/common.json
index 52db2cb4..daadcd09 100644
--- a/public/locales/en/common.json
+++ b/public/locales/en/common.json
@@ -447,5 +447,11 @@
"photos": "Photos",
"videos": "Videos",
"storage": "Storage"
+ },
+ "komga": {
+ "users": "Users",
+ "libraries": "Libraries",
+ "series": "Series",
+ "books": "Books"
}
}
diff --git a/src/utils/proxy/handlers/credentialed.js b/src/utils/proxy/handlers/credentialed.js
index 23e06524..9cf326f2 100644
--- a/src/utils/proxy/handlers/credentialed.js
+++ b/src/utils/proxy/handlers/credentialed.js
@@ -19,6 +19,7 @@ export default async function credentialedProxyHandler(req, res, map) {
if (widget) {
const url = new URL(formatApiCall(widgets[widget.type].api, { endpoint, ...widget }));
+ const version = process.env.NEXT_PUBLIC_VERSION?.length ? process.env.NEXT_PUBLIC_VERSION : "dev";
const headers = {
"Content-Type": "application/json",
@@ -46,6 +47,9 @@ export default async function credentialedProxyHandler(req, res, map) {
} else if (widget.type === "cloudflared") {
headers["X-Auth-Email"] = `${widget.email}`;
headers["X-Auth-Key"] = `${widget.key}`;
+ } else if (widget.type === "komga") {
+ headers.Authorization = `Basic ${Buffer.from(`${widget.username}:${widget.password}`).toString("base64")}`
+ headers["User-Agent"] = `HomepageRuntime/${version} `
} else {
headers["X-API-Key"] = `${widget.key}`;
}
diff --git a/src/widgets/components.js b/src/widgets/components.js
index 43a46fa9..91b27773 100644
--- a/src/widgets/components.js
+++ b/src/widgets/components.js
@@ -21,6 +21,7 @@ const components = {
jackett: dynamic(() => import("./jackett/component")),
jellyfin: dynamic(() => import("./emby/component")),
jellyseerr: dynamic(() => import("./jellyseerr/component")),
+ komga: dynamic(() => import("./komga/component")),
lidarr: dynamic(() => import("./lidarr/component")),
mastodon: dynamic(() => import("./mastodon/component")),
medusa: dynamic(() => import("./medusa/component")),
diff --git a/src/widgets/komga/component.jsx b/src/widgets/komga/component.jsx
new file mode 100644
index 00000000..2ab2e1ff
--- /dev/null
+++ b/src/widgets/komga/component.jsx
@@ -0,0 +1,35 @@
+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: libraryData, error: libraryError } = useWidgetAPI(widget, "komga.libraries");
+ const { data: seriesData, error: seriesError } = useWidgetAPI(widget, "komga.series");
+ const { data: bookData, error: bookError } = useWidgetAPI(widget, "komga.books");
+
+ if (libraryError || seriesError || bookError) {
+ const finalError = libraryError ?? seriesError ?? bookError;
+ return ;
+ }
+
+ if (!libraryError || !seriesError || !bookError) {
+ return (
+
+
+
+
+
+ );
+ }
+
+ return (
+
+
+
+
+
+ );
+}
\ No newline at end of file
diff --git a/src/widgets/komga/widget.js b/src/widgets/komga/widget.js
new file mode 100644
index 00000000..54e02325
--- /dev/null
+++ b/src/widgets/komga/widget.js
@@ -0,0 +1,20 @@
+import credentialedProxyHandler from "utils/proxy/handlers/credentialed";
+
+const widget = {
+ api: "{url}/actuator/metrics/{endpoint}",
+ proxyHandler: credentialedProxyHandler,
+
+ mappings: {
+ "komga.libraries": {
+ endpoint: "komga.libraries"
+ },
+ "komga.series": {
+ endpoint: "komga.series"
+ },
+ "komga.books": {
+ endpoint: "komga.books"
+ },
+ },
+};
+
+export default widget;
\ No newline at end of file
diff --git a/src/widgets/widgets.js b/src/widgets/widgets.js
index 133903fb..d99a69da 100644
--- a/src/widgets/widgets.js
+++ b/src/widgets/widgets.js
@@ -15,6 +15,7 @@ import hdhomerun from "./hdhomerun/widget";
import homebridge from "./homebridge/widget";
import jackett from "./jackett/widget";
import jellyseerr from "./jellyseerr/widget";
+import komga from "./komga/widget";
import lidarr from "./lidarr/widget";
import mastodon from "./mastodon/widget";
import medusa from "./medusa/widget";
@@ -78,6 +79,7 @@ const widgets = {
jackett,
jellyfin: emby,
jellyseerr,
+ komga,
lidarr,
mastodon,
medusa,