Fix generation

This commit is contained in:
erik 2023-06-23 13:49:04 +02:00
parent d44a30577a
commit 984d4e00ea
2 changed files with 4 additions and 13 deletions

View file

@ -57,7 +57,6 @@
(def like? (s/keys :req-un [context (def like? (s/keys :req-un [context
type-string type-string
id-uri
to-uri to-uri
actor actor
object])) object]))
@ -67,8 +66,8 @@
(def activity-streams-context "https://www.w3.org/ns/activitystreams") (def activity-streams-context "https://www.w3.org/ns/activitystreams")
(def like-data (def like-data
{:to "https://chatty.bla/ben/" {:to ["https://chatty.bla/ben/", "https://chatty.bla/gen/"]
:target "posts/234s23-2g34234-2hhj536" :target "https://chatty.bla/ben/posts/234s23-2g34234-2hhj536"
:from "https://social.bla/alyssa/"}) :from "https://social.bla/alyssa/"})
(defn generate-id-from-object [from] (defn generate-id-from-object [from]
@ -79,7 +78,6 @@
(assoc {} (assoc {}
"@context" activity-streams-context "@context" activity-streams-context
"type" "Like" "type" "Like"
"id" (generate-id-from-object (:from input-map))
"to" (:to input-map) "to" (:to input-map)
"actor" (:from input-map) "actor" (:from input-map)
"object" (:target input-map))) "object" (:target input-map)))
@ -89,7 +87,7 @@
filename string?] filename string?]
(-> (->
input input
(json/write-str) (json/write-str :escape-slash false)
(#(spit filename %)))) (#(spit filename %))))

View file

@ -1,8 +1 @@
{ {"@context":"https://www.w3.org/ns/activitystreams","type":"Like","to":["https://chatty.bla/ben/","https://chatty.bla/gen/"],"actor":"https://social.bla/alyssa/","object":"https://chatty.bla/ben/posts/234s23-2g34234-2hhj536"}
"@context": "https:\/\/www.w3.org\/ns\/activitystreams",
"type": "Like",
"id": "https:\/\/social.bla\/alyssa\/out\/sdfsd44243g324g3455",
"to": "https:\/\/chatty.bla\/ben\/",
"actor": "https:\/\/social.bla\/alyssa\/",
"object": "posts\/234s23-2g34234-2hhj536"
}