Skip to content

Commit 764e58c

Browse files
authored
internal/ui: add little online indicator circles to the peer list (#132)
* internal/ui: add emoji prefixes for peer statuses * internal/ui: use peer IDs as IDs instead of their public keys * internal/ui: add a space after the circle indicators and add one for the Mullvad page * internal/ui: add a missing circle * meta: update README screenshot * meta: update some dependencies * meta: add v0.12.6 to metainfo * meta: attempt to fix workflow * cmd/trayscale: generate new `default.pgo` * meta: attempt to fix the workflow again * meta: update Go version * meta: try to fix the workflow again * meta: and again
1 parent c437ab7 commit 764e58c

File tree

10 files changed

+39
-23
lines changed

10 files changed

+39
-23
lines changed

Diff for: .github/workflows/test.yml

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
name: Lint and Test
22

33
env:
4-
image: ubuntu:23.10
54
dependencies: libgtk-4-dev libadwaita-1-dev
6-
go-version: 1.22.0
5+
go-version: 1.22.5
76

87
on:
98
workflow_dispatch:
@@ -16,8 +15,6 @@ jobs:
1615
go-vet:
1716
name: go vet
1817
runs-on: ubuntu-latest
19-
container:
20-
image: ${{ ubuntu }}
2118
steps:
2219
- name: Checkout
2320
uses: actions/checkout@v3
@@ -35,8 +32,6 @@ jobs:
3532
staticcheck:
3633
name: staticcheck
3734
runs-on: ubuntu-latest
38-
container:
39-
image: ${{ ubuntu }}
4035
steps:
4136
- name: Checkout
4237
uses: actions/checkout@v3
@@ -56,8 +51,6 @@ jobs:
5651
go-test:
5752
name: go test
5853
runs-on: ubuntu-latest
59-
container:
60-
image: ${{ ubuntu }}
6154
steps:
6255
- name: Checkout
6356
uses: actions/checkout@v3

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Trayscale is an unofficial GUI interface for the Tailscale daemon particularly f
77

88
_Disclaimer: This project is in a beta state. If it bricks your machine, it's not my fault. Use at your own risk._
99

10-
![screenshot](https://github.com/DeedleFake/trayscale/assets/326750/156e5138-ce60-4940-8cdc-67afa27fcf6f)
10+
![screenshot](https://github.com/DeedleFake/trayscale/assets/326750/103125df-2e6e-48ce-9711-82e408fddc67)
1111

1212
Tailscale Config
1313
----------------

Diff for: cmd/trayscale/default.pgo

789 Bytes
Binary file not shown.

Diff for: dev.deedles.Trayscale.metainfo.xml

+6
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@
5454
<content_rating type="oars-1.1" />
5555

5656
<releases>
57+
<release version="v0.12.6" date="2024-07-03">
58+
<description>
59+
<ul>Add online status indicators to peer list.</ul>
60+
<ul>Use node IDs to identify them instead of keys.</ul>
61+
</description>
62+
</release>
5763
<release version="v0.12.5" date="2024-07-01">
5864
<description>
5965
<ul>Remove calls to tailscale command.</ul>

Diff for: go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module deedles.dev/trayscale
22

3-
go 1.22.0
3+
go 1.22.5
44

55
require (
66
deedles.dev/mk v0.1.0
@@ -10,7 +10,7 @@ require (
1010
github.com/inhies/go-bytesize v0.0.0-20220417184213-4913239db9cf
1111
golang.org/x/net v0.26.0
1212
honnef.co/go/tools v0.4.7
13-
tailscale.com v1.68.1
13+
tailscale.com v1.68.2
1414
)
1515

1616
require (

Diff for: go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -152,5 +152,5 @@ sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E=
152152
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=
153153
software.sslmate.com/src/go-pkcs12 v0.4.0 h1:H2g08FrTvSFKUj+D309j1DPfk5APnIdAQAB8aEykJ5k=
154154
software.sslmate.com/src/go-pkcs12 v0.4.0/go.mod h1:Qiz0EyvDRJjjxGyUQa2cCNZn/wMyzrRJ/qcDXOQazLI=
155-
tailscale.com v1.68.1 h1:Fh0P1kNqI6EiN48dDiDWAIZguzIkuOo7UHDVG9ulQ2U=
156-
tailscale.com v1.68.1/go.mod h1:uqtoDEA8tw5+S+HLGqQGfpQsqeVtBS/EVVv5mXIaAoQ=
155+
tailscale.com v1.68.2 h1:nxy9HTAXPjuTbu/xzF05mS/v9ABMRGGJdPWEScTJxUo=
156+
tailscale.com v1.68.2/go.mod h1:uqtoDEA8tw5+S+HLGqQGfpQsqeVtBS/EVVv5mXIaAoQ=

Diff for: internal/ui/mullvadpage.go

+5-3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import (
1414
"tailscale.com/tailcfg"
1515
)
1616

17+
const mullvadPageBaseName = "🟡 Mullvad Exit Nodes"
18+
1719
//go:embed mullvadpage.ui
1820
var mullvadPageXML string
1921

@@ -47,7 +49,7 @@ func (page *MullvadPage) Name() string {
4749
}
4850

4951
func (page *MullvadPage) init(a *App, status tsutil.Status) {
50-
page.name = "Mullvad Exit Nodes"
52+
page.name = mullvadPageBaseName
5153

5254
page.exitNodeRows.Parent = page.ExitNodesGroup
5355
page.exitNodeRows.New = func(peer *ipnstate.PeerStatus) row[*ipnstate.PeerStatus] {
@@ -93,7 +95,7 @@ func (page *MullvadPage) init(a *App, status tsutil.Status) {
9395
}
9496

9597
func (page *MullvadPage) Update(a *App, peer *ipnstate.PeerStatus, status tsutil.Status) {
96-
page.name = "Mullvad Exit Nodes"
98+
page.name = mullvadPageBaseName
9799

98100
var exitNodeID tailcfg.StableNodeID
99101
if status.Status.ExitNodeStatus != nil {
@@ -105,7 +107,7 @@ func (page *MullvadPage) Update(a *App, peer *ipnstate.PeerStatus, status tsutil
105107
if tsutil.IsMullvad(peer) {
106108
nodes = append(nodes, peer)
107109
if peer.ID == exitNodeID {
108-
page.name = fmt.Sprintf("Mullvad Exit Nodes [%v]", mullvadExitNodeName(peer))
110+
page.name = fmt.Sprintf("%v [%v]", mullvadPageBaseName, mullvadExitNodeName(peer))
109111
}
110112
}
111113
}

Diff for: internal/ui/peerpage.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func (page *PeerPage) Root() gtk.Widgetter {
8686
}
8787

8888
func (page *PeerPage) ID() string {
89-
return page.peer.PublicKey.String()
89+
return string(page.peer.ID)
9090
}
9191

9292
func (page *PeerPage) Name() string {

Diff for: internal/ui/selfpage.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func (page *SelfPage) Root() gtk.Widgetter {
8181
}
8282

8383
func (page *SelfPage) ID() string {
84-
return page.peer.PublicKey.String()
84+
return string(page.peer.ID)
8585
}
8686

8787
func (page *SelfPage) Name() string {

Diff for: internal/ui/ui.go

+20-5
Original file line numberDiff line numberDiff line change
@@ -49,21 +49,36 @@ func readAssetString(file string) string {
4949

5050
func peerName(status tsutil.Status, peer *ipnstate.PeerStatus) string {
5151
const maxNameLength = 30
52+
self := peer.ID == status.Status.Self.ID
53+
54+
var buf strings.Builder
55+
56+
switch {
57+
case self, peer == nil:
58+
buf.WriteString("🔵 ")
59+
case peer.Online:
60+
buf.WriteString("🟢 ")
61+
default:
62+
buf.WriteString("🔴 ")
63+
}
64+
5265
name := tsutil.DNSOrQuoteHostname(status.Status, peer)
5366
if len(name) > maxNameLength {
5467
name = name[:maxNameLength-3] + "..."
5568
}
69+
buf.WriteString(name)
5670

57-
if peer.PublicKey == status.Status.Self.PublicKey {
58-
return name + " [This machine]"
71+
if self {
72+
buf.WriteString(" [This machine]")
5973
}
6074
if peer.ExitNode {
61-
return name + " [Exit node]"
75+
buf.WriteString(" [Exit node]")
6276
}
6377
if peer.ExitNodeOption {
64-
return name + " [Exit node option]"
78+
buf.WriteString(" [Exit node option]")
6579
}
66-
return name
80+
81+
return buf.String()
6782
}
6883

6984
func peerIcon(peer *ipnstate.PeerStatus) string {

0 commit comments

Comments
 (0)