From 31d18779fe1af0c55b72be7bc554302322025ee5 Mon Sep 17 00:00:00 2001 From: Azul Date: Tue, 22 Jan 2013 15:46:47 +0100 Subject: adding json jrd responses to webfinger --- users/lib/webfinger/user_presenter.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'users/lib') diff --git a/users/lib/webfinger/user_presenter.rb b/users/lib/webfinger/user_presenter.rb index bbfc908..8184c52 100644 --- a/users/lib/webfinger/user_presenter.rb +++ b/users/lib/webfinger/user_presenter.rb @@ -1,4 +1,5 @@ class Webfinger::UserPresenter + include Rails.application.routes.url_helpers attr_accessor :subject def initialize(subject, request) @@ -13,4 +14,15 @@ class Webfinger::UserPresenter def key Base64.encode64(@subject.public_key.to_s) end + + def to_json(options) + { + subject: "acct:#{email_identifier}", + aliases: [ user_url(@subject, :host => @request.host) ], + links: { + public_key: { type: 'PGP', href: key } + } + }.to_json(options) + end + end -- cgit v1.2.3