Compare commits

...

16 Commits

Author SHA1 Message Date
dependabot[bot]
547ef0c4c5 Chore(deps): Bump actions/setup-python from 5 to 6 (#5746)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-09-04 16:55:44 +00:00
dependabot[bot]
11d148fff0 Chore(deps): Bump actions/setup-node from 4 to 5 (#5747)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-09-04 16:44:40 +00:00
dependabot[bot]
eb61d69626 Chore(deps): Bump actions/stale from 9 to 10 (#5745)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-09-04 16:29:39 +00:00
dependabot[bot]
876304cda5 Chore(deps): Bump actions/github-script from 7 to 8 (#5744)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-09-04 09:13:22 -07:00
dNhax
65dce6d387 Enhancement: support multiple proxmox nodes (#5539)
Co-authored-by: shamoon <4887959+shamoon@users.noreply.github.com>
2025-09-04 08:49:41 +00:00
Derek Kaser
7b60a60d4e Feature: Backrest widget (#5741)
Co-authored-by: Renan Greca <renangreca@gmail.com>
Co-authored-by: shamoon <4887959+shamoon@users.noreply.github.com>
2025-09-03 21:47:10 +00:00
dependabot[bot]
8d37cad871 Chore(deps): Bump next from 15.4.5 to 15.5.2 (#5738)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-09-03 20:09:13 +00:00
dependabot[bot]
cd25ae3258 Chore(deps): Bump recharts from 2.15.3 to 3.1.2 (#5739)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-09-03 20:01:08 +00:00
dependabot[bot]
a27cdbc284 Chore(deps): Bump tough-cookie from 5.1.2 to 6.0.0 (#5737)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-09-03 19:32:00 +00:00
dependabot[bot]
e772ef0ad1 Chore(deps): Bump gamedig from 5.2.0 to 5.3.1 (#5736)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-09-03 19:23:44 +00:00
dependabot[bot]
8cc00ae09a Chore(deps): Bump @headlessui/react from 1.7.19 to 2.2.7 (#5735)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-09-03 12:14:04 -07:00
shamoon
f4efc71350 Update jellyseerr.md 2025-08-29 17:22:41 -07:00
AdamWHY2K
b663e56174 Enhancement: Add issues field to Jellyseerr widget (#5725)
Co-authored-by: shamoon <4887959+shamoon@users.noreply.github.com>
2025-08-29 18:14:13 +00:00
Kieran
a9ec5aa1e7 Documentation: Document needed permissions for Immich (#5706) 2025-08-23 20:28:08 +00:00
shamoon
44405b4aae Merge branch 'main' into dev 2025-08-21 13:06:07 -07:00
Derek Kaser
842cec2fee Feature: Unraid widget (#5683)
Co-authored-by: shamoon <4887959+shamoon@users.noreply.github.com>
2025-08-21 18:06:49 +00:00
27 changed files with 956 additions and 320 deletions

View File

@@ -25,7 +25,7 @@ jobs:
uses: actions/checkout@v5
- name: Install python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: 3.x
@@ -38,7 +38,7 @@ jobs:
run_install: false
- name: Setup Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@v5
with:
node-version: 20
cache: 'pnpm'
@@ -96,7 +96,7 @@ jobs:
run_install: false
- name: Setup Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@v5
with:
node-version: 20
cache: 'pnpm'

View File

@@ -19,7 +19,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v5
- name: Install python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: 3.x
- name: Check files
@@ -33,7 +33,7 @@ jobs:
- pre-commit
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v5
- uses: actions/setup-python@v6
with:
python-version: 3.x
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
@@ -59,7 +59,7 @@ jobs:
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- uses: actions/setup-python@v5
- uses: actions/setup-python@v6
with:
python-version: 3.x
- run: echo "cache_id=${{github.sha}}" >> $GITHUB_ENV

View File

@@ -18,7 +18,7 @@ jobs:
name: 'Stale'
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v9
- uses: actions/stale@v10
with:
days-before-stale: 7
days-before-close: 14
@@ -57,7 +57,7 @@ jobs:
name: 'Close Answered Discussions'
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v7
- uses: actions/github-script@v8
with:
script: |
function sleep(ms) {
@@ -113,7 +113,7 @@ jobs:
name: 'Close Outdated Discussions'
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v7
- uses: actions/github-script@v8
with:
script: |
function sleep(ms) {
@@ -204,7 +204,7 @@ jobs:
name: 'Close Unsupported Feature Requests'
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v7
- uses: actions/github-script@v8
with:
script: |
function sleep(ms) {

View File

@@ -4,11 +4,13 @@ description: Proxmox Configuration
---
The Proxmox connection is configured in the `proxmox.yaml` file. See [Create token](#create-token) section below for details on how to generate the required API token.
You can configure multiple nodes - be sure to use the exact `proxmoxNode` identifier!
```yaml
url: https://proxmox.host.or.ip:8006
token: username@pam!Token ID
secret: secret
pve:
url: https://proxmox.host.or.ip:8006
token: username@pam!Token ID
secret: secret
```
## Services
@@ -17,7 +19,7 @@ Once the Proxmox connection is configured, individual services can be configured
### Configuration Options
- `proxmoxNode`: The name of the Proxmox node where your VM/LXC is running
- `proxmoxNode`: The name of the Proxmox node where your VM/LXC is running, must match with a node configured in the `proxmox.yaml`
- `proxmoxVMID`: The ID of the Proxmox VM or LXC container
- `proxmoxType`: (Optional) The type of Proxmox virtual machine. Defaults to `qemu` for VMs, but can be set to `lxc` for LXC containers

View File

@@ -0,0 +1,17 @@
---
title: Backrest
description: Backrest Widget Configuration
---
[Backrest](https://garethgeorge.github.io/backrest/) is a web-based frontend for
the [Restic](https://restic.net/) backup tool.
**Allowed fields:** `["num_success_latest","num_failure_latest","num_success_30","num_plans","num_failure_30","bytes_added_30"]`
```yaml
widget:
type: backrest
url: http://backrest.host.or.ip
username: admin # optional if auth is enabled in Backrest
password: admin # optional if auth is enabled in Backrest
```

View File

@@ -10,7 +10,8 @@ Learn more about [Immich](https://github.com/immich-app/immich).
| < v1.118 | 1 (default) |
| >= v1.118 | 2 |
Find your API key under `Account Settings > API Keys`.
Find your API key under `Account Settings > API Keys`. The key should have the
`server.statistics` permission.
Allowed fields: `["users" ,"photos", "videos", "storage"]`.

View File

@@ -15,6 +15,7 @@ You can also find a list of all available service widgets in the sidebar navigat
- [Authentik](authentik.md)
- [Autobrr](autobrr.md)
- [Azure DevOps](azuredevops.md)
- [Backrest](backrest.md)
- [Bazarr](bazarr.md)
- [Beszel](beszel.md)
- [Caddy](caddy.md)
@@ -139,6 +140,7 @@ You can also find a list of all available service widgets in the sidebar navigat
- [TubeArchivist](tubearchivist.md)
- [UniFi Controller](unifi-controller.md)
- [Unmanic](unmanic.md)
- [Unraid](unraid.md)
- [Uptime Kuma](uptime-kuma.md)
- [UptimeRobot](uptimerobot.md)
- [UrBackup](urbackup.md)

View File

@@ -7,7 +7,8 @@ Learn more about [Jellyseerr](https://github.com/Fallenbagel/jellyseerr).
Find your API key under `Settings > General > API Key`.
Allowed fields: `["pending", "approved", "available"]`.
Allowed fields: `["pending", "approved", "available", "issues"]`.
Default fields: `["pending", "approved", "available"]`.
```yaml
widget:

View File

@@ -0,0 +1,28 @@
---
title: Unraid
description: Unraid Widget Configuration
---
Learn more about [Unraid](https://unraid.net/).
The Unraid widget allows you to monitor the resources of an Unraid server.
**Minimum Requirements:**
- Unraid 7.2 -or- Unraid Connect plugin 2025.08.19.1850
- API key with the **GUEST** (read only) role: [Managing API Keys](https://docs.unraid.net/go/managing-api-keys)
The widget can display metrics for selected Unraid pools. If using one of the "pool" fields, you must also add the pool name to the settings.
**Allowed fields:** `["cpu","memoryPercent","memoryAvailable","memoryUsed","notifications","arrayFreeSpace","arrayUsedSpace","arrayUsedPercent","status","pool1UsedSpace","pool1FreeSpace","pool1UsedPercent","pool2UsedSpace","pool2FreeSpace","pool2UsedPercent","pool3UsedSpace","pool3FreeSpace","pool3UsedPercent","pool4UsedSpace","pool4FreeSpace","pool4UsedPercent"]`
```yaml
widget:
type: unraid
url: https://unraid.host.or.ip
key: api-key
pool1: pool1name # required only if using pool1 fields
pool2: pool2name # required only if using pool2 fields
pool3: pool3name # required only if using pool3 fields
pool4: pool4name # required only if using pool4 fields
```

View File

@@ -39,6 +39,7 @@ nav:
- widgets/services/authentik.md
- widgets/services/autobrr.md
- widgets/services/azuredevops.md
- widgets/services/backrest.md
- widgets/services/bazarr.md
- widgets/services/beszel.md
- widgets/services/caddy.md
@@ -165,6 +166,7 @@ nav:
- widgets/services/tubearchivist.md
- widgets/services/unifi-controller.md
- widgets/services/unmanic.md
- widgets/services/unraid.md
- widgets/services/uptime-kuma.md
- widgets/services/uptimerobot.md
- widgets/services/urbackup.md

View File

@@ -11,13 +11,13 @@
"telemetry": "next telemetry disable"
},
"dependencies": {
"@headlessui/react": "^1.7.19",
"@headlessui/react": "^2.2.7",
"@kubernetes/client-node": "^1.0.0",
"classnames": "^2.5.1",
"compare-versions": "^6.1.1",
"dockerode": "^4.0.7",
"follow-redirects": "^1.15.11",
"gamedig": "^5.2.0",
"gamedig": "^5.3.1",
"i18next": "^24.2.3",
"ical.js": "^2.1.0",
"js-yaml": "^4.1.0",
@@ -25,7 +25,7 @@
"luxon": "^3.6.1",
"memory-cache": "^0.2.0",
"minecraftstatuspinger": "^1.2.2",
"next": "^15.4.5",
"next": "^15.5.2",
"next-i18next": "^12.1.0",
"ping": "^0.4.4",
"pretty-bytes": "^6.1.1",
@@ -34,10 +34,10 @@
"react-dom": "^18.3.1",
"react-i18next": "^15.5.3",
"react-icons": "^5.4.0",
"recharts": "^2.15.3",
"recharts": "^3.1.2",
"swr": "^2.3.3",
"systeminformation": "^5.27.7",
"tough-cookie": "^5.1.2",
"tough-cookie": "^6.0.0",
"urbackup-server-api": "^0.8.9",
"winston": "^3.17.0",
"xml-js": "^1.6.11"

679
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -275,7 +275,8 @@
"jellyseerr": {
"pending": "Pending",
"approved": "Approved",
"available": "Available"
"available": "Available",
"issues": "Open Issues"
},
"overseerr": {
"pending": "Pending",
@@ -1083,5 +1084,35 @@
"nextMonthlyCost": "Next Month",
"previousMonthlyCost": "Prev. Month",
"nextRenewingSubscription": "Next Payment"
},
"unraid": {
"STARTED": "Started",
"STOPPED": "Stopped",
"NEW_ARRAY": "New Array",
"RECON_DISK": "Reconstructing Disk",
"DISABLE_DISK": "Disk Disabled",
"SWAP_DSBL": "Swap Disable",
"INVALID_EXPANSION": "Invalid Expansion",
"PARITY_NOT_BIGGEST": "Parity Not Biggest",
"TOO_MANY_MISSING_DISKS": "Too Many Missing Disks",
"NEW_DISK_TOO_SMALL": "New Disk Too Small",
"NO_DATA_DISKS": "No Data Disks",
"notifications": "Notifications",
"status": "Status",
"cpu": "CPU",
"memoryUsed": "Memory Used",
"memoryAvailable": "Memory Available",
"arrayUsed": "Array Used",
"arrayFree": "Array Free",
"poolUsed": "{{pool}} Used",
"poolFree": "{{pool}} Free"
},
"backrest": {
"num_plans": "Plans",
"num_success_30": "Successes",
"num_failure_30": "Failures",
"num_success_latest": "Succeeding",
"num_failure_latest": "Failing",
"bytes_added_30": "Bytes Added"
}
}

View File

@@ -37,12 +37,12 @@ export default function Container({ error = false, children, service }) {
if (!field.includes(".")) {
fullField = `${type}.${field}`;
}
let matches = fullField === child?.props?.label;
let matches = fullField === (child?.props?.field || 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;
matches = fullField.replace(type, ALIASED_WIDGETS[type]) === (child?.props?.field || child?.props?.label);
return matches;
}

View File

@@ -24,9 +24,28 @@ export default async function handler(req, res) {
});
}
const baseUrl = `${proxmoxConfig.url}/api2/json`;
// Prefer per-node config (new format), fall back to legacy flat creds.
const nodeConfig =
(node && proxmoxConfig && proxmoxConfig[node]) ||
(proxmoxConfig && proxmoxConfig.url && proxmoxConfig.token && proxmoxConfig.secret
? {
url: proxmoxConfig.url,
token: proxmoxConfig.token,
secret: proxmoxConfig.secret,
}
: null);
if (!nodeConfig) {
return res.status(400).json({
error:
"Proxmox config not found for the specified node and no legacy credentials detected. " +
"Add a node block in proxmox.yaml (e.g., 'pve: { url, token, secret }') or restore legacy top-level url/token/secret.",
});
}
const baseUrl = `${nodeConfig.url}/api2/json`;
const headers = {
Authorization: `PVEAPIToken=${proxmoxConfig.token}=${proxmoxConfig.secret}`,
Authorization: `PVEAPIToken=${nodeConfig.token}=${nodeConfig.secret}`,
};
const statusUrl = `${baseUrl}/nodes/${node}/${vmType}/${vmid}/status/current`;

View File

@@ -1,4 +1,5 @@
---
# url: https://proxmox.host.or.ip:8006
# token: username@pam!Token ID
# secret: secret
# pve:
# url: https://proxmox.host.or.ip:8006
# token: username@pam!Token ID
# secret: secret

View File

@@ -396,6 +396,12 @@ export function cleanServiceGroups(groups) {
// unifi
site,
// unraid
pool1,
pool2,
pool3,
pool4,
// vikunja
enableTaskList,
@@ -611,6 +617,12 @@ export function cleanServiceGroups(groups) {
if (type === "grafana") {
if (alerts) widget.alerts = alerts;
}
if (type === "unraid") {
if (pool1) widget.pool1 = pool1;
if (pool2) widget.pool2 = pool2;
if (pool3) widget.pool3 = pool3;
if (pool4) widget.pool4 = pool4;
}
return widget;
});
return cleanedService;

View File

@@ -0,0 +1,50 @@
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";
const BACKREST_DEFAULT_FIELDS = ["num_success_latest", "num_failure_latest", "num_failure_30", "bytes_added_30"];
const MAX_ALLOWED_FIELDS = 4;
export default function Component({ service }) {
const { t } = useTranslation();
const { widget } = service;
const { data, error } = useWidgetAPI(widget, "summary");
if (error) {
return <Container service={service} error={error} />;
}
if (!widget.fields?.length) {
widget.fields = BACKREST_DEFAULT_FIELDS;
} else if (widget.fields.length > MAX_ALLOWED_FIELDS) {
widget.fields = widget.fields.slice(0, MAX_ALLOWED_FIELDS);
}
if (!data) {
return (
<Container service={service}>
<Block label="backrest.num_plans" />
<Block label="backrest.num_success_latest" />
<Block label="backrest.num_failure_latest" />
<Block label="backrest.num_success_30" />
<Block label="backrest.num_failure_30" />
<Block label="backrest.bytes_added_30" />
</Container>
);
}
return (
<Container service={service}>
<Block label="backrest.num_plans" value={t("common.number", { value: data.numPlans })} />
<Block label="backrest.num_success_latest" value={t("common.number", { value: data.numSuccessLatest })} />
<Block label="backrest.num_failure_latest" value={t("common.number", { value: data.numFailureLatest })} />
<Block label="backrest.num_success_30" value={t("common.number", { value: data.numSuccess30Days })} />
<Block label="backrest.num_failure_30" value={t("common.number", { value: data.numFailure30Days })} />
<Block label="backrest.bytes_added_30" value={t("common.bytes", { value: data.bytesAdded30Days })} />
</Container>
);
}

View File

@@ -0,0 +1,96 @@
import getServiceWidget from "utils/config/service-helpers";
import createLogger from "utils/logger";
import { asJson, formatApiCall } from "utils/proxy/api-helpers";
import { httpProxy } from "utils/proxy/http";
import widgets from "widgets/widgets";
const proxyName = "backrestProxyHandler";
const logger = createLogger(proxyName);
function sumField(plans, field) {
return plans.reduce((sum, plan) => {
const num = Number(plan[field]);
return sum + (Number.isNaN(num) ? 0 : num);
}, 0);
}
function buildResponse(plans) {
const numSuccess30Days = sumField(plans, "backupsSuccessLast30days");
const numFailure30Days = sumField(plans, "backupsFailed30days");
const bytesAdded30Days = sumField(plans, "bytesAddedLast30days");
var numSuccessLatest = 0;
var numFailureLatest = 0;
plans.forEach((plan) => {
const statuses = plan?.recentBackups?.status;
if (Array.isArray(statuses) && statuses.length > 0) {
if (statuses[0] === "STATUS_SUCCESS") {
numSuccessLatest++;
} else {
numFailureLatest++;
}
}
});
return {
numPlans: plans.length,
numSuccess30Days,
numFailure30Days,
numSuccessLatest,
numFailureLatest,
bytesAdded30Days,
};
}
export default async function backrestProxyHandler(req, res) {
const { group, service, endpoint, index } = req.query;
if (!group || !service) {
logger.debug("Invalid or missing service '%s' or group '%s'", service, group);
return res.status(400).json({ error: "Invalid proxy service type" });
}
const widget = await getServiceWidget(group, service, index);
if (!widget) {
logger.debug("Invalid or missing widget for service '%s' in group '%s'", service, group);
return res.status(400).json({ error: "Invalid proxy service type" });
}
const headers = {
"content-type": "application/json",
};
if (widget.username && widget.password) {
headers.Authorization = `Basic ${Buffer.from(`${widget.username}:${widget.password}`).toString("base64")}`;
}
const { api } = widgets[widget.type];
const url = new URL(formatApiCall(api, { endpoint, ...widget }));
try {
const [status, contentType, data] = await httpProxy(url, {
method: "POST",
body: JSON.stringify({}),
headers,
});
if (status !== 200) {
logger.error("Error getting data from Backrest: %d. Data: %s", status, data);
return res.status(500).send({ error: { message: "Error getting data from Backrest", url, data } });
}
if (contentType) res.setHeader("Content-Type", "application/json");
const plans = asJson(data).planSummaries;
if (!Array.isArray(plans)) {
logger.error("Invalid plans data: %s", JSON.stringify(plans));
return res.status(500).send({ error: { message: "Invalid plans data", url, data } });
}
const response = buildResponse(plans);
return res.status(status).send(response);
} catch (error) {
logger.error("Exception calling Backrest API: %s", error.message);
return res.status(500).json({ error: "Backrest API Error", message: error.message });
}
}

View File

@@ -0,0 +1,14 @@
import backrestProxyHandler from "./proxy";
const widget = {
api: "{url}/v1.Backrest/{endpoint}",
proxyHandler: backrestProxyHandler,
mappings: {
summary: {
endpoint: "GetSummaryDashboard",
},
},
};
export default widget;

View File

@@ -9,6 +9,7 @@ const components = {
authentik: dynamic(() => import("./authentik/component")),
autobrr: dynamic(() => import("./autobrr/component")),
azuredevops: dynamic(() => import("./azuredevops/component")),
backrest: dynamic(() => import("./backrest/component")),
bazarr: dynamic(() => import("./bazarr/component")),
beszel: dynamic(() => import("./beszel/component")),
caddy: dynamic(() => import("./caddy/component")),
@@ -139,6 +140,7 @@ const components = {
truenas: dynamic(() => import("./truenas/component")),
unifi: dynamic(() => import("./unifi/component")),
unmanic: dynamic(() => import("./unmanic/component")),
unraid: dynamic(() => import("./unraid/component")),
uptimekuma: dynamic(() => import("./uptimekuma/component")),
uptimerobot: dynamic(() => import("./uptimerobot/component")),
urbackup: dynamic(() => import("./urbackup/component")),

View File

@@ -3,21 +3,27 @@ import Container from "components/services/widget/container";
import useWidgetAPI from "utils/proxy/use-widget-api";
export const jellyseerrDefaultFields = ["pending", "approved", "available"];
export default function Component({ service }) {
const { widget } = service;
const { data: statsData, error: statsError } = useWidgetAPI(widget, "request/count");
widget.fields = widget?.fields?.length ? widget.fields : jellyseerrDefaultFields;
const isIssueEnabled = widget.fields.includes("issues");
if (statsError) {
return <Container service={service} error={statsError} />;
const { data: statsData, error: statsError } = useWidgetAPI(widget, "request/count");
const { data: issueData, error: issueError } = useWidgetAPI(widget, isIssueEnabled ? "issue/count" : "");
if (statsError || (isIssueEnabled && issueError)) {
return <Container service={service} error={statsError ? statsError : issueError} />;
}
if (!statsData) {
if (!statsData || (isIssueEnabled && !issueData)) {
return (
<Container service={service}>
<Block label="jellyseerr.pending" />
<Block label="jellyseerr.approved" />
<Block label="jellyseerr.available" />
<Block label="jellyseerr.issues" />
</Container>
);
}
@@ -27,6 +33,7 @@ export default function Component({ service }) {
<Block label="jellyseerr.pending" value={statsData.pending} />
<Block label="jellyseerr.approved" value={statsData.approved} />
<Block label="jellyseerr.available" value={statsData.available} />
<Block label="jellyseerr.issues" value={`${issueData?.open} / ${issueData?.total}`} />
</Container>
);
}

View File

@@ -9,6 +9,10 @@ const widget = {
endpoint: "request/count",
validate: ["pending", "approved", "available"],
},
"issue/count": {
endpoint: "issue/count",
validate: ["open", "total"],
},
},
};

View File

@@ -0,0 +1,93 @@
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";
const UNRAID_DEFAULT_FIELDS = ["status", "cpu", "memoryPercent", "notifications"];
const MAX_ALLOWED_FIELDS = 4;
const POOLS = ["pool1", "pool2", "pool3", "pool4"];
const POOL_FIELDS = [
{ param: "UsedSpace", label: "poolUsed", valueKey: "fsUsed", valueType: "common.bytes" },
{ param: "FreeSpace", label: "poolFree", valueKey: "fsFree", valueType: "common.bytes" },
{ param: "UsedPercent", label: "poolUsed", valueKey: "fsUsedPercent", valueType: "common.percent" },
];
export default function Component({ service }) {
const { t } = useTranslation();
const { widget } = service;
const { data, error } = useWidgetAPI(widget);
if (error) {
return <Container service={service} error={error} />;
}
if (!widget.fields?.length) {
widget.fields = UNRAID_DEFAULT_FIELDS;
} else if (widget.fields.length > MAX_ALLOWED_FIELDS) {
widget.fields = widget.fields.slice(0, MAX_ALLOWED_FIELDS);
}
if (!data) {
return (
<Container service={service}>
<Block label="unraid.status" />
<Block label="unraid.memoryAvailable" />
<Block label="unraid.memoryUsed" />
<Block field="unraid.memoryPercent" label="unraid.memoryUsed" />
<Block label="unraid.cpu" />
<Block label="unraid.notifications" />
<Block field="unraid.arrayUsedSpace" label="unraid.arrayUsed" />
<Block field="unraid.arrayFree" label="unraid.arrayFree" />
<Block field="unraid.arrayUsedPercent" label="unraid.arrayUsed" />
{...POOLS.flatMap((pool) =>
POOL_FIELDS.map(({ param, label }) => (
<Block
key={`${pool}-${param}`}
field={`unraid.${pool}${param}`}
label={t(`unraid.${label}`, { pool: widget?.[pool] || pool })}
/>
)),
)}
</Container>
);
}
return (
<Container service={service}>
<Block label="unraid.status" value={t(`unraid.${data.arrayState}`)} />
<Block label="unraid.memoryAvailable" value={t("common.bbytes", { value: data.memoryAvailable })} />
<Block label="unraid.memoryUsed" value={t("common.bbytes", { value: data.memoryUsed })} />
<Block
field="unraid.memoryPercent"
label="unraid.memoryUsed"
value={t("common.percent", { value: data.memoryUsedPercent })}
/>
<Block label="unraid.cpu" value={t("common.percent", { value: data.cpuPercent })} />
<Block label="unraid.notifications" value={t("common.number", { value: data.unreadNotifications })} />
<Block
field="unraid.arrayUsedSpace"
label="unraid.arrayUsed"
value={t("common.bytes", { value: data.arrayUsed })}
/>
<Block label="unraid.arrayFree" value={t("common.bytes", { value: data.arrayFree })} />
<Block
field="unraid.arrayUsedPercent"
label="unraid.arrayUsed"
value={t("common.percent", { value: data.arrayUsedPercent })}
/>
{...POOLS.flatMap((pool) =>
POOL_FIELDS.map(({ param, label, valueKey, valueType }) => (
<Block
key={`${pool}-${param}`}
field={`unraid.${pool}${param}`}
label={t(`unraid.${label}`, { pool: widget?.[pool] || pool })}
value={t(valueType, { value: data.caches?.[widget?.[pool]]?.[valueKey] || "-" })}
/>
)),
)}
</Container>
);
}

138
src/widgets/unraid/proxy.js Normal file
View File

@@ -0,0 +1,138 @@
import getServiceWidget from "utils/config/service-helpers";
import createLogger from "utils/logger";
import { asJson } from "utils/proxy/api-helpers";
import { httpProxy } from "utils/proxy/http";
const logger = createLogger("unraidProxyHandler");
const graphqlQuery = `
{
array {
state
capacity {
kilobytes {
free
total
used
}
}
caches {
name
fsType
fsSize
fsFree
fsUsed
}
}
metrics {
memory {
active
available
percentTotal
}
cpu {
percentTotal
}
}
notifications {
overview {
unread {
total
}
}
}
}
`;
function processUnraidResponse(data) {
const response = {};
try {
data = asJson(data)?.data;
response["memoryUsedPercent"] = data?.metrics?.memory?.percentTotal ?? null;
response["memoryUsed"] = data?.metrics?.memory?.active ?? null;
response["memoryAvailable"] = data?.metrics?.memory?.available ?? null;
response["cpuPercent"] = data?.metrics?.cpu?.percentTotal ?? null;
response["unreadNotifications"] = data?.notifications?.overview?.unread?.total ?? null;
response["arrayState"] = data?.array?.state ?? null;
response["arrayFree"] = data?.array?.capacity?.kilobytes?.free * 1000 ?? null;
response["arrayUsed"] = data?.array?.capacity?.kilobytes?.used * 1000 ?? null;
response["arrayUsedPercent"] =
(data?.array?.capacity?.kilobytes?.used / data?.array?.capacity?.kilobytes?.total) * 100 ?? null;
response["caches"] = {};
if (data?.array?.caches) {
data.array.caches.forEach((cache) => {
if (cache.fsType) {
response.caches[cache.name] = {
fsFree: cache.fsFree * 1000,
fsUsed: cache.fsUsed * 1000,
fsUsedPercent: (cache.fsUsed / cache.fsSize) * 100 ?? null,
};
}
});
}
} catch (error) {
return { error: error.message };
}
return response;
}
export default async function unraidProxyHandler(req, res) {
const { group, service, index } = req.query;
if (!group || !service) {
logger.debug("Invalid or missing service '%s' or group '%s'", service, group);
return res.status(400).json({ error: "Invalid proxy service type" });
}
const widget = await getServiceWidget(group, service, index);
if (!widget) {
logger.debug("Invalid or missing widget for service '%s' in group '%s'", service, group);
return res.status(400).json({ error: "Invalid proxy service type" });
}
const url = new URL(widget.url + "/graphql");
const headers = {
"Content-Type": "application/json",
Accept: `application/json`,
"X-API-Key": `${widget.key}`,
};
const params = {
method: "POST",
headers,
};
params.body = JSON.stringify({
query: graphqlQuery,
});
const [status, , data] = await httpProxy(url, params);
if (status === 204 || status === 304) {
return res.status(status).end();
}
if (status !== 200) {
logger.error(
"Error getting data from Unraid for service '%s' in group '%s': %d. Data: %s",
service,
group,
status,
data,
);
return res.status(status).send({ error: { message: "Error calling Unraid API.", data } });
}
const result = processUnraidResponse(data);
if (result.error) {
logger.error("Error processing Unraid data: %s", result.error);
return res.status(500).json({ error: result.error });
}
res.setHeader("Content-Type", "application/json");
return res.status(status).send(result);
}

View File

@@ -0,0 +1,7 @@
import unraidProxyHandler from "./proxy";
const widget = {
proxyHandler: unraidProxyHandler,
};
export default widget;

View File

@@ -6,6 +6,7 @@ import audiobookshelf from "./audiobookshelf/widget";
import authentik from "./authentik/widget";
import autobrr from "./autobrr/widget";
import azuredevops from "./azuredevops/widget";
import backrest from "./backrest/widget";
import bazarr from "./bazarr/widget";
import beszel from "./beszel/widget";
import caddy from "./caddy/widget";
@@ -130,6 +131,7 @@ import truenas from "./truenas/widget";
import tubearchivist from "./tubearchivist/widget";
import unifi from "./unifi/widget";
import unmanic from "./unmanic/widget";
import unraid from "./unraid/widget";
import uptimekuma from "./uptimekuma/widget";
import uptimerobot from "./uptimerobot/widget";
import urbackup from "./urbackup/widget";
@@ -150,6 +152,7 @@ const widgets = {
authentik,
autobrr,
azuredevops,
backrest,
bazarr,
beszel,
caddy,
@@ -278,6 +281,7 @@ const widgets = {
unifi,
unifi_console: unifi,
unmanic,
unraid,
uptimekuma,
uptimerobot,
urbackup,