From e90f39a58c2cbaa526d5bf9a424f488635dca259 Mon Sep 17 00:00:00 2001 From: Moritz Poldrack <33086936+mpldr@users.noreply.github.com> Date: Thu, 15 Feb 2024 22:55:48 +0100 Subject: [PATCH] cmd/tailscale/main: apply custom control server on first start (#156) Currently the custom control server is not applied on start. To remedy this, check the stored preference and if they differ issue an event to switch to the correct backend server. Updates: tailscale/tailscale#17470 Signed-off-by: Moritz Poldrack --- cmd/tailscale/main.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/tailscale/main.go b/cmd/tailscale/main.go index 5773cee..7c75aff 100644 --- a/cmd/tailscale/main.go +++ b/cmd/tailscale/main.go @@ -1302,6 +1302,11 @@ func (a *App) processUIEvents(w *app.Window, events []UIEvent, act jni.Object, s a.signOut() requestBackend(e) case ConnectEvent: + if srv, _ := a.store.ReadString(customLoginServerPrefKey, ""); srv != state.backend.Prefs.ControlURL { + requestBackend(SetLoginServerEvent{URL: srv}) + // wait a moment for the backend to restart + <-time.After(200 * time.Millisecond) + } requestBackend(e) case RouteAllEvent: requestBackend(e)