Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/valerauko/vuk
A Clojure library to handle WebFinger interactions for you.
https://github.com/valerauko/vuk
activitypub clojure fediverse hacktoberfest json webfinger xml
Last synced: 3 months ago
JSON representation
A Clojure library to handle WebFinger interactions for you.
- Host: GitHub
- URL: https://github.com/valerauko/vuk
- Owner: valerauko
- License: epl-2.0
- Created: 2018-05-06T06:51:45.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-10-04T06:38:09.000Z (over 1 year ago)
- Last Synced: 2024-05-23T04:06:14.668Z (8 months ago)
- Topics: activitypub, clojure, fediverse, hacktoberfest, json, webfinger, xml
- Language: Clojure
- Homepage:
- Size: 42 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Vuk [![Build Status](https://github.com/valerauko/vuk/actions/workflows/test.yaml/badge.svg?event=push)](https://github.com/valerauko/vuk/actions) [![Clojars Project](https://img.shields.io/clojars/v/social.kitsune/vuk.svg)](https://clojars.org/social.kitsune/vuk)
A Clojure library to handle WebFinger interactions for you.
## Installation
```
[social.kitsune/vuk "0.2.2"]
```## Usage
### Finger
```
(finger "acct:[email protected]")
```
Fetches the WebFinger representation of the given user then parses it into a hashmap.If any errors occur (404 not found, unsupported scheme, invalid JSON/XML) in the process, the used libraries' errors are thrown as-is.
Properties are not supported yet.
### Links
```
(let [user (finger "acct:[email protected]")]
(link user "self"))
; or even
(-> "acct:[email protected]" finger (link "self"))
```
It returns the first link node with a `rel` matching the given parameter.### Represent
```
(def user-map
{:subject "acct:[email protected]"
:aliases ["https://pawoo.net/@valerauko" "https://pawoo.net/users/valerauko"]
:links [{:rel "http://webfinger.net/rel/profile-page"
:type "text/html"
:href "https://pawoo.net/@valerauko"}
{:rel "self"
:type "application/activity+json"
:href "https://pawoo.net/users/valerauko"}]})
(represent user-map)
(represent user-map :as :json)
(represent user-map :as :xml)
```
Returns a string representing the user as WebFinger JSON or XML. You can pass the format in with `:as` (it defaults to JSON).### Host meta
```
(host-meta "https://pawoo.net/.well-known/webfinger?resource={uri}")
```
Generates the `host-meta` XML for your host. The provided parameter is embedded in the XML without any adjustments.## Todo
* more tests
* support for `properties`## License
Copyright © 2018 @[valerauko](https://github.com/valerauko)
Distributed under the Eclipse Public License either version 2.0 or (at your option) any later version.