Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions docs/widgets/services/hoarder.md

This file was deleted.

2 changes: 1 addition & 1 deletion docs/widgets/services/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ You can also find a list of all available service widgets in the sidebar navigat
- [HDHomeRun](hdhomerun.md)
- [Headscale](headscale.md)
- [Healthchecks](healthchecks.md)
- [Hoarder](hoarder.md)
- [Karakeep](karakeep.md)
- [Home Assistant](homeassistant.md)
- [HomeBox](homebox.md)
- [Homebridge](homebridge.md)
Expand Down
17 changes: 17 additions & 0 deletions docs/widgets/services/karakeep.md
Original file line number Diff line number Diff line change
@@ -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
```
2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ nav:
- widgets/services/hdhomerun.md
- widgets/services/headscale.md
- widgets/services/healthchecks.md
- widgets/services/hoarder.md
- widgets/services/karakeep.md
- widgets/services/homeassistant.md
- widgets/services/homebox.md
- widgets/services/homebridge.md
Expand Down
2 changes: 1 addition & 1 deletion public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,7 @@
"bcharge":"Battery Charge",
"timeleft":"Time Left"
},
"hoarder": {
"karakeep": {
"bookmarks": "Bookmarks",
"favorites": "Favorites",
"archived": "Archived",
Expand Down
17 changes: 16 additions & 1 deletion src/components/services/widget/container.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ import { SettingsContext } from "utils/contexts/settings";

import Error from "./error";

const ALIASED_WIDGETS = {
pialert: "netalertx",
hoarder: "karakeep",
};

export default function Container({ error = false, children, service }) {
const { settings } = useContext(SettingsContext);

Expand Down Expand Up @@ -32,7 +37,17 @@ export default function Container({ error = false, children, service }) {
if (!field.includes(".")) {
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;
}),
);
}
Expand Down
1 change: 1 addition & 0 deletions src/utils/proxy/handlers/credentialed.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export default async function credentialedProxyHandler(req, res, map) {
"ghostfolio",
"headscale",
"hoarder",
"karakeep",
"linkwarden",
"mealie",
"netalertx",
Expand Down
3 changes: 2 additions & 1 deletion src/widgets/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ const components = {
grafana: dynamic(() => import("./grafana/component")),
hdhomerun: dynamic(() => import("./hdhomerun/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")),
homeassistant: dynamic(() => import("./homeassistant/component")),
homebox: dynamic(() => import("./homebox/component")),
Expand Down
49 changes: 0 additions & 49 deletions src/widgets/hoarder/component.jsx

This file was deleted.

49 changes: 49 additions & 0 deletions src/widgets/karakeep/component.jsx
Original file line number Diff line number Diff line change
@@ -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>
);
}
File renamed without changes.
5 changes: 3 additions & 2 deletions src/widgets/widgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ import grafana from "./grafana/widget";
import hdhomerun from "./hdhomerun/widget";
import headscale from "./headscale/widget";
import healthchecks from "./healthchecks/widget";
import hoarder from "./hoarder/widget";
import homeassistant from "./homeassistant/widget";
import homebox from "./homebox/widget";
import homebridge from "./homebridge/widget";
import immich from "./immich/widget";
import jackett from "./jackett/widget";
import jdownloader from "./jdownloader/widget";
import jellyseerr from "./jellyseerr/widget";
import karakeep from "./karakeep/widget";
import kavita from "./kavita/widget";
import komga from "./komga/widget";
import kopia from "./kopia/widget";
Expand Down Expand Up @@ -178,7 +178,8 @@ const widgets = {
grafana,
hdhomerun,
headscale,
hoarder,
hoarder: karakeep,
karakeep,
homeassistant,
homebox,
homebridge,
Expand Down