diff --git a/src/utils/proxy/handlers/credentialed.js b/src/utils/proxy/handlers/credentialed.js
index 9cf326f2..23e06524 100644
--- a/src/utils/proxy/handlers/credentialed.js
+++ b/src/utils/proxy/handlers/credentialed.js
@@ -19,7 +19,6 @@ 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",
@@ -47,9 +46,6 @@ 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/komga/component.jsx b/src/widgets/komga/component.jsx
index ee378e72..06d9154e 100644
--- a/src/widgets/komga/component.jsx
+++ b/src/widgets/komga/component.jsx
@@ -1,9 +1,11 @@
+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: libraryData, error: libraryError } = useWidgetAPI(widget, "libraries");
@@ -18,18 +20,18 @@ export default function Component({ service }) {
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
index d8cea850..eb43883d 100644
--- a/src/widgets/komga/widget.js
+++ b/src/widgets/komga/widget.js
@@ -1,18 +1,28 @@
-import credentialedProxyHandler from "utils/proxy/handlers/credentialed";
+import genericProxyHandler from "utils/proxy/handlers/generic";
+import { jsonArrayFilter } from "utils/proxy/api-helpers";
const widget = {
- api: "{url}/actuator/metrics/{endpoint}",
- proxyHandler: credentialedProxyHandler,
+ api: "{url}/api/v1/{endpoint}",
+ proxyHandler: genericProxyHandler,
mappings: {
- "libraries": {
- endpoint: "komga.libraries"
+ libraries: {
+ endpoint: "libraries",
+ map: (data) => ({
+ total: jsonArrayFilter(data, (item) => !item.unavailable).length,
+ }),
},
- "series": {
- endpoint: "komga.series"
+ series: {
+ endpoint: "series",
+ validate: [
+ "totalElements"
+ ]
},
- "books": {
- endpoint: "komga.books"
+ books: {
+ endpoint: "books",
+ validate: [
+ "totalElements"
+ ]
},
},
};