mirror of
https://github.com/gethomepage/homepage.git
synced 2026-01-19 00:42:08 +08:00
Enhancement: support netalertx v26.1.17 breaking changes (#6196)
This commit is contained in:
@@ -9,11 +9,17 @@ _Note that the project was renamed from PiAlert to NetAlertX._
|
|||||||
|
|
||||||
Allowed fields: `["total", "connected", "new_devices", "down_alerts"]`.
|
Allowed fields: `["total", "connected", "new_devices", "down_alerts"]`.
|
||||||
|
|
||||||
If you have enabled a password on your NetAlertX instance, you will need to provide the `SYNC_api_token` as the `key` in your config.
|
Provide the `API_TOKEN` (f.k.a. `SYNC_api_token`) as the `key` in your config.
|
||||||
|
|
||||||
|
| NetAlertX Version | Homepage Widget Version |
|
||||||
|
| ----------------- | ----------------------- |
|
||||||
|
| < v26.1.17 | 1 (default) |
|
||||||
|
| > v26.1.17 | 2 |
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
widget:
|
widget:
|
||||||
type: netalertx
|
type: netalertx
|
||||||
url: http://ip:port
|
url: http://ip:port
|
||||||
key: netalertxsyncapitoken # optional, only if password is enabled
|
key: yournetalertxapitoken
|
||||||
|
version: 2 # optional, default is 1
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -314,7 +314,7 @@ export function cleanServiceGroups(groups) {
|
|||||||
// gamedig
|
// gamedig
|
||||||
gameToken,
|
gameToken,
|
||||||
|
|
||||||
// authentik, beszel, glances, immich, komga, mealie, pihole, pfsense, speedtest
|
// authentik, beszel, glances, immich, komga, mealie, netalertx, pihole, pfsense, speedtest
|
||||||
version,
|
version,
|
||||||
|
|
||||||
// glances
|
// glances
|
||||||
@@ -559,6 +559,7 @@ export function cleanServiceGroups(groups) {
|
|||||||
"immich",
|
"immich",
|
||||||
"komga",
|
"komga",
|
||||||
"mealie",
|
"mealie",
|
||||||
|
"netalertx",
|
||||||
"pfsense",
|
"pfsense",
|
||||||
"pihole",
|
"pihole",
|
||||||
"speedtest",
|
"speedtest",
|
||||||
|
|||||||
@@ -9,7 +9,9 @@ export default function Component({ service }) {
|
|||||||
|
|
||||||
const { widget } = service;
|
const { widget } = service;
|
||||||
|
|
||||||
const { data: netalertxData, error: netalertxError } = useWidgetAPI(widget, "data");
|
const dataEndpoint = widget?.version > 1 ? "datav2" : "data";
|
||||||
|
|
||||||
|
const { data: netalertxData, error: netalertxError } = useWidgetAPI(widget, dataEndpoint);
|
||||||
|
|
||||||
if (netalertxError) {
|
if (netalertxError) {
|
||||||
return <Container service={service} error={netalertxError} />;
|
return <Container service={service} error={netalertxError} />;
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
import credentialedProxyHandler from "utils/proxy/handlers/credentialed";
|
import credentialedProxyHandler from "utils/proxy/handlers/credentialed";
|
||||||
|
|
||||||
const widget = {
|
const widget = {
|
||||||
api: "{url}/php/server/devices.php?action=getDevicesTotals",
|
api: "{url}/{endpoint}",
|
||||||
proxyHandler: credentialedProxyHandler,
|
proxyHandler: credentialedProxyHandler,
|
||||||
|
|
||||||
mappings: {
|
mappings: {
|
||||||
data: {
|
data: {
|
||||||
endpoint: "data",
|
endpoint: "php/server/devices.php?action=getDevicesTotals",
|
||||||
|
},
|
||||||
|
datav2: {
|
||||||
|
endpoint: "devices/totals",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user