From cbb447a84e70f0114537aab261065e96d0d7e248 Mon Sep 17 00:00:00 2001 From: cage Date: Sun, 1 Jan 2023 18:31:27 +0100 Subject: [PATCH] - [rpc] added 'gemini-stream-parsed-line'. --- src/gui/public-api.lisp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/gui/public-api.lisp b/src/gui/public-api.lisp index 5530918..6b66655 100644 --- a/src/gui/public-api.lisp +++ b/src/gui/public-api.lisp @@ -213,7 +213,6 @@ (loop for line in lines collect (let ((flattened (mapcar #'rearrange-for-encoding (a:flatten line)))) - (misc:dbg "flattened ~s ~s" flattened (contains-chldren-p flattened)) (when flattened (if (contains-chldren-p flattened) (append (list (cons "type" (first flattened))) @@ -262,6 +261,16 @@ (cons "fragment" fragment) (cons "host" host))))) +(defun gemini-stream-parsed-line (iri line-number) + (a:when-let* ((stream-wrapper (gw:find-db-stream-url iri)) + (parsed-lines (gw:parsed-lines stream-wrapper))) + (when (and (integerp line-number) + (>= line-number 0) + (< line-number (length parsed-lines))) + (let ((res (rearrange-parsed-line-for-encoding (list (elt parsed-lines line-number))))) + (misc:dbg "res ~a res") + res)))) + (defun gemini-stream-info (iri) (a:when-let ((stream-wrapper (gw:find-db-stream-url iri))) (rpc::render-as-list stream-wrapper))) @@ -282,4 +291,8 @@ (gen-rpc "gemini-stream-info" 'gemini-stream-info "iri" 0) + (gen-rpc "gemini-stream-parsed-line" + 'gemini-stream-parsed-line + "iri" 0 + "line-number" 1) ,@body))