X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fweb%2Fweb_finger%2Fweb_finger.ex;h=0b417479d069a59b3c0950b75d3870f2ffc075b7;hb=0a0c6bf3945d6da98d3e5a08205a9b4f24adb67f;hp=e45c0ed8d33385acdc936e61e36bd0ca50beb5bb;hpb=b3d67750f04d7c72c3e1deeb6df573cbb195146a;p=akkoma diff --git a/lib/pleroma/web/web_finger/web_finger.ex b/lib/pleroma/web/web_finger/web_finger.ex index e45c0ed8d..0b417479d 100644 --- a/lib/pleroma/web/web_finger/web_finger.ex +++ b/lib/pleroma/web/web_finger/web_finger.ex @@ -1,7 +1,7 @@ defmodule Pleroma.Web.WebFinger do @httpoison Application.get_env(:pleroma, :httpoison) - alias Pleroma.{Repo, User, XmlBuilder} + alias Pleroma.{User, XmlBuilder} alias Pleroma.Web alias Pleroma.Web.{XML, Salmon, OStatus} require Jason @@ -81,8 +81,16 @@ defmodule Pleroma.Web.WebFinger do "href" => user.ap_id }, %{"rel" => "salmon", "href" => OStatus.salmon_path(user)}, - %{"rel" => "magic-public-key", "href" => "data:application/magic-public-key,#{magic_key}"}, + %{ + "rel" => "magic-public-key", + "href" => "data:application/magic-public-key,#{magic_key}" + }, %{"rel" => "self", "type" => "application/activity+json", "href" => user.ap_id}, + %{ + "rel" => "self", + "type" => "application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"", + "href" => user.ap_id + }, %{ "rel" => "http://ostatus.org/schema/1.0/subscribe", "template" => OStatus.remote_follow_path() @@ -180,6 +188,9 @@ defmodule Pleroma.Web.WebFinger do {"application/activity+json", "self"} -> Map.put(data, "ap_id", link["href"]) + {"application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"", "self"} -> + Map.put(data, "ap_id", link["href"]) + {_, "magic-public-key"} -> "data:application/magic-public-key," <> magic_key = link["href"] Map.put(data, "magic_key", magic_key) @@ -203,7 +214,7 @@ defmodule Pleroma.Web.WebFinger do end 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), template when template != nil <- XML.string_from_xpath(xpath, doc) do @@ -236,13 +247,14 @@ defmodule Pleroma.Web.WebFinger do URI.parse(account).host end - case find_lrdd_template(domain) do - {:ok, template} -> - address = String.replace(template, "{uri}", URI.encode(account)) + address = + case find_lrdd_template(domain) do + {:ok, template} -> + String.replace(template, "{uri}", URI.encode(account)) - _ -> - address = "http://#{domain}/.well-known/webfinger?resource=acct:#{account}" - end + _ -> + "https://#{domain}/.well-known/webfinger?resource=acct:#{account}" + end with response <- @httpoison.get(