diaspora / diaspora_federation

A library that provides functionalities needed for the diaspora* federation protocol.
GNU Affero General Public License v3.0
101 stars 29 forks source link
diaspora documentation engine federation federation-library federation-protocol hacktoberfest protocol rails ruby

diaspora* federation library

A library that provides functionalities needed for the diaspora* federation protocol

master: Build Status master | develop: Build Status develop

Code Climate Test Coverage Inline docs Gem Version

Gem Documentation | Protocol Documentation | Bugtracker

This repository contains two gems:

Usage

Add the gem to your Gemfile:

gem "diaspora_federation-rails"

Mount the routes in your config/routes.rb:

mount DiasporaFederation::Engine => "/"

Configure the engine in config/initializers/diaspora_federation.rb:

DiasporaFederation.configure do |config|
  # the pod url
  config.server_uri = URI("http://localhost:3000")

  # ... other settings

  config.define_callbacks do
    on :fetch_person_for_webfinger do |diaspora_id|
      person = Person.find_local_by_diaspora_id(diaspora_id)
      if person
        DiasporaFederation::Discovery::WebFinger.new(
          # ... copy person attributes to WebFinger object
        )
      end
    end

    on :fetch_person_for_hcard do |guid|
      # ... fetch hcard information
    end

    # ... other callbacks
  end
end

The available config settings can be found here and the callbacks are listed here in the gem documentation.

Contributing

See our contribution guide for more information on how to contribute to the diaspora* federation library.

License

GNU Affero General Public License.