1
0
Fork 0

- [gemini] allowed secret input.

This commit is contained in:
cage 2020-08-18 19:14:33 +02:00
parent f4ef9ff9e8
commit 7c7d02498a
2 changed files with 16 additions and 40 deletions

View File

@ -137,7 +137,20 @@
(port (or (quri:uri-port parsed-uri)
gemini-client:+gemini-default-port+)))
(handler-case
(progn
(flet ((get-user-input (hide-input host prompt)
(flet ((on-input-complete (input)
(when (string-not-empty-p input)
(db-utils:with-ready-database (:connect nil)
(request (gemini-parser:make-gemini-uri host
path
input
port))))))
(ui:ask-string-input #'on-input-complete
:hide-input hide-input
:prompt (format nil
(_ "Server ~s asks: ~s ")
host
prompt)))))
(multiple-value-bind (status code-description meta response socket)
(gemini-client:request host
path
@ -161,22 +174,9 @@
(_ "Redirects to ~s, follows redirect? [y/N] ")
meta))))
((gemini-client:response-input-p status)
(flet ((on-input-complete (input)
(when (string-not-empty-p input)
(db-utils:with-ready-database (:connect nil)
(request (gemini-parser:make-gemini-uri host
path
input
port))))))
(ui:ask-string-input #'on-input-complete
:prompt
(format nil
(_ "Server ~s asks: ~s ")
host
meta))))
(get-user-input nil host meta))
((gemini-client:response-sensitive-input-p status)
(error 'conditions:not-implemented-error
:text "Sensitive input not implemented"))
(get-user-input t host meta))
((streamp response)
(let ((stream response))
(if (gemini-client:mime-gemini-p meta)

View File

@ -384,27 +384,3 @@ latter has a length equals to `total-size'"))
(ui:notify (format nil (_ "Error: ~a") e)
:life (* (swconf:config-notification-life) 5)
:as-error t))))
(defun make-tui-char (char
&key
(attributes nil)
(fgcolor nil)
(bgcolor nil))
"Make a `complex-char'"
(make-instance 'complex-char
:simple-char char
:attributes attributes
:fgcolor fgcolor
:bgcolor bgcolor))
(defun make-tui-string (string
&key
(attributes nil)
(fgcolor nil)
(bgcolor nil))
"Make a `complex-string' using `string' for text contents"
(make-instance 'complex-string
:string string
:attributes attributes
:fgcolor fgcolor
:bgcolor bgcolor))