code style & formatting

This commit is contained in:
shamoon 2023-11-26 14:23:42 -08:00
parent 4c539cf881
commit ccf360b859
2 changed files with 19 additions and 19 deletions

View File

@ -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
```

View File

@ -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);
}