blob: 6a6235fa3d7c032fb3da0698f20003dc29ddfa7a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
require 'uri'
class Webfinger::HostMetaPresenter
def initialize(request)
@request = request
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}"
end
def to_json(options = {})
{
subject: subject,
links: {
lrdd: { type: 'application/xrd+xml', template: webfinger_template }
}
}.to_json(options)
end
end
|