pinwheel: Name the exit node in the tailscale connect notification
The notification shows the exit node's hostname, followed by its city and country when tailscale knows the node's location.
This commit is contained in:
1 file changed
+6
-1
@@ -75,7 +75,12 @@ let
|
|||||||
if [ "$EXIT_NODE_ONLINE" == "true" ]; then
|
if [ "$EXIT_NODE_ONLINE" == "true" ]; then
|
||||||
tailscale set --exit-node="" && ${pkgs.libnotify}/bin/notify-send "Disconnected from Exit Node"
|
tailscale set --exit-node="" && ${pkgs.libnotify}/bin/notify-send "Disconnected from Exit Node"
|
||||||
else
|
else
|
||||||
tailscale set --exit-node=$PREFERRED_EXIT_NODE && ${pkgs.libnotify}/bin/notify-send "Connected to Exit Node"
|
tailscale set --exit-node=$PREFERRED_EXIT_NODE || exit 1
|
||||||
|
|
||||||
|
EXIT_NODE_NAME=$(tailscale status --json | ${pkgs.jq}/bin/jq -r '
|
||||||
|
.Peer.[] | select(.ExitNode)
|
||||||
|
| .HostName + (if .Location then " (\(.Location.City), \(.Location.Country))" else "" end)')
|
||||||
|
${pkgs.libnotify}/bin/notify-send "Connected to Exit Node" "$EXIT_NODE_NAME"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user