[client] Authorize daemon IPC callers by their local identity (#6967)

This commit is contained in:
Viktor Liu
2026-07-29 20:32:26 +02:00
committed by GitHub
parent 0b7e6a9f46
commit 0f5d2d91fb
58 changed files with 3799 additions and 167 deletions
+11 -6
View File
@@ -393,15 +393,17 @@ func (s *WindowManager) CloseWelcome() {
}
}
// OpenError shows the custom error dialog; title/message are pre-localised and ride in the
// start URL. A second error replaces the open one via SetURL. Singleton, destroyed on close.
func (s *WindowManager) OpenError(title, message string) {
// OpenError shows the custom error dialog; title/message/command are pre-localised
// and ride in the start URL. command is optional and, when set, is offered for
// copying so the user can run the operation the daemon refused. A second error
// replaces the open one via SetURL. Singleton, destroyed on close.
func (s *WindowManager) OpenError(title, message, command string) {
if ShuttingDown() {
return
}
s.mu.Lock()
defer s.mu.Unlock()
startURL := errorDialogURL(title, message)
startURL := errorDialogURL(title, message, command)
if s.errorDialog == nil {
s.errorDialog = s.app.Window.NewWithOptions(
DialogWindowOptions("error", s.title("window.title.error"), startURL, s.linuxIcon),
@@ -601,8 +603,8 @@ func (s *WindowManager) getScreenBasedOnCursorPosition() *application.Screen {
return nil
}
// errorDialogURL builds the error window's start URL with title/message as escaped query params.
func errorDialogURL(title, message string) string {
// errorDialogURL builds the error window's start URL with title/message/command as escaped query params.
func errorDialogURL(title, message, command string) string {
q := url.Values{}
if title != "" {
q.Set("title", title)
@@ -610,6 +612,9 @@ func errorDialogURL(title, message string) string {
if message != "" {
q.Set("message", message)
}
if command != "" {
q.Set("command", command)
}
startURL := "/#/dialog/error"
if enc := q.Encode(); enc != "" {
startURL += "?" + enc