mirror of
https://github.com/tailscale/tailscale.git
synced 2025-02-20 11:58:39 +00:00
version: detect tvOS by checking XPC_SERVICE_NAME (#8295)
Another change needed working towards #8282. Updates https://github.com/tailscale/tailscale/issues/8282 Signed-off-by: Andrea Gottardo <andrea@tailscale.com>
This commit is contained in:
parent
f8f0b981ac
commit
1c4a047ad0
@ -588,6 +588,8 @@ func osEmoji(os string) string {
|
|||||||
return "🖥️"
|
return "🖥️"
|
||||||
case "iOS":
|
case "iOS":
|
||||||
return "📱"
|
return "📱"
|
||||||
|
case "tvOS":
|
||||||
|
return "🍎📺"
|
||||||
case "android":
|
case "android":
|
||||||
return "🤖"
|
return "🤖"
|
||||||
case "freebsd":
|
case "freebsd":
|
||||||
|
@ -28,6 +28,9 @@ func OS() string {
|
|||||||
// differentiate them. Then a later Go release added GOOS=ios as a separate
|
// differentiate them. Then a later Go release added GOOS=ios as a separate
|
||||||
// platform, but by then the "iOS" and "macOS" values we'd picked, with that
|
// platform, but by then the "iOS" and "macOS" values we'd picked, with that
|
||||||
// exact capitalization, were already baked into databases.
|
// exact capitalization, were already baked into databases.
|
||||||
|
if IsAppleTV() {
|
||||||
|
return "tvOS"
|
||||||
|
}
|
||||||
if runtime.GOOS == "ios" {
|
if runtime.GOOS == "ios" {
|
||||||
return "iOS"
|
return "iOS"
|
||||||
}
|
}
|
||||||
@ -76,6 +79,19 @@ func IsMacSysExt() bool {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var isAppleTV lazy.SyncValue[bool]
|
||||||
|
|
||||||
|
// IsAppleTV reports whether this binary is part of the Tailscale network extension for tvOS.
|
||||||
|
// Needed because runtime.GOOS returns "ios" otherwise.
|
||||||
|
func IsAppleTV() bool {
|
||||||
|
if runtime.GOOS != "ios" {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return isAppleTV.Get(func() bool {
|
||||||
|
return strings.EqualFold(os.Getenv("XPC_SERVICE_NAME"), "io.tailscale.ipn.tvos.network-extension")
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
var isWindowsGUI lazy.SyncValue[bool]
|
var isWindowsGUI lazy.SyncValue[bool]
|
||||||
|
|
||||||
// IsWindowsGUI reports whether the current process is the Windows GUI.
|
// IsWindowsGUI reports whether the current process is the Windows GUI.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user