Merge branch 'bugfix/webfinger-statusnet' into 'develop'
webfinger: fix finding the XRD uri for statusnet instances See merge request pleroma/pleroma!164
This commit is contained in:
commit
38ee0f3fc6
4 changed files with 17 additions and 1 deletions
|
@ -214,7 +214,7 @@ defp webfinger_from_json(doc) do
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_template_from_xml(body) do
|
def get_template_from_xml(body) do
|
||||||
xpath = "//Link[@rel='lrdd' and @type='application/xrd+xml']/@template"
|
xpath = "//Link[@rel='lrdd']/@template"
|
||||||
|
|
||||||
with doc when doc != :error <- XML.parse_document(body),
|
with doc when doc != :error <- XML.parse_document(body),
|
||||||
template when template != nil <- XML.string_from_xpath(xpath, doc) do
|
template when template != nil <- XML.string_from_xpath(xpath, doc) do
|
||||||
|
|
2
test/fixtures/httpoison_mock/status.alpicola.com_host_meta
vendored
Normal file
2
test/fixtures/httpoison_mock/status.alpicola.com_host_meta
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0"><hm:Host xmlns:hm="http://host-meta.net/xrd/1.0">status.alpicola.com</hm:Host><Link rel="lrdd" template="http://status.alpicola.com/main/xrd?uri={uri}"><Title>Resource Descriptor</Title></Link></XRD>
|
|
@ -531,6 +531,14 @@ def get("http://social.heldscal.la/.well-known/host-meta", [], follow_redirect:
|
||||||
}}
|
}}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get("http://status.alpicola.com/.well-known/host-meta", [], follow_redirect: true) do
|
||||||
|
{:ok,
|
||||||
|
%Response{
|
||||||
|
status_code: 200,
|
||||||
|
body: File.read!("test/fixtures/httpoison_mock/status.alpicola.com_host_meta")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
|
||||||
def get("http://macgirvin.com/.well-known/host-meta", [], follow_redirect: true) do
|
def get("http://macgirvin.com/.well-known/host-meta", [], follow_redirect: true) do
|
||||||
{:ok,
|
{:ok,
|
||||||
%Response{
|
%Response{
|
||||||
|
|
|
@ -88,6 +88,12 @@ test "it gets the xrd endpoint for hubzilla" do
|
||||||
|
|
||||||
assert template == "https://macgirvin.com/xrd/?uri={uri}"
|
assert template == "https://macgirvin.com/xrd/?uri={uri}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "it gets the xrd endpoint for statusnet" do
|
||||||
|
{:ok, template} = WebFinger.find_lrdd_template("status.alpicola.com")
|
||||||
|
|
||||||
|
assert template == "http://status.alpicola.com/main/xrd?uri={uri}"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "ensure_keys_present" do
|
describe "ensure_keys_present" do
|
||||||
|
|
Loading…
Reference in a new issue