IsMacAppStore returns whether this binary is from the App Store version of Tailscale for macOS. Returns true for both the network extension and the GUI app.
()
| 130 | // IsMacAppStore returns whether this binary is from the App Store version of Tailscale |
| 131 | // for macOS. Returns true for both the network extension and the GUI app. |
| 132 | func IsMacAppStore() bool { |
| 133 | if runtime.GOOS != "darwin" { |
| 134 | return false |
| 135 | } |
| 136 | return isMacAppStore.Get(func() bool { |
| 137 | if AppIdentifierFn != nil { |
| 138 | id := AppIdentifierFn() |
| 139 | return id == appStoreBundleID || id == appStoreExtBundleId |
| 140 | } |
| 141 | // TODO (barnstar): This check should be redundant once all relevant callers |
| 142 | // use AppIdentifierFn. |
| 143 | // Both macsys and app store versions can run CLI executable with |
| 144 | // suffix /Contents/MacOS/Tailscale. Check $HOME to filter out running |
| 145 | // as macsys. |
| 146 | return strings.Contains(os.Getenv("HOME"), "/Containers/io.tailscale.ipn.macos/") || |
| 147 | strings.Contains(os.Getenv("XPC_SERVICE_NAME"), appStoreBundleID) |
| 148 | }) |
| 149 | } |
| 150 | |
| 151 | var isMacAppStoreGUI lazy.SyncValue[bool] |
| 152 |
no test coverage detected
searching dependent graphs…