1
0
Fork 0

- allowed pushing in the address visited queue only gemtext pages and gopher menu.

This commit is contained in:
cage 2022-09-04 16:37:51 +02:00
parent b3f37fb350
commit 72cef9943b
2 changed files with 44 additions and 46 deletions

View File

@ -547,7 +547,6 @@
:running)))) :running))))
(multiple-value-bind (actual-iri host path query port fragment) (multiple-value-bind (actual-iri host path query port fragment)
(gemini-client:displace-iri parsed-iri) (gemini-client:displace-iri parsed-iri)
(declare (ignore actual-iri))
(gemini-client:debug-gemini "response is a stream") (gemini-client:debug-gemini "response is a stream")
(labels ((make-text-based-stream (gemini-format-p) (labels ((make-text-based-stream (gemini-format-p)
(let* ((starting-status (starting-status meta)) (let* ((starting-status (starting-status meta))
@ -586,6 +585,7 @@
(cond (cond
((gemini-client:gemini-file-stream-p meta) ((gemini-client:gemini-file-stream-p meta)
(gemini-client:debug-gemini "response is a gemini document stream") (gemini-client:debug-gemini "response is a gemini document stream")
(push-url-to-history specials:*message-window* actual-iri)
(make-text-based-stream t)) (make-text-based-stream t))
((gemini-client:text-file-stream-p meta) ((gemini-client:text-file-stream-p meta)
(gemini-client:debug-gemini "response is a text stream") (gemini-client:debug-gemini "response is a text stream")
@ -712,7 +712,6 @@
(if (find-db-stream-url actual-iri) (if (find-db-stream-url actual-iri)
(progn (progn
(gemini-client:debug-gemini "caching found for ~a" actual-iri) (gemini-client:debug-gemini "caching found for ~a" actual-iri)
(push-url-to-history specials:*message-window* actual-iri)
(db-entry-to-foreground actual-iri)) (db-entry-to-foreground actual-iri))
(progn (progn
(gemini-client:debug-gemini "caching *not* found for ~a" actual-iri) (gemini-client:debug-gemini "caching *not* found for ~a" actual-iri)
@ -727,7 +726,6 @@
(find-db-stream-url actual-iri))) (find-db-stream-url actual-iri)))
(when (null enqueue) (when (null enqueue)
(ensure-just-one-stream-rendering)) (ensure-just-one-stream-rendering))
(push-url-to-history specials:*message-window* actual-iri)
(gemini-client:request-dispatch url (gemini-client:request-dispatch url
gemini-client::dispatch-table gemini-client::dispatch-table
:certificate certificate :certificate certificate

View File

@ -212,49 +212,49 @@
port port
type type
selector))) selector)))
(gemini-viewer:push-url-to-history message-win link))) (cond
(cond ((gopher-parser::%line-type-dir-p type)
((gopher-parser::%line-type-dir-p type) (gemini-viewer:push-url-to-history message-win link)
(let ((data (misc:make-fresh-array 0 :type '(unsigned-int 8)))) (let ((data (misc:make-fresh-array 0 :type '(unsigned-int 8))))
(gopher-client:request host (gopher-client:request host
type type
:port port :port port
:selector selector :selector selector
:collect-fn (gopher-client:make-collect-fn data)) :collect-fn (gopher-client:make-collect-fn data))
(init) (init)
(ui:focus-to-gopher-window) (ui:focus-to-gopher-window)
(print-response-rows *gopher-window* (print-response-rows *gopher-window*
(gopher-parser:parse-menu (text-utils:to-s data))) (gopher-parser:parse-menu (text-utils:to-s data)))
(select-row *gopher-window* 0) (select-row *gopher-window* 0)
(draw *gopher-window*))) (draw *gopher-window*)))
((gopher-parser::%line-type-file-p type) ((gopher-parser::%line-type-file-p type)
(win-close *gopher-window*) (win-close *gopher-window*)
(let ((data (misc:make-fresh-array 0 :type '(unsigned-int 8)))) (let ((data (misc:make-fresh-array 0 :type '(unsigned-int 8))))
(gopher-client:request host (gopher-client:request host
type type
:port port :port port
:selector selector :selector selector
:collect-fn (gopher-client:make-collect-fn data)) :collect-fn (gopher-client:make-collect-fn data))
(let* ((text (to-s data)) (let* ((text (to-s data))
(raw-lines (split-lines (gopher-parser:parse-text-file text))) (raw-lines (split-lines (gopher-parser:parse-text-file text)))
(lines (mapcar (lambda (a) (lines (mapcar (lambda (a)
(message-window:text->rendered-lines-rows *message-window* (message-window:text->rendered-lines-rows *message-window*
a)) a))
raw-lines))) raw-lines)))
(line-oriented-window:update-all-rows *message-window* (a:flatten lines)) (line-oriented-window:update-all-rows *message-window* (a:flatten lines))
(draw *message-window*) (draw *message-window*)
(ui:focus-to-message-window)))) (ui:focus-to-message-window))))
(t (t
(fs:with-anaphoric-temp-file (stream) (fs:with-anaphoric-temp-file (stream)
(gopher-client:request host (gopher-client:request host
type type
:port port :port port
:selector selector :selector selector
:collect-fn (lambda (buffer) :collect-fn (lambda (buffer)
(write-sequence buffer stream))) (write-sequence buffer stream)))
(finish-output stream) (finish-output stream)
(os-utils:open-resource-with-external-program filesystem-utils:temp-file (os-utils:open-resource-with-external-program filesystem-utils:temp-file
nil))))) nil)))))))
(defun open-menu-link () (defun open-menu-link ()
(a:when-let* ((win *gopher-window*) (a:when-let* ((win *gopher-window*)