From 82129ba288f7561c89bb80e04841ffb46bc29889 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Mon, 17 May 2021 18:14:28 +0200 Subject: ui: show update tab but not alert for limited user Suggested-by: Diab Neiroukh Signed-off-by: Jason A. Donenfeld --- manager/ipc_server.go | 5 +---- ui/ui.go | 2 +- ui/updatepage.go | 6 ++++++ 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/manager/ipc_server.go b/manager/ipc_server.go index b9b1eb8c..fe195094 100644 --- a/manager/ipc_server.go +++ b/manager/ipc_server.go @@ -290,9 +290,6 @@ func (s *ManagerService) Quit(stopTunnelsOnQuit bool) (alreadyQuit bool, err err } func (s *ManagerService) UpdateState() UpdateState { - if s.elevatedToken == 0 { - return UpdateStateUnknown - } return updateState } @@ -551,7 +548,7 @@ func IPCServerNotifyTunnelsChange() { } func IPCServerNotifyUpdateFound(state UpdateState) { - notifyAll(UpdateFoundNotificationType, true, state) + notifyAll(UpdateFoundNotificationType, false, state) } func IPCServerNotifyUpdateProgress(dp updater.DownloadProgress) { diff --git a/ui/ui.go b/ui/ui.go index 55b846fc..7e910474 100644 --- a/ui/ui.go +++ b/ui/ui.go @@ -73,7 +73,7 @@ func RunUI() { switch updateState { case manager.UpdateStateFoundUpdate: mtw.UpdateFound() - if tray != nil { + if tray != nil && IsAdmin { tray.UpdateFound() } case manager.UpdateStateUpdatesDisabledUnofficialBuild: diff --git a/ui/updatepage.go b/ui/updatepage.go index cb76da6f..96fc87f3 100644 --- a/ui/updatepage.go +++ b/ui/updatepage.go @@ -64,6 +64,12 @@ func NewUpdatePage() (*UpdatePage, error) { button.SetImage(updateIcon) button.SetText(l18n.Sprintf("Update Now")) + if !IsAdmin { + button.SetText(l18n.Sprintf("Please ask the system administrator to update.")) + button.SetEnabled(false) + status.SetText(l18n.Sprintf("Status: Waiting for administrator")) + } + walk.NewVSpacer(up) switchToUpdatingState := func() { -- cgit v1.2.3-59-g8ed1b