diff --git a/cmd/tailscale/main.go b/cmd/tailscale/main.go index 0686458..03c0a2c 100644 --- a/cmd/tailscale/main.go +++ b/cmd/tailscale/main.go @@ -441,9 +441,15 @@ func (a *App) runBackend() error { case SetLoginServerEvent: state.Prefs.ControlURL = e.URL b.backend.SetPrefs(state.Prefs) - // A hack to get around ipnlocal's inability to update - // ControlURL after Start()... Can we re-init instead? - os.Exit(0) + // Need to restart to force the login URL to be regenerated + // with the new control URL. Start from a goroutine to avoid + // deadlock. + go func() { + err := b.backend.Start(ipn.Options{}) + if err != nil { + fatalErr(err) + } + }() case LogoutEvent: go b.backend.Logout() case ConnectEvent: diff --git a/cmd/tailscale/ui.go b/cmd/tailscale/ui.go index 118ec79..15a73d1 100644 --- a/cmd/tailscale/ui.go +++ b/cmd/tailscale/ui.go @@ -396,8 +396,9 @@ func (ui *UI) layout(gtx layout.Context, sysIns system.Insets, state *clientStat if ui.loginServerSave.Clicked() { text := ui.loginServer.Text() - ui.showMessage(gtx, "Login server saved, relaunch the app") + ui.showMessage(gtx, "Login server saved") events = append(events, SetLoginServerEvent{URL: text}) + ui.setLoginServer = false } if ui.loginServerCancel.Clicked() { ui.setLoginServer = false @@ -725,7 +726,7 @@ func (ui *UI) layoutSignIn(gtx layout.Context, state *BackendState) layout.Dimen layout.Rigid(func(gtx C) D { return layout.Inset{Bottom: unit.Dp(16)}.Layout(gtx, func(gtx C) D { return border.Layout(gtx, func(gtx C) D { - button := material.Button(ui.theme, &ui.loginServerSave, "Save and restart") + button := material.Button(ui.theme, &ui.loginServerSave, "Save") button.Background = color.NRGBA{} // transparent button.Color = rgb(textColor) return button.Layout(gtx)