Add widget for Atsumeru self-hosted media server (#1839)
* Add widget for Atsumeru self-hosted media server * Revert localization * Update widget.js --------- Co-authored-by: shamoon <4887959+shamoon@users.noreply.github.com>
This commit is contained in:
parent
7bd433922f
commit
a6dac34b24
5 changed files with 59 additions and 0 deletions
|
@ -579,6 +579,12 @@
|
||||||
"incident": "Incident",
|
"incident": "Incident",
|
||||||
"m": "m"
|
"m": "m"
|
||||||
},
|
},
|
||||||
|
"atsumeru": {
|
||||||
|
"series": "Series",
|
||||||
|
"archives": "Archives",
|
||||||
|
"chapters": "Chapters",
|
||||||
|
"categories": "Categories"
|
||||||
|
},
|
||||||
"komga": {
|
"komga": {
|
||||||
"libraries": "Libraries",
|
"libraries": "Libraries",
|
||||||
"series": "Series",
|
"series": "Series",
|
||||||
|
|
36
src/widgets/atsumeru/component.jsx
Normal file
36
src/widgets/atsumeru/component.jsx
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
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: infoData, error: infoError } = useWidgetAPI(widget, "info");
|
||||||
|
|
||||||
|
if (infoError) {
|
||||||
|
return <Container service={service} error={infoError} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!infoData) {
|
||||||
|
return (
|
||||||
|
<Container service={service}>
|
||||||
|
<Block label="atsumeru.series" />
|
||||||
|
<Block label="atsumeru.archives" />
|
||||||
|
<Block label="atsumeru.chapters" />
|
||||||
|
<Block label="atsumeru.categories" />
|
||||||
|
</Container>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Container service={service}>
|
||||||
|
<Block label="atsumeru.series" value={t("common.number", { value: infoData.stats.total_series })} />
|
||||||
|
<Block label="atsumeru.archives" value={t("common.number", { value: infoData.stats.total_archives })} />
|
||||||
|
<Block label="atsumeru.chapters" value={t("common.number", { value: infoData.stats.total_chapters })} />
|
||||||
|
<Block label="atsumeru.categories" value={t("common.number", { value: infoData.stats.total_categories })} />
|
||||||
|
</Container>
|
||||||
|
);
|
||||||
|
}
|
14
src/widgets/atsumeru/widget.js
Normal file
14
src/widgets/atsumeru/widget.js
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
import genericProxyHandler from "utils/proxy/handlers/generic";
|
||||||
|
|
||||||
|
const widget = {
|
||||||
|
api: "{url}/api/server/{endpoint}",
|
||||||
|
proxyHandler: genericProxyHandler,
|
||||||
|
|
||||||
|
mappings: {
|
||||||
|
info: {
|
||||||
|
endpoint: "info"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default widget;
|
|
@ -2,6 +2,7 @@ import dynamic from "next/dynamic";
|
||||||
|
|
||||||
const components = {
|
const components = {
|
||||||
adguard: dynamic(() => import("./adguard/component")),
|
adguard: dynamic(() => import("./adguard/component")),
|
||||||
|
atsumeru: dynamic(() => import("./atsumeru/component")),
|
||||||
audiobookshelf: dynamic(() => import("./audiobookshelf/component")),
|
audiobookshelf: dynamic(() => import("./audiobookshelf/component")),
|
||||||
authentik: dynamic(() => import("./authentik/component")),
|
authentik: dynamic(() => import("./authentik/component")),
|
||||||
autobrr: dynamic(() => import("./autobrr/component")),
|
autobrr: dynamic(() => import("./autobrr/component")),
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import adguard from "./adguard/widget";
|
import adguard from "./adguard/widget";
|
||||||
|
import atsumeru from "./atsumeru/widget";
|
||||||
import audiobookshelf from "./audiobookshelf/widget";
|
import audiobookshelf from "./audiobookshelf/widget";
|
||||||
import authentik from "./authentik/widget";
|
import authentik from "./authentik/widget";
|
||||||
import autobrr from "./autobrr/widget";
|
import autobrr from "./autobrr/widget";
|
||||||
|
@ -96,6 +97,7 @@ import urbackup from "./urbackup/widget";
|
||||||
|
|
||||||
const widgets = {
|
const widgets = {
|
||||||
adguard,
|
adguard,
|
||||||
|
atsumeru,
|
||||||
audiobookshelf,
|
audiobookshelf,
|
||||||
authentik,
|
authentik,
|
||||||
autobrr,
|
autobrr,
|
||||||
|
|
Loading…
Add table
Reference in a new issue