Display most recent post in outbox

parent fc7e61e8
......@@ -105,7 +105,20 @@
(render-ok
(generic-base-tmpl
`(div ,(post-note-form)
(p "Hi there! This is " ,(users-name) "'s site."))))]))
(div
(h2 "Most recent post in your "
(a (@ (href ,(golem-url get-outbox)))
"outbox"))
,(match (db-ref 'outbox)
['()
'(p (i "Hey look... nothing!"))]
[(list post-uri posts-uris ...)
(define activity
(store-get-json post-uri))
(define object
(store-get-json (hash-ref activity 'object)))
`(p ,(hash-ref object 'content))]))
)))]))
(define (get-inbox req)
(render-ok
......@@ -282,8 +295,22 @@
(void))
(define/contract (db-ref collection)
(-> symbol? pair?) ;; technically list? but that's expensive :)
(hash-ref (db) collection))
(-> symbol? (or/c pair? null?)) ; technically list? but that's pricey :)
(hash-ref (db) collection '()))
;;; Store stuff
;;; ===========
(define (store-get-json url [store (magenc-store)])
(define json-str
(call-with-output-string
(lambda (p)
(magenc-get p (if (string? url)
(string->url url)
url)
store))))
(call-with-input-string json-str
read-json))
;;; Application launching
;;; =====================
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment