Compare commits
No commits in common. "b01bae1f934054e25ed8e42c44ad92a5bcbd642a" and "a5f4be5dc25c5476114c0ad6ef7b07effb2c02ed" have entirely different histories.
b01bae1f93
...
a5f4be5dc2
3 changed files with 5 additions and 119 deletions
|
@ -1,14 +1,13 @@
|
||||||
;; shadow-cljs configuration
|
;; shadow-cljs configuration
|
||||||
{:source-paths
|
{:source-paths
|
||||||
["src/main"
|
["src/dev"
|
||||||
|
"src/main"
|
||||||
"src/test"]
|
"src/test"]
|
||||||
|
|
||||||
:dependencies
|
:dependencies
|
||||||
[[orchestra "2021.01.01-1"]
|
[[orchestra "2021.01.01-1"]
|
||||||
[hiccups "0.3.0"]
|
[hiccups "0.3.0"]
|
||||||
[org.clj-commons/hickory "0.7.4"]
|
[com.andrewmcveigh/cljs-time "0.5.2"]]
|
||||||
[com.andrewmcveigh/cljs-time "0.5.2"]
|
|
||||||
[org.domaindrivenarchitecture/c4k-common-cljs "6.2.3"]]
|
|
||||||
:dev-http {8080 "public"}
|
:dev-http {8080 "public"}
|
||||||
:builds
|
:builds
|
||||||
{:test {:target :node-test
|
{:test {:target :node-test
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
[dda.masto-embed.api :as api]
|
[dda.masto-embed.api :as api]
|
||||||
[dda.masto-embed.infra :as infra]
|
[dda.masto-embed.infra :as infra]
|
||||||
[dda.masto-embed.browser :as b]
|
[dda.masto-embed.browser :as b]
|
||||||
[dda.c4k-common.common :as cm]
|
|
||||||
))
|
))
|
||||||
|
|
||||||
(defn mastocard->html [card]
|
(defn mastocard->html [card]
|
||||||
|
@ -50,21 +49,6 @@
|
||||||
(mastocard->html card)]]]))
|
(mastocard->html card)]]]))
|
||||||
statuses)])
|
statuses)])
|
||||||
|
|
||||||
(defn masto->html2 [statuses]
|
|
||||||
(let [html (b/index-html-hiccup)]
|
|
||||||
(map (fn [status]
|
|
||||||
(let [{:keys [account created-at]} status])))))
|
|
||||||
|
|
||||||
(defn masto-header->html [html account created-at]
|
|
||||||
(let [{:keys [username display_name avatar_static]} account
|
|
||||||
date (t/parse created-at)]
|
|
||||||
(-> html
|
|
||||||
(cm/replace-all-matching-values-by-new-value "AVATAR_URL" avatar_static)
|
|
||||||
(cm/replace-all-matching-values-by-new-value "DISPLAY_NAME" display_name)
|
|
||||||
(cm/replace-all-matching-values-by-new-value "ACCOUNT_NAME" username)
|
|
||||||
(cm/replace-all-matching-values-by-new-value "DATETIME" created-at)
|
|
||||||
(cm/replace-all-matching-values-by-new-value "TIME" (t/unparse (t/formatter "dd M yy") date)))))
|
|
||||||
|
|
||||||
(defn find-account-id [host-url account-name]
|
(defn find-account-id [host-url account-name]
|
||||||
(let [out (chan)]
|
(let [out (chan)]
|
||||||
(go
|
(go
|
||||||
|
@ -103,95 +87,6 @@
|
||||||
(->> statuus
|
(->> statuus
|
||||||
(filter #(= nil (:reblog %)))
|
(filter #(= nil (:reblog %)))
|
||||||
(filter #(= nil (:in_reply_to_account_id %)))
|
(filter #(= nil (:in_reply_to_account_id %)))
|
||||||
(take 1)
|
(take 4)
|
||||||
(infra/debug)
|
(infra/debug)
|
||||||
))))
|
))))
|
||||||
|
|
||||||
{:mentions
|
|
||||||
[{:id "109517000301838437",
|
|
||||||
:username "J12t",
|
|
||||||
:url "https://social.coop/@J12t",
|
|
||||||
:acct "J12t@social.coop"}],
|
|
||||||
:emojis [],
|
|
||||||
:tags
|
|
||||||
[{:name "federation",
|
|
||||||
:url "https://social.meissa-gmbh.de/tags/federation"}
|
|
||||||
{:name "test", :url "https://social.meissa-gmbh.de/tags/test"}],
|
|
||||||
:reblog nil,
|
|
||||||
:replies_count 1,
|
|
||||||
:in_reply_to_account_id nil,
|
|
||||||
:reblogs_count 0,
|
|
||||||
:content
|
|
||||||
"<p><span class=\"h-card\" translate=\"no\"><a href=\"https://social.coop/@J12t\" class=\"u-url mention\">@<span>J12t</span></a></span> Hi Johannes, do you have a solution for such integration tests in place / planed?</p><p><a href=\"https://codeberg.org/forgejo/forgejo/src/commit/fe3473fc8b7b51e024b1a564fc7f01e385ebfb5e/tests/integration/api_activitypub_repository_test.go#L76-L115\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" translate=\"no\"><span class=\"invisible\">https://</span><span class=\"ellipsis\">codeberg.org/forgejo/forgejo/s</span><span class=\"invisible\">rc/commit/fe3473fc8b7b51e024b1a564fc7f01e385ebfb5e/tests/integration/api_activitypub_repository_test.go#L76-L115</span></a></p><p>Would love to be able to make better integration tests ...</p><p><a href=\"https://social.meissa-gmbh.de/tags/federation\" class=\"mention hashtag\" rel=\"tag\">#<span>federation</span></a> <a href=\"https://social.meissa-gmbh.de/tags/test\" class=\"mention hashtag\" rel=\"tag\">#<span>test</span></a></p>",
|
|
||||||
:sensitive false,
|
|
||||||
:favourites_count 1,
|
|
||||||
:in_reply_to_id nil,
|
|
||||||
:poll nil,
|
|
||||||
:account
|
|
||||||
{:acct "meissa",
|
|
||||||
:last_status_at "2024-05-15",
|
|
||||||
:emojis [],
|
|
||||||
:bot false,
|
|
||||||
:group false,
|
|
||||||
:following_count 80,
|
|
||||||
:avatar_static
|
|
||||||
"https://cdn.masto.host/socialmeissagmbhde/accounts/avatars/112/400/753/820/571/578/original/fd05f46bcc0c5c69.png",
|
|
||||||
:roles [],
|
|
||||||
:fields
|
|
||||||
[{:name "See also",
|
|
||||||
:value
|
|
||||||
"<a href=\"https://meissa.de\" target=\"_blank\" rel=\"nofollow noopener noreferrer me\" translate=\"no\"><span class=\"invisible\">https://</span><span class=\"\">meissa.de</span><span class=\"invisible\"></span></a>",
|
|
||||||
:verified_at "2024-05-14T09:08:20.463+00:00"}
|
|
||||||
{:name "OpenPGP",
|
|
||||||
:value "DF43207F1ABF673D8C7F5D1D756A2A4873B93D34",
|
|
||||||
:verified_at nil}],
|
|
||||||
:username "meissa",
|
|
||||||
:header_static
|
|
||||||
"https://cdn.masto.host/socialmeissagmbhde/accounts/headers/112/400/753/820/571/578/original/915998366b020667.jpg",
|
|
||||||
:discoverable true,
|
|
||||||
:statuses_count 10,
|
|
||||||
:header
|
|
||||||
"https://cdn.masto.host/socialmeissagmbhde/accounts/headers/112/400/753/820/571/578/original/915998366b020667.jpg",
|
|
||||||
:note
|
|
||||||
"<p>DevOps, Cloud, KI, Clojure, Kotlin, JVM, Python & k8s, Germany, Reutlingen, Tübingen, Stuttgart, genossenschaftlich, OpenSource, TestDriven, Maintainer, Forgejo, Federation</p>",
|
|
||||||
:noindex false,
|
|
||||||
:locked false,
|
|
||||||
:id "112400753820571578",
|
|
||||||
:avatar
|
|
||||||
"https://cdn.masto.host/socialmeissagmbhde/accounts/avatars/112/400/753/820/571/578/original/fd05f46bcc0c5c69.png",
|
|
||||||
:url "https://social.meissa-gmbh.de/@meissa",
|
|
||||||
:uri "https://social.meissa-gmbh.de/users/meissa",
|
|
||||||
:display_name "meissa-team",
|
|
||||||
:followers_count 172,
|
|
||||||
:created_at "2024-05-07T00:00:00.000Z"},
|
|
||||||
:card
|
|
||||||
{:description "forgejo - Beyond coding. We forge.",
|
|
||||||
:author_url "",
|
|
||||||
:image_description "",
|
|
||||||
:width 290,
|
|
||||||
:type "link",
|
|
||||||
:embed_url "",
|
|
||||||
:blurhash "URC3:FsU1xJS-8NvJ9$OFIS3wexEJ9n*xEbG",
|
|
||||||
:title
|
|
||||||
"forgejo/tests/integration/api_activitypub_repository_test.go at fe3473fc8b7b51e024b1a564fc7f01e385ebfb5e",
|
|
||||||
:published_at nil,
|
|
||||||
:provider_name "Codeberg.org",
|
|
||||||
:language "en",
|
|
||||||
:url
|
|
||||||
"https://codeberg.org//forgejo/forgejo/src/commit/fe3473fc8b7b51e024b1a564fc7f01e385ebfb5e/tests/integration/api_activitypub_repository_test.go",
|
|
||||||
:author_name "",
|
|
||||||
:image
|
|
||||||
"https://cdn.masto.host/socialmeissagmbhde/cache/preview_cards/images/000/545/643/original/199336f5aa5b9683.png",
|
|
||||||
:provider_url "",
|
|
||||||
:height 290,
|
|
||||||
:html ""},
|
|
||||||
:language "en",
|
|
||||||
:id "112446229070164194",
|
|
||||||
:url "https://social.meissa-gmbh.de/@meissa/112446229070164194",
|
|
||||||
:media_attachments [],
|
|
||||||
:uri
|
|
||||||
"https://social.meissa-gmbh.de/users/meissa/statuses/112446229070164194",
|
|
||||||
:edited_at nil,
|
|
||||||
:visibility "public",
|
|
||||||
:created_at "2024-05-15T17:14:50.257Z",
|
|
||||||
:spoiler_text ""}
|
|
|
@ -13,18 +13,10 @@
|
||||||
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
; See the License for the specific language governing permissions and
|
; See the License for the specific language governing permissions and
|
||||||
; limitations under the License.
|
; limitations under the License.
|
||||||
(ns dda.masto-embed.browser
|
(ns dda.masto-embed.browser)
|
||||||
(:require
|
|
||||||
[hickory.core :as h]
|
|
||||||
[shadow.resource :as rc]))
|
|
||||||
|
|
||||||
(def masto-embed "masto-embed")
|
(def masto-embed "masto-embed")
|
||||||
|
|
||||||
(def index-html (rc/inline "dda/masto_embed/resources/index.html"))
|
|
||||||
|
|
||||||
(defn index-html-hiccup []
|
|
||||||
(h/as-hiccup (h/parse index-html)))
|
|
||||||
|
|
||||||
(defn element-from-document-by-name [name]
|
(defn element-from-document-by-name [name]
|
||||||
(-> js/document
|
(-> js/document
|
||||||
(.getElementById masto-embed)
|
(.getElementById masto-embed)
|
||||||
|
|
Loading…
Reference in a new issue