diff --git a/public/locales/en/common.json b/public/locales/en/common.json
index b725132a..13c63c92 100755
--- a/public/locales/en/common.json
+++ b/public/locales/en/common.json
@@ -645,5 +645,10 @@
"whatsupdocker": {
"monitoring": "Monitoring",
"updates": "Updates"
+ },
+ "calibreweb": {
+ "books": "Books",
+ "authors": "Authors",
+ "series": "Series"
}
}
diff --git a/src/utils/proxy/handlers/credentialed.js b/src/utils/proxy/handlers/credentialed.js
index 5d4b7e3b..ed6d7492 100644
--- a/src/utils/proxy/handlers/credentialed.js
+++ b/src/utils/proxy/handlers/credentialed.js
@@ -35,9 +35,8 @@ export default async function credentialedProxyHandler(req, res, map) {
"tailscale",
"truenas",
"pterodactyl",
- ].includes(widget.type))
- {
- headers.Authorization = `Bearer ${widget.key}`;
+ ].includes(widget.type)) {
+ headers.Authorization = `Bearer ${widget.key}`;
} else if (widget.type === "proxmox") {
headers.Authorization = `PVEAPIToken=${widget.username}=${widget.password}`;
} else if (widget.type === "proxmoxbackupserver") {
@@ -55,6 +54,8 @@ export default async function credentialedProxyHandler(req, res, map) {
} else {
headers.Authorization = `Basic ${Buffer.from(`${widget.username}:${widget.password}`).toString("base64")}`;
}
+ } else if (widget.type === "calibreweb") {
+ headers["X-Authenticated-User"] = widget.username;
} else {
headers["X-API-Key"] = `${widget.key}`;
}
diff --git a/src/widgets/calibreweb/component.jsx b/src/widgets/calibreweb/component.jsx
new file mode 100644
index 00000000..7b98779d
--- /dev/null
+++ b/src/widgets/calibreweb/component.jsx
@@ -0,0 +1,37 @@
+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: booksData, error: booksError } = useWidgetAPI(widget, "books");
+ const { data: authorsData, error: authorsError } = useWidgetAPI(widget, "authors");
+ const { data: seriesData, error: seriesError } = useWidgetAPI(widget, "series");
+
+ if (booksError || authorsError || seriesError) {
+ const finalError = booksError ?? authorsError ?? seriesError;
+ return ;
+ }
+
+ if (!booksData || !authorsData || !seriesData) {
+ return (
+
+
+
+
+
+ );
+ }
+
+ return (
+
+
+
+
+
+ );
+}
diff --git a/src/widgets/calibreweb/widget.js b/src/widgets/calibreweb/widget.js
new file mode 100644
index 00000000..ba0dafc2
--- /dev/null
+++ b/src/widgets/calibreweb/widget.js
@@ -0,0 +1,20 @@
+import credentialedProxyHandler from "utils/proxy/handlers/credentialed";
+
+const widget = {
+ api: "{url}/{endpoint}",
+ proxyHandler: credentialedProxyHandler,
+
+ mappings: {
+ books: {
+ endpoint: "ajax/listbooks",
+ },
+ authors: {
+ endpoint: "get_authors_json",
+ },
+ series: {
+ endpoint: "get_series_json",
+ },
+ },
+};
+
+export default widget;
diff --git a/src/widgets/components.js b/src/widgets/components.js
index 589a93ad..61b35c13 100644
--- a/src/widgets/components.js
+++ b/src/widgets/components.js
@@ -7,6 +7,7 @@ const components = {
autobrr: dynamic(() => import("./autobrr/component")),
bazarr: dynamic(() => import("./bazarr/component")),
caddy: dynamic(() => import("./caddy/component")),
+ calibreweb: dynamic(() => import("./calibreweb/component")),
changedetectionio: dynamic(() => import("./changedetectionio/component")),
channelsdvrserver: dynamic(() => import("./channelsdvrserver/component")),
cloudflared: dynamic(() => import("./cloudflared/component")),
diff --git a/src/widgets/widgets.js b/src/widgets/widgets.js
index f843a168..e1f4c6e4 100644
--- a/src/widgets/widgets.js
+++ b/src/widgets/widgets.js
@@ -4,6 +4,7 @@ import authentik from "./authentik/widget";
import autobrr from "./autobrr/widget";
import bazarr from "./bazarr/widget";
import caddy from "./caddy/widget";
+import calibreweb from "./calibreweb/widget";
import changedetectionio from "./changedetectionio/widget";
import channelsdvrserver from "./channelsdvrserver/widget";
import cloudflared from "./cloudflared/widget";
@@ -91,6 +92,7 @@ const widgets = {
autobrr,
bazarr,
caddy,
+ calibreweb,
changedetectionio,
channelsdvrserver,
cloudflared,