mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-10 15:28:47 +00:00
Add FreshRSS widget (#1377)
* feat: add FreshRSS widget * refactor: revert credentialed.js * refactor: custom proxy handler for FreshRSS * refactor: cache the token as long as possible During installation, the salt is generated and remains constant unless the user re-installs the FreshRSS instance.
This commit is contained in:
parent
1aa559537a
commit
e8713a95c0
6 changed files with 150 additions and 0 deletions
33
src/widgets/freshrss/component.jsx
Normal file
33
src/widgets/freshrss/component.jsx
Normal file
|
@ -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: freshrssData, error: freshrssError } = useWidgetAPI(widget, "info");
|
||||
|
||||
if (freshrssError) {
|
||||
return <Container error={freshrssError} />;
|
||||
}
|
||||
|
||||
if (!freshrssData) {
|
||||
return (
|
||||
<Container service={service}>
|
||||
<Block label="freshrss.unread" />
|
||||
<Block label="freshrss.subscriptions" />
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Container service={service}>
|
||||
<Block label="freshrss.unread" value={t("common.number", { value: freshrssData.unread })} />
|
||||
<Block label="freshrss.subscriptions" value={t("common.number", { value: freshrssData.subscriptions })} />
|
||||
</Container>
|
||||
);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue