mirror of
https://codeberg.org/cage/tinmop/
synced 2025-02-21 08:50:51 +01:00
- [rpc] returned an error if a gemini stream can not be foud in 'gemini-stream-info'.
This commit is contained in:
parent
5052c21fe3
commit
f0862e3903
@ -209,25 +209,24 @@
|
|||||||
(defun rearrange-parsed-line-for-encoding (lines)
|
(defun rearrange-parsed-line-for-encoding (lines)
|
||||||
(flet ((contains-chldren-p (node)
|
(flet ((contains-chldren-p (node)
|
||||||
(evenp (length node))))
|
(evenp (length node))))
|
||||||
(cons "lines"
|
(loop for line in lines
|
||||||
(loop for line in lines
|
collect
|
||||||
collect
|
(let ((flattened (mapcar #'rearrange-for-encoding (a:flatten line))))
|
||||||
(let ((flattened (mapcar #'rearrange-for-encoding (a:flatten line))))
|
(when flattened
|
||||||
(when flattened
|
(if (contains-chldren-p flattened)
|
||||||
(if (contains-chldren-p flattened)
|
(append (list (cons "type" (first flattened)))
|
||||||
(append (list (cons "type" (first flattened)))
|
(loop for (a b) on (subseq flattened
|
||||||
(loop for (a b) on (subseq flattened
|
1
|
||||||
1
|
(1- (length flattened)))
|
||||||
(1- (length flattened)))
|
by 'cddr
|
||||||
by 'cddr
|
collect
|
||||||
collect
|
(cons a b))
|
||||||
(cons a b))
|
(list (cons "line" (a:last-elt flattened))))
|
||||||
(list (cons "line" (a:last-elt flattened))))
|
(append (list (cons "type" (first flattened)))
|
||||||
(append (list (cons "type" (first flattened)))
|
(loop for (a b) on (subseq flattened 1)
|
||||||
(loop for (a b) on (subseq flattened 1)
|
by 'cddr
|
||||||
by 'cddr
|
collect
|
||||||
collect
|
(cons a b)))))))))
|
||||||
(cons a b))))))))))
|
|
||||||
|
|
||||||
(defmethod rpc::render-as-list ((object gw:gemini-stream))
|
(defmethod rpc::render-as-list ((object gw:gemini-stream))
|
||||||
(with-accessors ((stream-status gw:stream-status)
|
(with-accessors ((stream-status gw:stream-status)
|
||||||
@ -268,12 +267,13 @@
|
|||||||
(>= line-number 0)
|
(>= line-number 0)
|
||||||
(< line-number (length parsed-lines)))
|
(< line-number (length parsed-lines)))
|
||||||
(let ((res (rearrange-parsed-line-for-encoding (list (elt parsed-lines line-number)))))
|
(let ((res (rearrange-parsed-line-for-encoding (list (elt parsed-lines line-number)))))
|
||||||
(misc:dbg "res ~a res")
|
|
||||||
res))))
|
res))))
|
||||||
|
|
||||||
(defun gemini-stream-info (iri)
|
(defun gemini-stream-info (iri)
|
||||||
(a:when-let ((stream-wrapper (gw:find-db-stream-url iri)))
|
(let ((stream-wrapper (gw:find-db-stream-url iri)))
|
||||||
(rpc::render-as-list stream-wrapper)))
|
(if stream-wrapper
|
||||||
|
(rpc::render-as-list stream-wrapper)
|
||||||
|
(error "no such stream"))))
|
||||||
|
|
||||||
(defmacro prepare-rpc (&body body)
|
(defmacro prepare-rpc (&body body)
|
||||||
`(let ((rpc:*function-db* '()))
|
`(let ((rpc:*function-db* '()))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user