mirror of
https://github.com/gethomepage/homepage.git
synced 2025-12-05 21:47:48 +01:00
Enhancement: handle gluetun port forwarded API change (#6011)
This commit is contained in:
@@ -12,11 +12,17 @@ Learn more about [Gluetun](https://github.com/qdm12/gluetun).
|
|||||||
Allowed fields: `["public_ip", "region", "country", "port_forwarded"]`.
|
Allowed fields: `["public_ip", "region", "country", "port_forwarded"]`.
|
||||||
Default fields: `["public_ip", "region", "country"]`.
|
Default fields: `["public_ip", "region", "country"]`.
|
||||||
|
|
||||||
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. Similarly, if you want to include the `port_forwarded` field, you must add the route `GET /v1/openvpn/portforwarded` to your Gluetun config.toml.
|
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. Similarly, if you want to include the `port_forwarded` field, you must add the route `GET /v1/openvpn/portforwarded` (or `/v1/portforward`) to your Gluetun config.toml.
|
||||||
|
|
||||||
|
| Gluetun Version | Homepage Widget Version |
|
||||||
|
| --------------- | ----------------------- |
|
||||||
|
| < 3.40.1 | 1 (default) |
|
||||||
|
| >= 3.40.1 | 2 |
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
widget:
|
widget:
|
||||||
type: gluetun
|
type: gluetun
|
||||||
url: http://gluetun.host.or.ip:port
|
url: http://gluetun.host.or.ip:port
|
||||||
key: gluetunkey # Not required if /v1/publicip/ip endpoint is configured with `auth = none`
|
key: gluetunkey # Not required if /v1/publicip/ip endpoint is configured with `auth = none`
|
||||||
|
version: 2 # optional, default is 1
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -563,6 +563,7 @@ export function cleanServiceGroups(groups) {
|
|||||||
"speedtest",
|
"speedtest",
|
||||||
"wgeasy",
|
"wgeasy",
|
||||||
"grafana",
|
"grafana",
|
||||||
|
"gluetun",
|
||||||
].includes(type)
|
].includes(type)
|
||||||
) {
|
) {
|
||||||
if (version) widget.version = parseInt(version, 10);
|
if (version) widget.version = parseInt(version, 10);
|
||||||
|
|||||||
@@ -12,10 +12,8 @@ export default function Component({ service }) {
|
|||||||
|
|
||||||
const { data: gluetunData, error: gluetunError } = useWidgetAPI(widget, "ip");
|
const { data: gluetunData, error: gluetunError } = useWidgetAPI(widget, "ip");
|
||||||
const includePF = widget.fields.includes("port_forwarded");
|
const includePF = widget.fields.includes("port_forwarded");
|
||||||
const { data: portForwardedData, error: portForwardedError } = useWidgetAPI(
|
const pfEndpoint = widget.version > 1 ? "port_forwarded_v2" : "port_forwarded";
|
||||||
widget,
|
const { data: portForwardedData, error: portForwardedError } = useWidgetAPI(widget, includePF ? pfEndpoint : "");
|
||||||
includePF ? "port_forwarded" : "",
|
|
||||||
);
|
|
||||||
|
|
||||||
if (gluetunError || (includePF && portForwardedError)) {
|
if (gluetunError || (includePF && portForwardedError)) {
|
||||||
return <Container service={service} error={gluetunError || portForwardedError} />;
|
return <Container service={service} error={gluetunError || portForwardedError} />;
|
||||||
|
|||||||
@@ -13,6 +13,10 @@ const widget = {
|
|||||||
endpoint: "openvpn/portforwarded",
|
endpoint: "openvpn/portforwarded",
|
||||||
validate: ["port"],
|
validate: ["port"],
|
||||||
},
|
},
|
||||||
|
port_forwarded_v2: {
|
||||||
|
endpoint: "portforward",
|
||||||
|
validate: ["port"],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user