client/web: use network profile for displaying tailnet info
Also update to use the new DisplayNameOrDefault. Updates tailscale/corp#30456 Change-Id: Ia101a4a3005adb9118051b3416f5a64a4a45987d Signed-off-by: Will Norris <will@tailscale.com>
This commit is contained in:
+12
-3
@@ -978,9 +978,18 @@ func (s *Server) serveGetNodeData(w http.ResponseWriter, r *http.Request) {
|
|||||||
data.ClientVersion = cv
|
data.ClientVersion = cv
|
||||||
}
|
}
|
||||||
|
|
||||||
if st.CurrentTailnet != nil {
|
profile, _, err := s.lc.ProfileStatus(r.Context())
|
||||||
data.TailnetName = st.CurrentTailnet.MagicDNSSuffix
|
if err != nil {
|
||||||
data.DomainName = st.CurrentTailnet.Name
|
s.logf("error fetching profiles: %v", err)
|
||||||
|
// If for some reason we can't fetch profiles,
|
||||||
|
// continue to use st.CurrentTailnet if set.
|
||||||
|
if st.CurrentTailnet != nil {
|
||||||
|
data.TailnetName = st.CurrentTailnet.MagicDNSSuffix
|
||||||
|
data.DomainName = st.CurrentTailnet.Name
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
data.TailnetName = profile.NetworkProfile.MagicDNSName
|
||||||
|
data.DomainName = profile.NetworkProfile.DisplayNameOrDefault()
|
||||||
}
|
}
|
||||||
if st.Self.Tags != nil {
|
if st.Self.Tags != nil {
|
||||||
data.Tags = st.Self.Tags.AsSlice()
|
data.Tags = st.Self.Tags.AsSlice()
|
||||||
|
|||||||
Reference in New Issue
Block a user