|
|
|
@ -25,20 +25,19 @@
|
|
|
|
|
|
|
|
|
|
(def masto-embed "masto-embed")
|
|
|
|
|
|
|
|
|
|
(defn host-url-from-document []
|
|
|
|
|
(defn element-from-document-by-name [name]
|
|
|
|
|
(-> js/document
|
|
|
|
|
(.getElementById masto-embed)
|
|
|
|
|
(.getAttribute "host_url")))
|
|
|
|
|
(.getAttribute name)))
|
|
|
|
|
|
|
|
|
|
(defn host-url-from-document []
|
|
|
|
|
(element-from-document-by-name "host_url"))
|
|
|
|
|
|
|
|
|
|
(defn account-name-from-document []
|
|
|
|
|
(-> js/document
|
|
|
|
|
(.getElementById masto-embed)
|
|
|
|
|
(.getAttribute "account_name")))
|
|
|
|
|
(element-from-document-by-name "account_name"))
|
|
|
|
|
|
|
|
|
|
(defn account-id-from-document []
|
|
|
|
|
(-> js/document
|
|
|
|
|
(.getElementById masto-embed)
|
|
|
|
|
(.getAttribute "account_id")))
|
|
|
|
|
(element-from-document-by-name "account_id"))
|
|
|
|
|
|
|
|
|
|
(defn render-to-document
|
|
|
|
|
[input]
|
|
|
|
@ -60,20 +59,45 @@
|
|
|
|
|
first)))
|
|
|
|
|
out))
|
|
|
|
|
|
|
|
|
|
(defn favorited-replies? [host-url reply-id account-name]
|
|
|
|
|
(let [out (chan)]
|
|
|
|
|
(go (>! out
|
|
|
|
|
(->>
|
|
|
|
|
(<p! (api/get-favorited-by host-url reply-id))
|
|
|
|
|
api/mastojs->edn
|
|
|
|
|
(filter #(= account-name (:acct %)))
|
|
|
|
|
)))
|
|
|
|
|
out))
|
|
|
|
|
|
|
|
|
|
(defn init []
|
|
|
|
|
(go
|
|
|
|
|
(let [host-url (host-url-from-document)
|
|
|
|
|
account-name (account-name-from-document)
|
|
|
|
|
account-id (or
|
|
|
|
|
account-id (or
|
|
|
|
|
(account-id-from-document)
|
|
|
|
|
(<! (find-account-id host-url account-name)))
|
|
|
|
|
statuus (->
|
|
|
|
|
(<p! (api/get-account-statuses host-url account-id))
|
|
|
|
|
api/mastojs->edn)
|
|
|
|
|
test-status (->
|
|
|
|
|
(<p! (api/get-favorited-by host-url "107779492679907372"))
|
|
|
|
|
api/mastojs->edn)
|
|
|
|
|
filtered (filter #(go (<! (favorited-replies? host-url "107779739758156958" "bastian@digitalcourage.social"))) (:descendants test-status))
|
|
|
|
|
]
|
|
|
|
|
(->> statuus
|
|
|
|
|
(take 4)
|
|
|
|
|
(rb/masto->html)
|
|
|
|
|
(render-html)
|
|
|
|
|
(render-to-document))
|
|
|
|
|
;(->> statuus
|
|
|
|
|
; (take 4)
|
|
|
|
|
; (rb/masto->html)
|
|
|
|
|
; (render-html)
|
|
|
|
|
; (render-to-document))
|
|
|
|
|
;(go (infra/debug (<! (favorited-replies? host-url "107779739758156958" "team@meissa.social"))))
|
|
|
|
|
;(go (let [test (api/mastojs->edn (<p! (api/get-favorited-by host-url "107779739758156958")))]
|
|
|
|
|
; (infra/debug (filter #(= "team@meissa.social" (:acct %)) test))))
|
|
|
|
|
(infra/debug test-status)
|
|
|
|
|
;(->> filtered
|
|
|
|
|
; (infra/debug)
|
|
|
|
|
; (rb/masto->html)
|
|
|
|
|
; (render-html)
|
|
|
|
|
; (render-to-document))
|
|
|
|
|
)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|