mirror of
https://github.com/gethomepage/homepage.git
synced 2026-01-05 15:02:08 +08:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dc0fede4d2 | ||
|
|
7850fe4651 | ||
|
|
524cb7695c |
@@ -10,8 +10,9 @@ 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`.
|
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", "port_forwarded"]`.
|
Allowed fields: `["public_ip", "region", "country", "port_forwarded"]`.
|
||||||
|
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.
|
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.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
widget:
|
widget:
|
||||||
|
|||||||
@@ -11,10 +11,17 @@ Note: by default `["connected", "enabled", "total"]` are displayed.
|
|||||||
|
|
||||||
To detect if a device is connected the time since the last handshake is queried. `threshold` is the time to wait in minutes since the last handshake to consider a device connected. Default is 2 minutes.
|
To detect if a device is connected the time since the last handshake is queried. `threshold` is the time to wait in minutes since the last handshake to consider a device connected. Default is 2 minutes.
|
||||||
|
|
||||||
|
| Wg-Easy API Version | Homepage Widget Version |
|
||||||
|
| ------------------- | ----------------------- |
|
||||||
|
| < v15 | 1 (default) |
|
||||||
|
| >= v15 | 2 |
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
widget:
|
widget:
|
||||||
type: wgeasy
|
type: wgeasy
|
||||||
url: http://wg.easy.or.ip
|
url: http://wg.easy.or.ip
|
||||||
|
version: 2 # optional, default is 1
|
||||||
|
username: yourwgusername # required for v15 and above
|
||||||
password: yourwgeasypassword
|
password: yourwgeasypassword
|
||||||
threshold: 2 # optional
|
threshold: 2 # optional
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "homepage",
|
"name": "homepage",
|
||||||
"version": "1.3.0",
|
"version": "1.3.1",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"preinstall": "npx only-allow pnpm",
|
"preinstall": "npx only-allow pnpm",
|
||||||
|
|||||||
@@ -497,7 +497,9 @@ export function cleanServiceGroups(groups) {
|
|||||||
if (snapshotHost) widget.snapshotHost = snapshotHost;
|
if (snapshotHost) widget.snapshotHost = snapshotHost;
|
||||||
if (snapshotPath) widget.snapshotPath = snapshotPath;
|
if (snapshotPath) widget.snapshotPath = snapshotPath;
|
||||||
}
|
}
|
||||||
if (["beszel", "glances", "immich", "komga", "mealie", "pfsense", "pihole", "speedtest"].includes(type)) {
|
if (
|
||||||
|
["beszel", "glances", "immich", "komga", "mealie", "pfsense", "pihole", "speedtest", "wgeasy"].includes(type)
|
||||||
|
) {
|
||||||
if (version) widget.version = parseInt(version, 10);
|
if (version) widget.version = parseInt(version, 10);
|
||||||
}
|
}
|
||||||
if (type === "glances") {
|
if (type === "glances") {
|
||||||
|
|||||||
@@ -101,7 +101,11 @@ export default async function credentialedProxyHandler(req, res, map) {
|
|||||||
headers.Cookie = `authenticated=${widget.key}`;
|
headers.Cookie = `authenticated=${widget.key}`;
|
||||||
}
|
}
|
||||||
} else if (widget.type === "wgeasy") {
|
} else if (widget.type === "wgeasy") {
|
||||||
headers.Authorization = widget.password;
|
if (widget.username && widget.password) {
|
||||||
|
headers.Authorization = `Basic ${Buffer.from(`${widget.username}:${widget.password}`).toString("base64")}`;
|
||||||
|
} else {
|
||||||
|
headers.Authorization = widget.password;
|
||||||
|
}
|
||||||
} else if (widget.type === "gitlab") {
|
} else if (widget.type === "gitlab") {
|
||||||
headers["PRIVATE-TOKEN"] = widget.key;
|
headers["PRIVATE-TOKEN"] = widget.key;
|
||||||
} else if (widget.type === "speedtest") {
|
} else if (widget.type === "speedtest") {
|
||||||
|
|||||||
@@ -6,14 +6,22 @@ import useWidgetAPI from "utils/proxy/use-widget-api";
|
|||||||
export default function Component({ service }) {
|
export default function Component({ service }) {
|
||||||
const { widget } = service;
|
const { widget } = service;
|
||||||
|
|
||||||
const { data: gluetunData, error: gluetunError } = useWidgetAPI(widget, "ip");
|
if (!widget.fields) {
|
||||||
const { data: portForwardedData, error: portForwardedError } = useWidgetAPI(widget, "port_forwarded");
|
widget.fields = ["public_ip", "region", "country"];
|
||||||
|
}
|
||||||
|
|
||||||
if (gluetunError || portForwardedError) {
|
const { data: gluetunData, error: gluetunError } = useWidgetAPI(widget, "ip");
|
||||||
|
const includePF = !!widget.fields["port_forwarded"];
|
||||||
|
const { data: portForwardedData, error: portForwardedError } = useWidgetAPI(
|
||||||
|
widget,
|
||||||
|
includePF ? "port_forwarded" : "",
|
||||||
|
);
|
||||||
|
|
||||||
|
if (gluetunError || (includePF && portForwardedError)) {
|
||||||
return <Container service={service} error={gluetunError || portForwardedError} />;
|
return <Container service={service} error={gluetunError || portForwardedError} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gluetunData || !portForwardedData) {
|
if (!gluetunData || (includePF && !portForwardedData)) {
|
||||||
return (
|
return (
|
||||||
<Container service={service}>
|
<Container service={service}>
|
||||||
<Block label="gluetun.public_ip" />
|
<Block label="gluetun.public_ip" />
|
||||||
@@ -29,7 +37,7 @@ export default function Component({ service }) {
|
|||||||
<Block label="gluetun.public_ip" value={gluetunData.public_ip} />
|
<Block label="gluetun.public_ip" value={gluetunData.public_ip} />
|
||||||
<Block label="gluetun.region" value={gluetunData.region} />
|
<Block label="gluetun.region" value={gluetunData.region} />
|
||||||
<Block label="gluetun.country" value={gluetunData.country} />
|
<Block label="gluetun.country" value={gluetunData.country} />
|
||||||
<Block label="gluetun.port_forwarded" value={portForwardedData.port} />
|
<Block label="gluetun.port_forwarded" value={portForwardedData?.port} />
|
||||||
</Container>
|
</Container>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,9 @@ import useWidgetAPI from "utils/proxy/use-widget-api";
|
|||||||
export default function Component({ service }) {
|
export default function Component({ service }) {
|
||||||
const { widget } = service;
|
const { widget } = service;
|
||||||
|
|
||||||
const { data: infoData, error: infoError } = useWidgetAPI(widget, "client");
|
const endpoint = widget.version === 2 ? "clientv2" : "client";
|
||||||
|
|
||||||
|
const { data: infoData, error: infoError } = useWidgetAPI(widget, endpoint);
|
||||||
|
|
||||||
if (!widget.fields) {
|
if (!widget.fields) {
|
||||||
widget.fields = ["connected", "enabled", "total"];
|
widget.fields = ["connected", "enabled", "total"];
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ const widget = {
|
|||||||
client: {
|
client: {
|
||||||
endpoint: "wireguard/client",
|
endpoint: "wireguard/client",
|
||||||
},
|
},
|
||||||
|
clientv2: {
|
||||||
|
endpoint: "client",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user