Coder Social home page Coder Social logo

vuk's Introduction

Vuk Build Status Clojars Project

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

Distributed under the Eclipse Public License either version 2.0 or (at your option) any later version.

vuk's People

Contributors

valerauko avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

vuk's Issues

Dependabot

Should check in pom.xml for automated dependency checks

Allow non-unique rels

Pleroma returns multiple selfs (though they link to the same URI with different content type), might be worth handling

Support Properties

Currently properties aren't supported and probably won't be extracted/represented as expected.

Should test and if necessary implement properties at some later point.

From what I can see, Mastodon/Pleroma don't use them so I'll have to find something that does to test on.

No more travis

travis proved to be extremely unreliable so migrating to Github Actions

Test multiple versions

Having tests (basic as they are) pass on multiple Java/JVM/Clojure versions might be nice

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.