mirror of https://codeberg.org/cage/tinmop/
- [gemini] allowed secret input.
This commit is contained in:
parent
f4ef9ff9e8
commit
7c7d02498a
|
@ -137,7 +137,20 @@
|
||||||
(port (or (quri:uri-port parsed-uri)
|
(port (or (quri:uri-port parsed-uri)
|
||||||
gemini-client:+gemini-default-port+)))
|
gemini-client:+gemini-default-port+)))
|
||||||
(handler-case
|
(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)
|
(multiple-value-bind (status code-description meta response socket)
|
||||||
(gemini-client:request host
|
(gemini-client:request host
|
||||||
path
|
path
|
||||||
|
@ -161,22 +174,9 @@
|
||||||
(_ "Redirects to ~s, follows redirect? [y/N] ")
|
(_ "Redirects to ~s, follows redirect? [y/N] ")
|
||||||
meta))))
|
meta))))
|
||||||
((gemini-client:response-input-p status)
|
((gemini-client:response-input-p status)
|
||||||
(flet ((on-input-complete (input)
|
(get-user-input nil host meta))
|
||||||
(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))))
|
|
||||||
((gemini-client:response-sensitive-input-p status)
|
((gemini-client:response-sensitive-input-p status)
|
||||||
(error 'conditions:not-implemented-error
|
(get-user-input t host meta))
|
||||||
:text "Sensitive input not implemented"))
|
|
||||||
((streamp response)
|
((streamp response)
|
||||||
(let ((stream response))
|
(let ((stream response))
|
||||||
(if (gemini-client:mime-gemini-p meta)
|
(if (gemini-client:mime-gemini-p meta)
|
||||||
|
|
|
@ -384,27 +384,3 @@ latter has a length equals to `total-size'"))
|
||||||
(ui:notify (format nil (_ "Error: ~a") e)
|
(ui:notify (format nil (_ "Error: ~a") e)
|
||||||
:life (* (swconf:config-notification-life) 5)
|
:life (* (swconf:config-notification-life) 5)
|
||||||
:as-error t))))
|
: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))
|
|
||||||
|
|
Loading…
Reference in New Issue