start poking at webfinger
This commit is contained in:
parent
9bdd84273e
commit
bf25b247d9
5 changed files with 46 additions and 8 deletions
3
deps.edn
3
deps.edn
|
@ -31,7 +31,8 @@
|
|||
org.slf4j/log4j-over-slf4j {:exclusions [org.slf4j/slf4j-nop], :mvn/version "2.0.3"}
|
||||
ch.qos.logback/logback-classic {:exclusions [org.slf4j/slf4j-api org.slf4j/slf4j-nop] :mvn/version "1.4.4"}
|
||||
|
||||
djblue/portal {:mvn/version "0.35.0"}}
|
||||
djblue/portal {:mvn/version "0.35.0"}
|
||||
lambdaisland/uri {:mvn/version "1.13.95"}}
|
||||
|
||||
:aliases
|
||||
{:dev {:extra-paths ["dev"]}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
(ns repl-sessions.json-ld-stuff
|
||||
(:require
|
||||
[cheshire.core :as json]
|
||||
[clojure.string :as str]
|
||||
[hato.client :as hato]
|
||||
[cheshire.core :as json])
|
||||
[hato.client :as hato])
|
||||
(:import (org.jsoup Jsoup)))
|
||||
|
||||
(set! *print-namespace-maps* false)
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
(let [{:keys [schema ds]} (user/value :storage/db)
|
||||
table :activitystreams/Actor
|
||||
person (ap/GET "https://toot.cat/users/plexus/")]
|
||||
#_
|
||||
|
||||
(jdbc/execute! ds
|
||||
(db/insert-sql table
|
||||
(select-keys person (get schema table))
|
||||
(apply dissoc person :rdf/type (get schema table))))
|
||||
[(select-keys person (get schema table))
|
||||
#_[(select-keys person (get schema table))
|
||||
(apply dissoc person :rdf/type (get schema table))]
|
||||
)
|
||||
|
||||
|
|
37
repl_sessions/webfinger.clj
Normal file
37
repl_sessions/webfinger.clj
Normal file
|
@ -0,0 +1,37 @@
|
|||
(ns repl-sessions.webfinger
|
||||
(:require
|
||||
[cheshire.core :as json]
|
||||
[clojure.string :as str]
|
||||
[hato.client :as hato]
|
||||
[lambdaisland.uri :as uri]))
|
||||
|
||||
;; all of these work
|
||||
"acct:plexus@toot.cat"
|
||||
"http://toot.cat/@plexus"
|
||||
"https://toot.cat/@plexus"
|
||||
"http://toot.cat/users/plexus"
|
||||
"https://toot.cat/users/plexus"
|
||||
|
||||
;; rel seems to be ignored
|
||||
|
||||
(defn fetch-webfinger [domain resource]
|
||||
(-> (uri/uri "https:///.well-known/webfinger")
|
||||
(assoc :host domain)
|
||||
(uri/assoc-query :resource resource)
|
||||
str
|
||||
(hato/get {:as :json})
|
||||
:body))
|
||||
|
||||
(fetch-webfinger "toot.cat" "acct:plexus@toot.cat")
|
||||
|
||||
{:subject "acct:plexus@toot.cat",
|
||||
:aliases ["https://toot.cat/@plexus" "https://toot.cat/users/plexus"],
|
||||
:links
|
||||
[{:rel "http://webfinger.net/rel/profile-page",
|
||||
:type "text/html",
|
||||
:href "https://toot.cat/@plexus"}
|
||||
{:rel "self",
|
||||
:type "application/activity+json",
|
||||
:href "https://toot.cat/users/plexus"}
|
||||
{:rel "http://ostatus.org/schema/1.0/subscribe",
|
||||
:template "https://toot.cat/authorize_interaction?uri={uri}"}]}
|
|
@ -65,8 +65,8 @@
|
|||
(cons
|
||||
(json/encode props)
|
||||
(concat
|
||||
(map (comp pg-coerce val) props)
|
||||
(map (comp pg-coerce val) props)))))
|
||||
(map (comp pg-coerce val) entity)
|
||||
(map (comp pg-coerce val) entity)))))
|
||||
|
||||
(defn start! [{:keys [props]}]
|
||||
(let [ds (doto (ComboPooledDataSource.)
|
||||
|
|
Loading…
Reference in a new issue