diff --git a/docs/widgets/services/fritzbox.md b/docs/widgets/services/fritzbox.md index 22feaeb5..de63d77f 100644 --- a/docs/widgets/services/fritzbox.md +++ b/docs/widgets/services/fritzbox.md @@ -1,22 +1,22 @@ - --- - title: FRITZ!Box - description: FRITZ!Box Widget Configuration - --- +--- +title: FRITZ!Box +description: FRITZ!Box Widget Configuration +--- - Application access & UPnP must be activated on your device: +Application access & UPnP must be activated on your device: - ``` - Home Network > Network > Network Settings > Access Settings in the Home Network - [x] Allow access for applications - [x] Transmit status information over UPnP - ``` +``` +Home Network > Network > Network Settings > Access Settings in the Home Network +[x] Allow access for applications +[x] Transmit status information over UPnP +``` - You don't need to provide any credentials. +You don't need to provide any credentials. - Allowed fields (limited to a max of 4): `["connectionStatus", "upTime", "maxDown", "maxUp", "down", "up", "received", "sent", "externalIPAddress"]`. +Allowed fields (limited to a max of 4): `["connectionStatus", "upTime", "maxDown", "maxUp", "down", "up", "received", "sent", "externalIPAddress"]`. - ```yaml - widget: - type: fritzbox - url: https://192.168.178.1 - ``` +```yaml +widget: + type: fritzbox + url: https://192.168.178.1 +``` diff --git a/src/widgets/fritzbox/component.jsx b/src/widgets/fritzbox/component.jsx index a940690b..6e8bf11f 100644 --- a/src/widgets/fritzbox/component.jsx +++ b/src/widgets/fritzbox/component.jsx @@ -26,12 +26,12 @@ export default function Component({ service }) { } // Default fields - if (widget.fields == null || widget.fields.length === 0) { + if (!widget.fields?.length > 0) { widget.fields = ["connectionStatus", "uptime", "maxDown", "maxUp"]; } const MAX_ALLOWED_FIELDS = 4; // Limits max number of displayed fields - if (widget.fields != null && widget.fields.length > MAX_ALLOWED_FIELDS) { + if (widget.fields?.length > MAX_ALLOWED_FIELDS) { widget.fields = widget.fields.slice(0, MAX_ALLOWED_FIELDS); }