mirror of
https://github.com/karl0ss/homepage.git
synced 2025-04-29 12:03:41 +01:00
Chore: change hoarder widget to karakeep (#5143)
This commit is contained in:
parent
6597ec566b
commit
ae9fbdcb8b
@ -1,17 +0,0 @@
|
|||||||
---
|
|
||||||
title: Hoarder
|
|
||||||
description: Hoarder Widget Configuration
|
|
||||||
---
|
|
||||||
|
|
||||||
Learn more about [Hoarder](https://hoarder.app).
|
|
||||||
|
|
||||||
Generate an API key for your user at `User Settings > API Keys`.
|
|
||||||
|
|
||||||
Allowed fields: `["bookmarks", "favorites", "archived", "highlights", "lists", "tags"]` (maximum of 4).
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
widget:
|
|
||||||
type: hoarder
|
|
||||||
url: http[s]://hoarder.host.or.ip[:port]
|
|
||||||
key: hoarderapikey
|
|
||||||
```
|
|
@ -51,7 +51,7 @@ You can also find a list of all available service widgets in the sidebar navigat
|
|||||||
- [HDHomeRun](hdhomerun.md)
|
- [HDHomeRun](hdhomerun.md)
|
||||||
- [Headscale](headscale.md)
|
- [Headscale](headscale.md)
|
||||||
- [Healthchecks](healthchecks.md)
|
- [Healthchecks](healthchecks.md)
|
||||||
- [Hoarder](hoarder.md)
|
- [Karakeep](karakeep.md)
|
||||||
- [Home Assistant](homeassistant.md)
|
- [Home Assistant](homeassistant.md)
|
||||||
- [HomeBox](homebox.md)
|
- [HomeBox](homebox.md)
|
||||||
- [Homebridge](homebridge.md)
|
- [Homebridge](homebridge.md)
|
||||||
|
17
docs/widgets/services/karakeep.md
Normal file
17
docs/widgets/services/karakeep.md
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
---
|
||||||
|
title: Karakeep
|
||||||
|
description: Karakeep Widget Configuration
|
||||||
|
---
|
||||||
|
|
||||||
|
Learn more about [Karakeep](https://karakeep.app) (formerly known as Hoarder).
|
||||||
|
|
||||||
|
Generate an API key for your user at `User Settings > API Keys`.
|
||||||
|
|
||||||
|
Allowed fields: `["bookmarks", "favorites", "archived", "highlights", "lists", "tags"]` (maximum of 4).
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
widget:
|
||||||
|
type: karakeep
|
||||||
|
url: http[s]://karakeep.host.or.ip[:port]
|
||||||
|
key: karakeep_api_key
|
||||||
|
```
|
@ -74,7 +74,7 @@ nav:
|
|||||||
- widgets/services/hdhomerun.md
|
- widgets/services/hdhomerun.md
|
||||||
- widgets/services/headscale.md
|
- widgets/services/headscale.md
|
||||||
- widgets/services/healthchecks.md
|
- widgets/services/healthchecks.md
|
||||||
- widgets/services/hoarder.md
|
- widgets/services/karakeep.md
|
||||||
- widgets/services/homeassistant.md
|
- widgets/services/homeassistant.md
|
||||||
- widgets/services/homebox.md
|
- widgets/services/homebox.md
|
||||||
- widgets/services/homebridge.md
|
- widgets/services/homebridge.md
|
||||||
|
@ -1024,7 +1024,7 @@
|
|||||||
"bcharge":"Battery Charge",
|
"bcharge":"Battery Charge",
|
||||||
"timeleft":"Time Left"
|
"timeleft":"Time Left"
|
||||||
},
|
},
|
||||||
"hoarder": {
|
"karakeep": {
|
||||||
"bookmarks": "Bookmarks",
|
"bookmarks": "Bookmarks",
|
||||||
"favorites": "Favorites",
|
"favorites": "Favorites",
|
||||||
"archived": "Archived",
|
"archived": "Archived",
|
||||||
|
@ -3,6 +3,11 @@ import { SettingsContext } from "utils/contexts/settings";
|
|||||||
|
|
||||||
import Error from "./error";
|
import Error from "./error";
|
||||||
|
|
||||||
|
const ALIASED_WIDGETS = {
|
||||||
|
pialert: "netalertx",
|
||||||
|
hoarder: "karakeep",
|
||||||
|
};
|
||||||
|
|
||||||
export default function Container({ error = false, children, service }) {
|
export default function Container({ error = false, children, service }) {
|
||||||
const { settings } = useContext(SettingsContext);
|
const { settings } = useContext(SettingsContext);
|
||||||
|
|
||||||
@ -32,7 +37,17 @@ export default function Container({ error = false, children, service }) {
|
|||||||
if (!field.includes(".")) {
|
if (!field.includes(".")) {
|
||||||
fullField = `${type}.${field}`;
|
fullField = `${type}.${field}`;
|
||||||
}
|
}
|
||||||
return fullField === child?.props?.label;
|
let matches = fullField === child?.props?.label;
|
||||||
|
// check if the field is an 'alias'
|
||||||
|
if (matches) {
|
||||||
|
return true;
|
||||||
|
} else if (ALIASED_WIDGETS[type]) {
|
||||||
|
matches = fullField.replace(type, ALIASED_WIDGETS[type]) === child?.props?.label;
|
||||||
|
|
||||||
|
return matches;
|
||||||
|
}
|
||||||
|
// no match
|
||||||
|
return false;
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,7 @@ export default async function credentialedProxyHandler(req, res, map) {
|
|||||||
"ghostfolio",
|
"ghostfolio",
|
||||||
"headscale",
|
"headscale",
|
||||||
"hoarder",
|
"hoarder",
|
||||||
|
"karakeep",
|
||||||
"linkwarden",
|
"linkwarden",
|
||||||
"mealie",
|
"mealie",
|
||||||
"netalertx",
|
"netalertx",
|
||||||
|
@ -47,7 +47,8 @@ const components = {
|
|||||||
grafana: dynamic(() => import("./grafana/component")),
|
grafana: dynamic(() => import("./grafana/component")),
|
||||||
hdhomerun: dynamic(() => import("./hdhomerun/component")),
|
hdhomerun: dynamic(() => import("./hdhomerun/component")),
|
||||||
headscale: dynamic(() => import("./headscale/component")),
|
headscale: dynamic(() => import("./headscale/component")),
|
||||||
hoarder: dynamic(() => import("./hoarder/component")),
|
hoarder: dynamic(() => import("./karakeep/component")),
|
||||||
|
karakeep: dynamic(() => import("./karakeep/component")),
|
||||||
peanut: dynamic(() => import("./peanut/component")),
|
peanut: dynamic(() => import("./peanut/component")),
|
||||||
homeassistant: dynamic(() => import("./homeassistant/component")),
|
homeassistant: dynamic(() => import("./homeassistant/component")),
|
||||||
homebox: dynamic(() => import("./homebox/component")),
|
homebox: dynamic(() => import("./homebox/component")),
|
||||||
|
@ -1,49 +0,0 @@
|
|||||||
import Block from "components/services/widget/block";
|
|
||||||
import Container from "components/services/widget/container";
|
|
||||||
import { useTranslation } from "next-i18next";
|
|
||||||
|
|
||||||
import useWidgetAPI from "utils/proxy/use-widget-api";
|
|
||||||
|
|
||||||
export const hoarderDefaultFields = ["bookmarks", "favorites", "archived", "highlights"];
|
|
||||||
const MAX_ALLOWED_FIELDS = 4;
|
|
||||||
|
|
||||||
export default function Component({ service }) {
|
|
||||||
const { t } = useTranslation();
|
|
||||||
const { widget } = service;
|
|
||||||
|
|
||||||
const { data: statsData, error: statsError } = useWidgetAPI(widget, "stats");
|
|
||||||
|
|
||||||
if (statsError) {
|
|
||||||
return <Container service={service} error={statsError} />;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!widget.fields || widget.fields.length === 0) {
|
|
||||||
widget.fields = hoarderDefaultFields;
|
|
||||||
} else if (widget.fields?.length > MAX_ALLOWED_FIELDS) {
|
|
||||||
widget.fields = widget.fields.slice(0, MAX_ALLOWED_FIELDS);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!statsData) {
|
|
||||||
return (
|
|
||||||
<Container service={service}>
|
|
||||||
<Block label="hoarder.bookmarks" />
|
|
||||||
<Block label="hoarder.favorites" />
|
|
||||||
<Block label="hoarder.archived" />
|
|
||||||
<Block label="hoarder.highlights" />
|
|
||||||
<Block label="hoarder.lists" />
|
|
||||||
<Block label="hoarder.tags" />
|
|
||||||
</Container>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Container service={service}>
|
|
||||||
<Block label="hoarder.bookmarks" value={t("common.number", { value: statsData.numBookmarks })} />
|
|
||||||
<Block label="hoarder.favorites" value={t("common.number", { value: statsData.numFavorites })} />
|
|
||||||
<Block label="hoarder.archived" value={t("common.number", { value: statsData.numArchived })} />
|
|
||||||
<Block label="hoarder.highlights" value={t("common.number", { value: statsData.numHighlights })} />
|
|
||||||
<Block label="hoarder.lists" value={t("common.number", { value: statsData.numLists })} />
|
|
||||||
<Block label="hoarder.tags" value={t("common.number", { value: statsData.numTags })} />
|
|
||||||
</Container>
|
|
||||||
);
|
|
||||||
}
|
|
49
src/widgets/karakeep/component.jsx
Normal file
49
src/widgets/karakeep/component.jsx
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
import Block from "components/services/widget/block";
|
||||||
|
import Container from "components/services/widget/container";
|
||||||
|
import { useTranslation } from "next-i18next";
|
||||||
|
|
||||||
|
import useWidgetAPI from "utils/proxy/use-widget-api";
|
||||||
|
|
||||||
|
export const karakeepDefaultFields = ["bookmarks", "favorites", "archived", "highlights"];
|
||||||
|
const MAX_ALLOWED_FIELDS = 4;
|
||||||
|
|
||||||
|
export default function Component({ service }) {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const { widget } = service;
|
||||||
|
|
||||||
|
const { data: statsData, error: statsError } = useWidgetAPI(widget, "stats");
|
||||||
|
|
||||||
|
if (statsError) {
|
||||||
|
return <Container service={service} error={statsError} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!widget.fields || widget.fields.length === 0) {
|
||||||
|
widget.fields = karakeepDefaultFields;
|
||||||
|
} else if (widget.fields?.length > MAX_ALLOWED_FIELDS) {
|
||||||
|
widget.fields = widget.fields.slice(0, MAX_ALLOWED_FIELDS);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!statsData) {
|
||||||
|
return (
|
||||||
|
<Container service={service}>
|
||||||
|
<Block label="karakeep.bookmarks" />
|
||||||
|
<Block label="karakeep.favorites" />
|
||||||
|
<Block label="karakeep.archived" />
|
||||||
|
<Block label="karakeep.highlights" />
|
||||||
|
<Block label="karakeep.lists" />
|
||||||
|
<Block label="karakeep.tags" />
|
||||||
|
</Container>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Container service={service}>
|
||||||
|
<Block label="karakeep.bookmarks" value={t("common.number", { value: statsData.numBookmarks })} />
|
||||||
|
<Block label="karakeep.favorites" value={t("common.number", { value: statsData.numFavorites })} />
|
||||||
|
<Block label="karakeep.archived" value={t("common.number", { value: statsData.numArchived })} />
|
||||||
|
<Block label="karakeep.highlights" value={t("common.number", { value: statsData.numHighlights })} />
|
||||||
|
<Block label="karakeep.lists" value={t("common.number", { value: statsData.numLists })} />
|
||||||
|
<Block label="karakeep.tags" value={t("common.number", { value: statsData.numTags })} />
|
||||||
|
</Container>
|
||||||
|
);
|
||||||
|
}
|
@ -42,7 +42,6 @@ import grafana from "./grafana/widget";
|
|||||||
import hdhomerun from "./hdhomerun/widget";
|
import hdhomerun from "./hdhomerun/widget";
|
||||||
import headscale from "./headscale/widget";
|
import headscale from "./headscale/widget";
|
||||||
import healthchecks from "./healthchecks/widget";
|
import healthchecks from "./healthchecks/widget";
|
||||||
import hoarder from "./hoarder/widget";
|
|
||||||
import homeassistant from "./homeassistant/widget";
|
import homeassistant from "./homeassistant/widget";
|
||||||
import homebox from "./homebox/widget";
|
import homebox from "./homebox/widget";
|
||||||
import homebridge from "./homebridge/widget";
|
import homebridge from "./homebridge/widget";
|
||||||
@ -50,6 +49,7 @@ import immich from "./immich/widget";
|
|||||||
import jackett from "./jackett/widget";
|
import jackett from "./jackett/widget";
|
||||||
import jdownloader from "./jdownloader/widget";
|
import jdownloader from "./jdownloader/widget";
|
||||||
import jellyseerr from "./jellyseerr/widget";
|
import jellyseerr from "./jellyseerr/widget";
|
||||||
|
import karakeep from "./karakeep/widget";
|
||||||
import kavita from "./kavita/widget";
|
import kavita from "./kavita/widget";
|
||||||
import komga from "./komga/widget";
|
import komga from "./komga/widget";
|
||||||
import kopia from "./kopia/widget";
|
import kopia from "./kopia/widget";
|
||||||
@ -178,7 +178,8 @@ const widgets = {
|
|||||||
grafana,
|
grafana,
|
||||||
hdhomerun,
|
hdhomerun,
|
||||||
headscale,
|
headscale,
|
||||||
hoarder,
|
hoarder: karakeep,
|
||||||
|
karakeep,
|
||||||
homeassistant,
|
homeassistant,
|
||||||
homebox,
|
homebox,
|
||||||
homebridge,
|
homebridge,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user