1
0
Fork 0

- [gemini] starting download thread in ':rendering' status.

This commit is contained in:
cage 2020-08-29 11:13:29 +02:00
parent 4941c21d94
commit 1c3a3d9bff
1 changed files with 31 additions and 19 deletions

View File

@ -242,7 +242,7 @@
(%fill-buffer)))))) (%fill-buffer))))))
(%fill-buffer)))))) (%fill-buffer))))))
(defun request (url) (defun request (url &key (enqueue nil))
(let ((parsed-uri (quri:uri url))) (let ((parsed-uri (quri:uri url)))
(maybe-initialize-metadata specials:*message-window*) (maybe-initialize-metadata specials:*message-window*)
(if (null parsed-uri) (if (null parsed-uri)
@ -255,7 +255,17 @@
(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
(flet ((get-user-input (hide-input host prompt) (labels ((gemini-file-stream-p (meta)
(gemini-client:mime-gemini-p meta))
(starting-status (meta)
(if (gemini-file-stream-p meta)
(if enqueue
nil
:rendering)
(if enqueue
nil
nil)))
(get-user-input (hide-input host prompt)
(flet ((on-input-complete (input) (flet ((on-input-complete (input)
(when (string-not-empty-p input) (when (string-not-empty-p input)
(db-utils:with-ready-database (:connect nil) (db-utils:with-ready-database (:connect nil)
@ -296,8 +306,10 @@
((gemini-client:response-sensitive-input-p status) ((gemini-client:response-sensitive-input-p status)
(get-user-input t host meta)) (get-user-input t host meta))
((streamp response) ((streamp response)
(if (gemini-client:mime-gemini-p meta) (if (gemini-file-stream-p meta)
(let* ((gemini-stream (make-instance 'gemini-file-stream (let* ((starting-status (starting-status meta))
(gemini-stream (make-instance 'gemini-file-stream
:stream-status starting-status
:download-stream response :download-stream response
:download-socket socket)) :download-socket socket))
(thread-fn (thread-fn