1
0
Fork 0

- [rpc] added 'gemini-stream-parsed-line'.

This commit is contained in:
cage 2023-01-01 18:31:27 +01:00
parent a6a8b0ad8f
commit cbb447a84e
1 changed files with 14 additions and 1 deletions

View File

@ -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))