Merge pull request #631 from henry40408/feature/miniflux

Miniflux widget
pull/702/head
shamoon 2 years ago committed by GitHub
commit ee95c23c3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -246,6 +246,10 @@
"status_count": "Posts", "status_count": "Posts",
"domain_count": "Domains" "domain_count": "Domains"
}, },
"miniflux": {
"read": "Read",
"unread": "Unread"
},
"authentik": { "authentik": {
"users": "Users", "users": "Users",
"loginsLast24H": "Logins (24h)", "loginsLast24H": "Logins (24h)",
@ -379,4 +383,4 @@
"inbox": "Inbox", "inbox": "Inbox",
"total": "Total" "total": "Total"
} }
} }

@ -36,6 +36,8 @@ export default async function credentialedProxyHandler(req, res, map) {
headers["X-API-Token"] = `${widget.key}`; headers["X-API-Token"] = `${widget.key}`;
} else if (widget.type === "tubearchivist") { } else if (widget.type === "tubearchivist") {
headers.Authorization = `Token ${widget.key}`; headers.Authorization = `Token ${widget.key}`;
} else if (widget.type === "miniflux") {
headers["X-Auth-Token"] = `${widget.key}`;
} else { } else {
headers["X-API-Key"] = `${widget.key}`; headers["X-API-Key"] = `${widget.key}`;
} }

@ -21,6 +21,7 @@ const components = {
jellyseerr: dynamic(() => import("./jellyseerr/component")), jellyseerr: dynamic(() => import("./jellyseerr/component")),
lidarr: dynamic(() => import("./lidarr/component")), lidarr: dynamic(() => import("./lidarr/component")),
mastodon: dynamic(() => import("./mastodon/component")), mastodon: dynamic(() => import("./mastodon/component")),
miniflux: dynamic(() => import("./miniflux/component")),
navidrome: dynamic(() => import("./navidrome/component")), navidrome: dynamic(() => import("./navidrome/component")),
npm: dynamic(() => import("./npm/component")), npm: dynamic(() => import("./npm/component")),
nzbget: dynamic(() => import("./nzbget/component")), nzbget: dynamic(() => import("./nzbget/component")),

@ -0,0 +1,33 @@
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: minifluxData, error: minifluxError } = useWidgetAPI(widget, "counters");
if (minifluxError) {
return <Container error={minifluxError} />;
}
if (!minifluxData) {
return (
<Container service={service}>
<Block label="miniflux.unread" />
<Block label="miniflux.read" />
</Container>
);
}
return (
<Container service={service}>
<Block label="miniflux.unread" value={t("common.number", { value: minifluxData.unread })} />
<Block label="miniflux.read" value={t("common.number", { value: minifluxData.read })} />
</Container>
);
}

@ -0,0 +1,19 @@
import { asJson } from "utils/proxy/api-helpers";
import credentialedProxyHandler from "utils/proxy/handlers/credentialed";
const widget = {
api: "{url}/v1/{endpoint}",
proxyHandler: credentialedProxyHandler,
mappings: {
counters: {
endpoint: "feeds/counters",
map: (data) => ({
read: Object.values(asJson(data).reads).reduce((acc, i) => acc + i, 0),
unread: Object.values(asJson(data).unreads).reduce((acc, i) => acc + i, 0)
}),
},
}
};
export default widget;

@ -16,6 +16,7 @@ import jackett from "./jackett/widget";
import jellyseerr from "./jellyseerr/widget"; import jellyseerr from "./jellyseerr/widget";
import lidarr from "./lidarr/widget"; import lidarr from "./lidarr/widget";
import mastodon from "./mastodon/widget"; import mastodon from "./mastodon/widget";
import miniflux from "./miniflux/widget";
import navidrome from "./navidrome/widget"; import navidrome from "./navidrome/widget";
import npm from "./npm/widget"; import npm from "./npm/widget";
import nzbget from "./nzbget/widget"; import nzbget from "./nzbget/widget";
@ -66,6 +67,7 @@ const widgets = {
jellyseerr, jellyseerr,
lidarr, lidarr,
mastodon, mastodon,
miniflux,
navidrome, navidrome,
npm, npm,
nzbget, nzbget,

Loading…
Cancel
Save