From d5f66e12fc887c59ff4021dcbd1195bb77c699e8 Mon Sep 17 00:00:00 2001 From: Jasper <7660824+ceramicwhite@users.noreply.github.com> Date: Mon, 12 May 2025 08:16:13 -0700 Subject: [PATCH] Enhancement: Add port_forwarded field to Gluetun widget (#2262) --- docs/widgets/services/gluetun.md | 2 +- public/locales/en/common.json | 3 ++- src/widgets/gluetun/component.jsx | 9 ++++++--- src/widgets/gluetun/widget.js | 4 ++++ 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/docs/widgets/services/gluetun.md b/docs/widgets/services/gluetun.md index 1cc68c9ad..31c18ca38 100644 --- a/docs/widgets/services/gluetun.md +++ b/docs/widgets/services/gluetun.md @@ -9,7 +9,7 @@ Learn more about [Gluetun](https://github.com/qdm12/gluetun). Requires [HTTP control server options](https://github.com/qdm12/gluetun-wiki/blob/main/setup/advanced/control-server.md) to be enabled. By default this runs on port `8000`. -Allowed fields: `["public_ip", "region", "country"]`. +Allowed fields: `["public_ip", "region", "country", "port_forwarded"]`. To setup authentication, follow [the official Gluetun documentation](https://github.com/qdm12/gluetun-wiki/blob/main/setup/advanced/control-server.md#authentication). Note that to use the api key method, you must add the route `GET /v1/publicip/ip` to the `routes` array in your Gluetun config.toml. diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 4b1758239..59926094a 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -568,7 +568,8 @@ "gluetun": { "public_ip": "Public IP", "region": "Region", - "country": "Country" + "country": "Country", + "port_forwarded": "Port Forwarded" }, "hdhomerun": { "channels": "Channels", diff --git a/src/widgets/gluetun/component.jsx b/src/widgets/gluetun/component.jsx index f71282371..640d225df 100644 --- a/src/widgets/gluetun/component.jsx +++ b/src/widgets/gluetun/component.jsx @@ -7,17 +7,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 ; + if (gluetunError || portForwardedError) { + return ; } - if (!gluetunData) { + if (!gluetunData || !portForwardedData) { return ( + ); } @@ -27,6 +29,7 @@ export default function Component({ service }) { + ); } diff --git a/src/widgets/gluetun/widget.js b/src/widgets/gluetun/widget.js index 2733cec65..465307306 100644 --- a/src/widgets/gluetun/widget.js +++ b/src/widgets/gluetun/widget.js @@ -9,6 +9,10 @@ const widget = { endpoint: "publicip/ip", validate: ["public_ip", "country"], }, + port_forwarded: { + endpoint: "openvpn/portforwarded", + validate: ["port"], + }, }, };