summaryrefslogtreecommitdiff
path: root/users/lib/webfinger
diff options
context:
space:
mode:
Diffstat (limited to 'users/lib/webfinger')
-rw-r--r--users/lib/webfinger/host_meta_presenter.rb22
1 files changed, 13 insertions, 9 deletions
diff --git a/users/lib/webfinger/host_meta_presenter.rb b/users/lib/webfinger/host_meta_presenter.rb
index 6a6235f..84ab7a9 100644
--- a/users/lib/webfinger/host_meta_presenter.rb
+++ b/users/lib/webfinger/host_meta_presenter.rb
@@ -5,22 +5,26 @@ class Webfinger::HostMetaPresenter
@request = request
end
+ def to_json(options = {})
+ {
+ subject: subject,
+ links: links
+ }.to_json(options)
+ end
+
def subject
url = URI.parse(@request.url)
url.path = ''
url.to_s
end
- def webfinger_template(path = 'webfinger', query_param='q')
- "#{subject}/#{path}?#{query_param}={uri}"
+ def links
+ { lrdd: { type: 'application/xrd+xml', template: webfinger_template } }
end
- def to_json(options = {})
- {
- subject: subject,
- links: {
- lrdd: { type: 'application/xrd+xml', template: webfinger_template }
- }
- }.to_json(options)
+ protected
+
+ def webfinger_template(path = 'webfinger', query_param='q')
+ "#{subject}/#{path}?#{query_param}={uri}"
end
end