Skip to content

Commit fe95369

Browse files
committed
Add blue color to share link in ssh response
1 parent ac30514 commit fe95369

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

main.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -241,12 +241,16 @@ func main() {
241241
}
242242

243243
// Add proper ANSI escape codes to render it green-colored in a supported terminal
244+
func red(in string) string {
245+
return fmt.Sprintf("\033[0;31m%s\033[0;0m", in)
246+
}
247+
244248
func green(in string) string {
245249
return fmt.Sprintf("\033[0;32m%s\033[0;0m", in)
246250
}
247251

248-
func red(in string) string {
249-
return fmt.Sprintf("\033[0;31m%s\033[0;0m", in)
252+
func blue(in string) string {
253+
return fmt.Sprintf("\033[0;34m%s\033[0;0m", in)
250254
}
251255

252256
func expandTilde(path string) string {

ssh-server.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -191,14 +191,14 @@ func handleChannels(sshConn ssh.ServerConn, channels <-chan ssh.NewChannel) {
191191
fmt.Fprintf(channel, "\n") // After dots
192192
fmt.Fprintf(channel, green("Access granted!\n"))
193193
fmt.Fprintf(channel, "Browser: %s\n", sshTokenInfo.browserAgent)
194-
fmt.Fprintf(channel, "IP address: %s\n", sshTokenInfo.browserAddr)
195-
fmt.Fprintf(channel, "You can share access to this session via the link:\n%s\n", sshTokenInfo.browserLink)
194+
fmt.Fprintf(channel, "IP address: %s\n\n", sshTokenInfo.browserAddr)
195+
fmt.Fprintf(channel, "You can share access to this session via the link:\n"+blue("%s\n"), sshTokenInfo.browserLink)
196196
break
197197
}
198198
}
199199
// Send exit code: 0 - success
200200
// 4 zeros because answer must be uint32 (4 bytes)
201-
channel.SendRequest("exit-status", false, []byte{0,0,0,0})
201+
channel.SendRequest("exit-status", false, []byte{0, 0, 0, 0})
202202
channel.Close()
203203
sshConn.Close()
204204
// Lock and modify global var

0 commit comments

Comments
 (0)