write more documentation

This commit is contained in:
Benjamin Neff 2015-06-19 01:22:43 +02:00
parent 2416a2d9cd
commit 914cd06a78
3 changed files with 26 additions and 0 deletions

View file

@ -1,4 +1,6 @@
module DiasporaFederation
##
# Base-Controller for all DiasporaFederation-Controller
class ApplicationController < ActionController::Base
end
end

View file

@ -1,15 +1,25 @@
require_dependency "diaspora_federation/application_controller"
module DiasporaFederation
##
# this controller processes receiving messages
class ReceiveController < ApplicationController
before_action :check_for_xml
##
# receives public messages
#
# POST /receive/public
def public
logger.info "received a public message"
logger.debug CGI.unescape(params[:xml])
render nothing: true, status: :ok
end
##
# receives private messages for a user
#
# POST /receive/users/:guid
def private
logger.info "received a private message for #{params[:guid]}"
logger.debug CGI.unescape(params[:xml])

View file

@ -1,7 +1,19 @@
require_dependency "diaspora_federation/application_controller"
module DiasporaFederation
##
# this controller handles all webfinger-specific requests
class WebfingerController < ApplicationController
##
# returns the host-meta xml
#
# example:
# <?xml version="1.0" encoding="UTF-8"?>
# <XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0">
# <Link rel="lrdd" type="application/xrd+xml" template="https://server.example/webfinger?q={uri}"/>
# </XRD>
#
# GET /.well-known/host-meta
def host_meta
doc = WebFinger::HostMeta.from_base_url(DiasporaFederation.server_uri.to_s)
render body: doc.to_xml, content_type: "application/xrd+xml"
@ -9,6 +21,8 @@ module DiasporaFederation
##
# this is the pre RFC 7033 webfinger
#
# GET /webfinger?q={uri}
def legacy_webfinger
@person = find_person(params[:q]) if params[:q]