Regenerated documentation, but still no new tests.
This commit is contained in:
parent
c18a0a5b8e
commit
1cd7f1fc1a
24 changed files with 143 additions and 70 deletions
11
src/dog_and_duck/activitypub.code-workspace
Normal file
11
src/dog_and_duck/activitypub.code-workspace
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"folders": [
|
||||
{
|
||||
"path": "../.."
|
||||
},
|
||||
{
|
||||
"path": "../../../clj-activitypub"
|
||||
}
|
||||
],
|
||||
"settings": {}
|
||||
}
|
||||
|
|
@ -302,11 +302,12 @@
|
|||
|
||||
(defn activity-faults
|
||||
[x]
|
||||
(concat-non-empty (persistent-object-faults x)
|
||||
(activity-type-faults x)
|
||||
(list
|
||||
(when-not
|
||||
(has-activity-type? x)
|
||||
(make-fault-object :must :not-activity-type))
|
||||
(when-not (string? (:summary x)) (make-fault-object :should :no-summary)))))
|
||||
(concat-non-empty
|
||||
(persistent-object-faults x)
|
||||
(activity-type-faults x)
|
||||
(list
|
||||
(when-not
|
||||
(has-activity-type? x)
|
||||
(make-fault-object :must :not-activity-type))
|
||||
(when-not (string? (:summary x)) (make-fault-object :should :no-summary)))))
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
(ns dog-and-duck.quack.picky.required-properties)
|
||||
|
||||
|
|
@ -2,8 +2,11 @@
|
|||
"Scratchpad where I try to understand how to do this stuff."
|
||||
(:require [clj-activitypub.core :as activitypub]
|
||||
[clj-activitypub.webfinger :as webfinger]
|
||||
[clj-activitypub.net :as activitypub-net]
|
||||
[clj-pgp.generate :as pgp-gen]
|
||||
[clojure.walk :refer [keywordize-keys]]))
|
||||
[clojure.walk :refer [keywordize-keys]]
|
||||
[clojure.pprint :refer [pprint]]
|
||||
[clojure.data.json :as json]))
|
||||
|
||||
;;; Copyright (C) Simon Brooke, 2022
|
||||
|
||||
|
|
@ -24,23 +27,29 @@
|
|||
;;; Use any ActivityPub account handle you like - for example, your own
|
||||
(def account-handle "@simon_brooke@mastodon.scot")
|
||||
|
||||
(def handle (activitypub/parse-account account-handle))
|
||||
(webfinger/fetch-user-id "mastodon.scot" "simon_brooke")
|
||||
(apply webfinger/fetch-user-id (map handle [:domain :username]))
|
||||
;;(def handle (activitypub/parse-account account-handle))
|
||||
;;(webfinger/fetch-user-id "mastodon.scot" "simon_brooke")
|
||||
;;(apply webfinger/fetch-user-id (map handle [:domain :username]))
|
||||
|
||||
;;; Retrieve the account details from its home server
|
||||
;;; (`keywordize-keys` is not necessary here but produces a more idiomatic clojure
|
||||
;;; data structure)
|
||||
(def account
|
||||
"Fetch my account to mess with"
|
||||
(let [handle (activitypub/parse-account account-handle)]
|
||||
(keywordize-keys
|
||||
(activitypub/fetch-user
|
||||
(apply webfinger/fetch-user-id (map handle [:domain :username]))))))
|
||||
(-> account-handle
|
||||
(webfinger/parse-handle)
|
||||
(webfinger/fetch-user-id!)
|
||||
(activitypub-net/fetch-user!)
|
||||
(select-keys [:name :preferredUsername :inbox :summary])))
|
||||
|
||||
;;; examine what you got back!
|
||||
;; ;;; examine what you got back!
|
||||
(:inbox account)
|
||||
|
||||
(-> account
|
||||
:inbox
|
||||
slurp
|
||||
json/read-str
|
||||
pprint) ;; => 80
|
||||
|
||||
;; (def rsa (pgp-gen/rsa-keypair-generator 2048))
|
||||
;; (def kp (pgp-gen/generate-keypair rsa :rsa-general))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue