Add port_forwarded field to Gluetun widget
This commit is contained in:
parent
5512d05f00
commit
4999c92f8e
@ -5,7 +5,7 @@ description: Gluetun Widget Configuration
|
||||
|
||||
Requires [HTTP control server options](https://github.com/qdm12/gluetun-wiki/blob/main/setup/advanced/control-server.md) to be enabled.
|
||||
|
||||
Allowed fields: `["public_ip", "region", "country"]`.
|
||||
Allowed fields: `["public_ip", "region", "country", "port_forwarded"]`.
|
||||
|
||||
```yaml
|
||||
widget:
|
||||
|
||||
@ -511,7 +511,8 @@
|
||||
"gluetun": {
|
||||
"public_ip": "Public IP",
|
||||
"region": "Region",
|
||||
"country": "Country"
|
||||
"country": "Country",
|
||||
"port_forwarded": "Port Forwarded"
|
||||
},
|
||||
"hdhomerun": {
|
||||
"channels": "Channels",
|
||||
|
||||
@ -6,17 +6,19 @@ export default function Component({ service }) {
|
||||
const { widget } = service;
|
||||
|
||||
const { data: gluetunData, error: gluetunError } = useWidgetAPI(widget, "ip");
|
||||
const { data: portForwardedData, error: portForwardedError } = useWidgetAPI(widget, "port_forwarded");
|
||||
|
||||
if (gluetunError) {
|
||||
return <Container service={service} error={gluetunError} />;
|
||||
if (gluetunError || portForwardedError) {
|
||||
return <Container service={service} error={gluetunError || portForwardedError} />;
|
||||
}
|
||||
|
||||
if (!gluetunData) {
|
||||
if (!gluetunData || !portForwardedData) {
|
||||
return (
|
||||
<Container service={service}>
|
||||
<Block label="gluetun.public_ip" />
|
||||
<Block label="gluetun.region" />
|
||||
<Block label="gluetun.country" />
|
||||
<Block label="gluetun.port_forwarded" />
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
@ -26,6 +28,7 @@ export default function Component({ service }) {
|
||||
<Block label="gluetun.public_ip" value={gluetunData.public_ip} />
|
||||
<Block label="gluetun.region" value={gluetunData.region} />
|
||||
<Block label="gluetun.country" value={gluetunData.country} />
|
||||
<Block label="gluetun.port_forwarded" value={portForwardedData.port} />
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
|
||||
@ -9,6 +9,10 @@ const widget = {
|
||||
endpoint: "publicip/ip",
|
||||
validate: ["public_ip", "region", "country"],
|
||||
},
|
||||
port_forwarded: {
|
||||
endpoint: "openvpn/portforwarded",
|
||||
validate: ["port"],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user