1
0
Fork 0

- [GUI] added callback for toolbar certificate button (change password for certificate).

This commit is contained in:
cage 2024-02-15 16:39:56 +01:00
parent 8a2ba82b0d
commit ecfd7a19cd
4 changed files with 42 additions and 19 deletions

View File

@ -70,25 +70,7 @@
(second row-values)))
(change-passphrase ()
(a:when-let ((file-path (key-path)))
(handler-case
(multiple-value-bind (old-password new-password)
(gui-mw:change-password-dialog treeview-widget
(_ "Change password")
(_ "Change the password of the certificate")
(_ "Old password")
(_ "New password")
(_ "Repeat new password")
(_ "password and confirmation does not match")
:button-message (_ "OK"))
(os-utils:change-ssl-key-passphrase file-path
old-password
new-password)
(gui-goodies:info-dialog treeview-widget
(format nil
(_ "Password changed for key")
file-path)))
(error (e)
(gui-goodies:error-dialog treeview-widget (format nil "~a" e))))))
(client-main-window::change-client-certificate-key-passphrase treeview-widget file-path)))
(copy-key-path ()
(a:when-let ((file-path (key-path)))
(os-utils:copy-to-clipboard file-path)

View File

@ -1302,6 +1302,36 @@ local file paths."
main-window))
(print-info-message (_ "Tour is terminated") :bold t)))))
(defun change-client-certificate-key-passphrase (parent-widget key-path)
(handler-case
(multiple-value-bind (old-password new-password)
(gui-mw:change-password-dialog parent-widget
(_ "Change password")
(_ "Change the password of the certificate")
(_ "Old password")
(_ "New password")
(_ "Repeat new password")
(_ "password and confirmation does not match")
:button-message (_ "OK"))
(os-utils:change-ssl-key-passphrase key-path
old-password
new-password)
(gui-goodies:info-dialog parent-widget
(format nil
(_ "Password changed for key")
key-path)))
(error (e)
(gui-goodies:error-dialog parent-widget (format nil "~a" e)))))
(defun change-client-certificate-passphrase-clsr (main-window)
(lambda ()
(a:when-let ((key-path
(cev:enqueue-request-and-wait-results :gemini-url-certificate-keypath
1
ev:+standard-event-priority+
(get-address-bar-text main-window))))
(change-client-certificate-key-passphrase main-window key-path))))
(defun setup-main-window-events (main-window)
(with-accessors ((tool-bar tool-bar)
(toc-frame toc-frame)
@ -1333,6 +1363,8 @@ local file paths."
(setf (gui:command reload-button) (reload-iri-clsr main-window))
(setf (gui:command back-button) (back-iri-clsr main-window))
(setf (gui:command up-button) (up-iri-clsr main-window))
(setf (gui:command certificate-button)
(change-client-certificate-passphrase-clsr main-window))
(setf (gui:command bookmark-button) (toggle-bookmark-iri-clsr main-window))
(setf (gui:command tour-button) (tour-visit-next-iri-clsr main-window))
(setf (gui:command subscribe-button) (toggle-subscribtion-iri-clsr main-window))

View File

@ -75,6 +75,12 @@
(gemini-client:save-cache-certificate-password certificate-path password)
t)
(defun gemini-url-certificate-keypath (url)
(multiple-value-bind (x keypath)
(gemini-client:fetch-cached-certificate url :if-does-not-exist nil)
(declare (ignore x))
keypath))
(defun gemini-url-using-certificate-p (url)
(a:when-let* ((certificate-path (gemini-client:fetch-cached-certificate url
:if-does-not-exist nil))

View File

@ -96,6 +96,9 @@
(gen-rpc "gemini-url-using-certificate-p"
'gemini-url-using-certificate-p
"url" 0)
(gen-rpc "gemini-url-certificate-keypath"
'gemini-url-certificate-keypath
"url" 0)
(gen-rpc "gemini-table-of-contents"
'gemini-table-of-contents
"iri" 0