Much work on error reporting architecture for validation
This commit is contained in:
parent
5593bb22d1
commit
25795cf364
43 changed files with 2024 additions and 1067 deletions
|
|
@ -8,97 +8,106 @@
|
|||
001 (ns clj-activitypub.webfinger
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
002 (:require [clj-http.client :as client]
|
||||
002 "copied from [Jahfer's clj-activitypub library](https://github.com/jahfer/clj-activitypub).
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
003 [clj-activitypub.internal.http-util :as http]
|
||||
003 If and when Jahfer issues a release of that library, this directory will be deleted and a
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
004 [clj-activitypub.internal.thread-cache :as thread-cache]))
|
||||
004 dependency on that library will be added to the project."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
005 (:require [clj-http.client :as client]
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
006 [clj-activitypub.internal.http-util :as http]
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
007 [clj-activitypub.internal.thread-cache :as thread-cache]))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
005
|
||||
008
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
006 (def remote-uri-path "/.well-known/webfinger")
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
007
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
008 (defn- resource-str [domain username]
|
||||
</span><br/>
|
||||
<span class="covered" title="6 out of 6 forms covered">
|
||||
009 (str "acct:" username "@" domain))
|
||||
009 (def remote-uri-path "/.well-known/webfinger")
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
010
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
011 (defn resource-url
|
||||
011 (defn- resource-str [domain username]
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
012 "Builds a URL pointing to the user's account on the remote server."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
013 [domain username & [params]]
|
||||
</span><br/>
|
||||
<span class="covered" title="5 out of 5 forms covered">
|
||||
014 (let [resource (resource-str domain username)
|
||||
</span><br/>
|
||||
<span class="covered" title="8 out of 8 forms covered">
|
||||
015 query-str (http/encode-url-params (merge params {:resource resource}))]
|
||||
</span><br/>
|
||||
<span class="covered" title="7 out of 7 forms covered">
|
||||
016 (str "https://" domain remote-uri-path "?" query-str)))
|
||||
<span class="covered" title="6 out of 6 forms covered">
|
||||
012 (str "acct:" username "@" domain))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
017
|
||||
013
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
018 (def ^:private user-id-cache
|
||||
014 (defn resource-url
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
019 (thread-cache/make))
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
015 "Builds a URL pointing to the user's account on the remote server."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
016 [domain username & [params]]
|
||||
</span><br/>
|
||||
<span class="covered" title="5 out of 5 forms covered">
|
||||
017 (let [resource (resource-str domain username)
|
||||
</span><br/>
|
||||
<span class="covered" title="8 out of 8 forms covered">
|
||||
018 query-str (http/encode-url-params (merge params {:resource resource}))]
|
||||
</span><br/>
|
||||
<span class="covered" title="7 out of 7 forms covered">
|
||||
019 (str "https://" domain remote-uri-path "?" query-str)))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
020
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
021 (defn fetch-user-id
|
||||
021 (def ^:private user-id-cache
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
022 "Follows the webfinger request to a remote domain, retrieving the ID of the requested
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
022 (thread-cache/make))
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
023 account. Typically returns a string in the form of a URL."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
024 [domain username]
|
||||
</span><br/>
|
||||
<span class="covered" title="4 out of 4 forms covered">
|
||||
025 ((:get-v user-id-cache)
|
||||
</span><br/>
|
||||
<span class="covered" title="5 out of 5 forms covered">
|
||||
026 (str domain "@" username) ;; cache key
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
023
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
027 (fn []
|
||||
</span><br/>
|
||||
<span class="partial" title="15 out of 16 forms covered">
|
||||
028 (let [response (some-> (resource-url domain username {:rel "self"})
|
||||
</span><br/>
|
||||
<span class="covered" title="8 out of 8 forms covered">
|
||||
029 (client/get {:as :json :throw-exceptions false :ignore-unknown-host? true}))]
|
||||
</span><br/>
|
||||
<span class="partial" title="27 out of 31 forms covered">
|
||||
030 (some->> response :body :links
|
||||
</span><br/>
|
||||
<span class="covered" title="12 out of 12 forms covered">
|
||||
031 (some #(when (= (:type %) "application/activity+json") %))
|
||||
024 (defn fetch-user-id
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
032 :href)))))
|
||||
025 "Follows the webfinger request to a remote domain, retrieving the ID of the requested
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
026 account. Typically returns a string in the form of a URL."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
027 [domain username]
|
||||
</span><br/>
|
||||
<span class="covered" title="4 out of 4 forms covered">
|
||||
028 ((:get-v user-id-cache)
|
||||
</span><br/>
|
||||
<span class="covered" title="5 out of 5 forms covered">
|
||||
029 (str domain "@" username) ;; cache key
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
030 (fn []
|
||||
</span><br/>
|
||||
<span class="partial" title="15 out of 16 forms covered">
|
||||
031 (let [response (some-> (resource-url domain username {:rel "self"})
|
||||
</span><br/>
|
||||
<span class="covered" title="8 out of 8 forms covered">
|
||||
032 (client/get {:as :json :throw-exceptions false :ignore-unknown-host? true}))]
|
||||
</span><br/>
|
||||
<span class="partial" title="27 out of 31 forms covered">
|
||||
033 (some->> response :body :links
|
||||
</span><br/>
|
||||
<span class="covered" title="12 out of 12 forms covered">
|
||||
034 (some #(when (= (:type %) "application/activity+json") %))
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
035 :href)))))
|
||||
</span><br/>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue