From 2368b88eb18e70975023bdf06f11c81a2d36769a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claes=20Hallstr=C3=B6m?= Date: Tue, 3 Oct 2023 20:14:18 +0200 Subject: [PATCH] Add more fields to tailscale widget hostname is the machine name in the admin console. name is the MagicDNS name of the device. clientVersion is the version of the Tailscale client software. --- docs/widgets/services/tailscale.md | 2 +- public/locales/en/common.json | 5 ++++- src/widgets/tailscale/component.jsx | 9 +++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/docs/widgets/services/tailscale.md b/docs/widgets/services/tailscale.md index 0db502c9..5cd310c0 100644 --- a/docs/widgets/services/tailscale.md +++ b/docs/widgets/services/tailscale.md @@ -7,7 +7,7 @@ You will need to generate an API access token from the [keys page](https://login To find your device ID, go to the [machine overview page](https://login.tailscale.com/admin/machines) and select your machine. In the "Machine Details" section, copy your `ID`. It will end with `CNTRL`. -Allowed fields: `["address", "last_seen", "expires"]`. +Allowed fields: `["hostname", "address", "name", "last_seen", "expires", "client_version"]`. ```yaml widget: diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 813c8e2a..e19df0d6 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -266,7 +266,9 @@ "total": "Total" }, "tailscale": { + "hostname": "Hostname", "address": "Address", + "name": "Name", "expires": "Expires", "never": "Never", "last_seen": "Last Seen", @@ -277,7 +279,8 @@ "hours": "{{number}}h", "minutes": "{{number}}m", "seconds": "{{number}}s", - "ago": "{{value}} Ago" + "ago": "{{value}} Ago", + "client_version": "Client Version" }, "tdarr": { "queue": "Queue", diff --git a/src/widgets/tailscale/component.jsx b/src/widgets/tailscale/component.jsx index 3929b2ed..29353781 100644 --- a/src/widgets/tailscale/component.jsx +++ b/src/widgets/tailscale/component.jsx @@ -18,18 +18,24 @@ export default function Component({ service }) { if (!statsData) { return ( + + + ); } const { + hostname, addresses: [address], + name, keyExpiryDisabled, lastSeen, expires, + clientVersion, } = statsData; const now = new Date(); @@ -64,9 +70,12 @@ export default function Component({ service }) { return ( + + + ); }