From 319aa164fd6af7784c05774d6a89ed7fc557ae9c Mon Sep 17 00:00:00 2001 From: cage Date: Fri, 12 May 2023 15:49:40 +0200 Subject: [PATCH] - [GUI] saved visited links in the history kept in the database. --- src/gui/client/main-window.lisp | 6 +++++- src/gui/server/public-api-gemini-stream.lisp | 3 +++ src/gui/server/public-api.lisp | 3 +++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/gui/client/main-window.lisp b/src/gui/client/main-window.lisp index 530457c..23bb85e 100644 --- a/src/gui/client/main-window.lisp +++ b/src/gui/client/main-window.lisp @@ -364,7 +364,9 @@ (absolutize-link iri meta)))) (slurp-iri redirect-iri main-window)))) ((gemini-client:header-success-p status-code) - (slurp-non-text-data main-window iri :try-to-open nil)))))) + (ev:with-enqueued-process-and-unblock () + (comm:make-request :gemini-save-url-db-history 1 iri) + (slurp-non-text-data main-window iri :try-to-open nil))))))) (defun contextual-menu-link-clrs (link-name link-value main-window line-count) (labels ((add-to-tour-callback () @@ -783,6 +785,8 @@ (absolutize-link iri meta)))) (start-stream-iri redirect-iri main-window use-cache status)))) ((gemini-client:header-success-p status-code) + (ev:with-enqueued-process-and-unblock () + (comm:make-request :gemini-save-url-db-history 1 iri)) (cond ((eq status +stream-status-streaming+) (cond diff --git a/src/gui/server/public-api-gemini-stream.lisp b/src/gui/server/public-api-gemini-stream.lisp index 77d2748..7eb55f2 100644 --- a/src/gui/server/public-api-gemini-stream.lisp +++ b/src/gui/server/public-api-gemini-stream.lisp @@ -517,3 +517,6 @@ (write-sequence (format nil "Error connecting to: ~a:~2%" iri) stream) (write-sequence (format nil "~a~%" meta) stream)))) (gemini-parse-string gemtext))) + +(defun gemini-save-url-db-history (iri) + (db:insert-in-history (ui:open-url-prompt) iri)) diff --git a/src/gui/server/public-api.lisp b/src/gui/server/public-api.lisp index 497ef74..e4fa464 100644 --- a/src/gui/server/public-api.lisp +++ b/src/gui/server/public-api.lisp @@ -68,6 +68,9 @@ "iri" 0) (gen-rpc "gemini-current-url" 'gemini-current-url) (gen-rpc "gemini-pop-url-from-history" 'gemini-pop-url-from-history) + (gen-rpc "gemini-save-url-db-history" + 'gemini-save-url-db-history + "iri" 0) (gen-rpc "gemini-certificates" 'gemini-certificates) (gen-rpc "gemini-delete-certificate" 'gemini-delete-certificate