From 08bd59e446d5d176a9f2082424f70bde5cba64a5 Mon Sep 17 00:00:00 2001 From: Roger Braun Date: Thu, 24 Aug 2017 12:54:53 +0200 Subject: [PATCH] Extend webfinger capabilities. --- lib/pleroma/web/web_finger/web_finger.ex | 30 +- .../httpoison_mock/atarifrosch_feed.xml | 473 ++++++++++++++++++ .../httpoison_mock/atarifrosch_webfinger.xml | 18 + test/fixtures/httpoison_mock/eal_sakamoto.xml | 1 + .../httpoison_mock/gs.example.org_host_meta | 9 + .../https___pawoo.net_users_aqidaqidaqid.xml | 11 + .../lain_squeet.me_webfinger.xml | 42 ++ .../httpoison_mock/macgirvin.com_host_meta | 11 + .../httpoison_mock/mamot.fr_host_meta | 4 + .../httpoison_mock/mastodon.social_host_meta | 4 + .../httpoison_mock/mastodon.xyz_host_meta | 4 + .../httpoison_mock/pawoo.net_host_meta | 4 + .../pleroma.soykaf.com_host_meta | 1 + .../httpoison_mock/shitposter.club_host_meta | 9 + .../social.heldscal.la_host_meta | 9 + .../social.sakamoto.gq_host_meta | 1 + ...ial.stopwatchingus-heidelberg.de_host_meta | 9 + .../social.wxcafe.net_host_meta | 4 + .../httpoison_mock/squeet.me_host_meta | 16 + test/fixtures/nil_mention_entry.xml | 52 ++ test/support/httpoison_mock.ex | 184 ++++++- test/web/web_finger/web_finger_test.exs | 25 +- 22 files changed, 907 insertions(+), 14 deletions(-) create mode 100644 test/fixtures/httpoison_mock/atarifrosch_feed.xml create mode 100644 test/fixtures/httpoison_mock/atarifrosch_webfinger.xml create mode 100644 test/fixtures/httpoison_mock/eal_sakamoto.xml create mode 100644 test/fixtures/httpoison_mock/gs.example.org_host_meta create mode 100644 test/fixtures/httpoison_mock/https___pawoo.net_users_aqidaqidaqid.xml create mode 100644 test/fixtures/httpoison_mock/lain_squeet.me_webfinger.xml create mode 100644 test/fixtures/httpoison_mock/macgirvin.com_host_meta create mode 100644 test/fixtures/httpoison_mock/mamot.fr_host_meta create mode 100644 test/fixtures/httpoison_mock/mastodon.social_host_meta create mode 100644 test/fixtures/httpoison_mock/mastodon.xyz_host_meta create mode 100644 test/fixtures/httpoison_mock/pawoo.net_host_meta create mode 100644 test/fixtures/httpoison_mock/pleroma.soykaf.com_host_meta create mode 100644 test/fixtures/httpoison_mock/shitposter.club_host_meta create mode 100644 test/fixtures/httpoison_mock/social.heldscal.la_host_meta create mode 100644 test/fixtures/httpoison_mock/social.sakamoto.gq_host_meta create mode 100644 test/fixtures/httpoison_mock/social.stopwatchingus-heidelberg.de_host_meta create mode 100644 test/fixtures/httpoison_mock/social.wxcafe.net_host_meta create mode 100644 test/fixtures/httpoison_mock/squeet.me_host_meta create mode 100644 test/fixtures/nil_mention_entry.xml diff --git a/lib/pleroma/web/web_finger/web_finger.ex b/lib/pleroma/web/web_finger/web_finger.ex index 7ae413c26..da38f662c 100644 --- a/lib/pleroma/web/web_finger/web_finger.ex +++ b/lib/pleroma/web/web_finger/web_finger.ex @@ -82,20 +82,34 @@ defp webfinger_from_xml(doc) do {:ok, data} end - def finger(account, getter \\ &@httpoison.get/3) do + def get_template_from_xml(body) do + xpath = "//Link[@rel='lrdd' and @type='application/xrd+xml']/@template" + with doc when doc != :error <- XML.parse_document(body), + template when template != nil <- XML.string_from_xpath(xpath, doc) do + {:ok, template} + end + end + + def find_lrdd_template(domain) do + with {:ok, %{status_code: status_code, body: body}} <- @httpoison.get("http://#{domain}/.well-known/host-meta", [], follow_redirect: true) do + get_template_from_xml(body) + else + e -> {:error, "Can't find lrdd template: #{inspect(e)}"} + end + end + + def finger(account) do domain = with [_name, domain] <- String.split(account, "@") do domain else _e -> URI.parse(account).host end - address = webfinger_address(domain) - # try https first - response = with {:ok, result} <- getter.("https:" <> address, ["Accept": "application/xrd+xml"], [params: [resource: account]]) do - {:ok, result} - else _ -> - getter.("http:" <> address, ["Accept": "application/xrd+xml"], [params: [resource: account], follow_redirect: true]) - end + {:ok, template} = find_lrdd_template(domain) + + address = String.replace(template, "{uri}", URI.encode(account)) + + response = @httpoison.get(address, ["Accept": "application/xrd+xml"]) with {:ok, %{status_code: status_code, body: body}} when status_code in 200..299 <- response, doc when doc != :error<- XML.parse_document(body), diff --git a/test/fixtures/httpoison_mock/atarifrosch_feed.xml b/test/fixtures/httpoison_mock/atarifrosch_feed.xml new file mode 100644 index 000000000..e00df782e --- /dev/null +++ b/test/fixtures/httpoison_mock/atarifrosch_feed.xml @@ -0,0 +1,473 @@ + + + GNU social + https://social.stopwatchingus-heidelberg.de/api/statuses/user_timeline/18330.atom + atarifrosch-Zeitleiste + Aktualisierungen von atarifrosch auf social.stopwatchingus-heidelberg.de! + https://social.stopwatchingus-heidelberg.de/avatar/18330-96-20150628163706.png + 2017-08-24T12:06:55+02:00 + + http://activitystrea.ms/schema/1.0/person + https://social.stopwatchingus-heidelberg.de/user/18330 + atarifrosch + Nerd, Pirat, Debian user, CAcert assurer, Geocacher, Freifunker. Autismus/Depression, agender. GnuPG Key-ID: 0xBCF81ADE + + + + + + atarifrosch + Atari-Frosch + Nerd, Pirat, Debian user, CAcert assurer, Geocacher, Freifunker. Autismus/Depression, agender. GnuPG Key-ID: 0xBCF81ADE + + Düsseldorf, NRW, Germany + + + homepage + https://www.atari-frosch.de/ + true + + + + + + + + + + + + + + tag:social.stopwatchingus-heidelberg.de,2017-08-24:noticeId=978735:objectType=note + atarifrosch repeated a notice by hoergen + RT @<a href="https://social.hoergen.org/hoergen" class="h-card mention" title="hoergen">hoergen</a> Das falsche Bild der Tagesschau &quot;Auffallend &quot;erfolgreich&quot; - Andrea Nahles und Manuela Schwesig&quot; #<span class="tag"><a href="https://social.stopwatchingus-heidelberg.de/tag/geringverdiener" rel="tag">Geringverdiener</a></span> #<span class="tag"><a href="https://social.stopwatchingus-heidelberg.de/tag/mindestlohn" rel="tag">Mindestlohn</a></span> #<span class="tag"><a href="https://social.stopwatchingus-heidelberg.de/tag/mannxismus" rel="tag">mannxismus</a></span> #<span class="tag"><a href="https://social.stopwatchingus-heidelberg.de/tag/erwerbsminderungsrente" rel="tag">Erwerbsminderungsrente</a></span> #<span class="tag"><a href="https://social.stopwatchingus-heidelberg.de/tag/arbeitnehmerflexibilisierung" rel="tag">ArbeitnehmerFlexibilisierung</a></span> #<span class="tag"><a href="https://social.stopwatchingus-heidelberg.de/tag/altersarmut" rel="tag">AltersArmut</a></span> ..... <a href="http://www.tagesschau.de/inland/btw17/bilanz-schwesig-nahles-101.html" title="http://www.tagesschau.de/inland/btw17/bilanz-schwesig-nahles-101.html" class="attachment" id="attachment-450858" rel="nofollow external">http://www.tagesschau.de/inland/btw17/bilanz-schwesig-nahles-101.html</a> + https://social.stopwatchingus-heidelberg.de/notice/978735 + http://activitystrea.ms/schema/1.0/share + 2017-08-24T09:18:25+00:00 + 2017-08-24T09:18:25+00:00 + + http://activitystrea.ms/schema/1.0/activity + tag:social.hoergen.org,2017-08-24:noticeId=222320:objectType=note + + Das falsche Bild der Tagesschau <br /> &quot;Auffallend &quot;erfolgreich&quot; - Andrea Nahles und Manuela Schwesig&quot; #<span class="tag"><a href="https://social.hoergen.org/tag/geringverdiener" rel="tag">Geringverdiener</a></span> #<span class="tag"><a href="https://social.hoergen.org/tag/mindestlohn" rel="tag">Mindestlohn</a></span> #<span class="tag"><a href="https://social.hoergen.org/tag/mannxismus" rel="tag">mannxismus</a></span> #<span class="tag"><a href="https://social.hoergen.org/tag/erwerbsminderungsrente" rel="tag">Erwerbsminderungsrente</a></span> #<span class="tag"><a href="https://social.hoergen.org/tag/arbeitnehmerflexibilisierung" rel="tag">ArbeitnehmerFlexibilisierung</a></span> #<span class="tag"><a href="https://social.hoergen.org/tag/altersarmut" rel="tag">AltersArmut</a></span> ..... <br /> <br /> <a href="http://www.tagesschau.de/inland/btw17/bilanz-schwesig-nahles-101.html" title="http://www.tagesschau.de/inland/btw17/bilanz-schwesig-nahles-101.html" rel="nofollow external noreferrer" class="attachment">http://www.tagesschau.de/inland/btw17/bilanz-schwesig-nahles-101.html</a> + https://social.hoergen.org/notice/222320 + http://activitystrea.ms/schema/1.0/post + 2017-08-24T07:36:31+00:00 + 2017-08-24T07:36:31+00:00 + + http://activitystrea.ms/schema/1.0/person + https://social.hoergen.org/user/2 + hoergen + aka Andi Memyself #humanist #nerd Menschen liebhabender Misanthrop und auch sonst sehr vielseitig interessiert. + + + + + + hoergen + hoergen + aka Andi Memyself #humanist #nerd Menschen liebhabender Misanthrop und auch sonst sehr vielseitig interessiert. + + Berlin + + + homepage + https://hyperblog.de/hoergen/ + true + + + + + http://activitystrea.ms/schema/1.0/note + tag:social.hoergen.org,2017-08-24:noticeId=222320:objectType=note + New note by hoergen + Das falsche Bild der Tagesschau <br /> &quot;Auffallend &quot;erfolgreich&quot; - Andrea Nahles und Manuela Schwesig&quot; #<span class="tag"><a href="https://social.hoergen.org/tag/geringverdiener" rel="tag">Geringverdiener</a></span> #<span class="tag"><a href="https://social.hoergen.org/tag/mindestlohn" rel="tag">Mindestlohn</a></span> #<span class="tag"><a href="https://social.hoergen.org/tag/mannxismus" rel="tag">mannxismus</a></span> #<span class="tag"><a href="https://social.hoergen.org/tag/erwerbsminderungsrente" rel="tag">Erwerbsminderungsrente</a></span> #<span class="tag"><a href="https://social.hoergen.org/tag/arbeitnehmerflexibilisierung" rel="tag">ArbeitnehmerFlexibilisierung</a></span> #<span class="tag"><a href="https://social.hoergen.org/tag/altersarmut" rel="tag">AltersArmut</a></span> ..... <br /> <br /> <a href="http://www.tagesschau.de/inland/btw17/bilanz-schwesig-nahles-101.html" title="http://www.tagesschau.de/inland/btw17/bilanz-schwesig-nahles-101.html" rel="nofollow external noreferrer" class="attachment">http://www.tagesschau.de/inland/btw17/bilanz-schwesig-nahles-101.html</a> + + + + + https://social.hoergen.org/conversation/98616 + + + + + + + + + https://social.hoergen.org/api/statuses/user_timeline/2.atom + hoergen + + + https://social.stopwatchingus-heidelberg.de/avatar/54316-original-20170824072526.jpeg + 2017-08-24T09:48:30+00:00 + + + + https://social.hoergen.org/conversation/98616 + + + + + + + + + + + + + http://activitystrea.ms/schema/1.0/comment + tag:social.stopwatchingus-heidelberg.de,2017-08-24:noticeId=978734:objectType=comment + New comment by atarifrosch + Jo, die Anzahl der Hartz-IV-Sanktionen nennt sie genausowenig wie die Anzahl der Menschen, die von den Repressionsbehörden in Obdachlosigkeit und Suizid getrieben wurden. Das würde die Erfolgszahlen dann doch ein wenig trüben, nech? + + + http://activitystrea.ms/schema/1.0/post + 2017-08-24T09:18:13+00:00 + 2017-08-24T09:18:13+00:00 + + + + https://social.hoergen.org/conversation/98616 + + + + + + + + http://activitystrea.ms/schema/1.0/note + tag:social.stopwatchingus-heidelberg.de,2017-08-24:noticeId=978732:objectType=note + New note by atarifrosch + Moin-quak. + + + http://activitystrea.ms/schema/1.0/post + 2017-08-24T09:09:39+00:00 + 2017-08-24T09:09:39+00:00 + + tag:social.stopwatchingus-heidelberg.de,2017-08-24:noticeId=978732:objectType=thread:crc32=2f92b7b6 + + + + + + + http://activitystrea.ms/schema/1.0/note + tag:social.stopwatchingus-heidelberg.de,2017-08-23:noticeId=978594:objectType=note + New note by atarifrosch + n8-quak! + + + http://activitystrea.ms/schema/1.0/post + 2017-08-23T21:39:54+00:00 + 2017-08-23T21:39:54+00:00 + + tag:social.stopwatchingus-heidelberg.de,2017-08-23:noticeId=978594:objectType=thread:crc32=9bdb0ac9 + + + + + + + http://activitystrea.ms/schema/1.0/note + tag:social.stopwatchingus-heidelberg.de,2017-08-23:noticeId=978503:objectType=note + New note by atarifrosch + 2017-08-16 Michal Špaček: Post a boarding pass on Facebook, get your account stolen – Post a boarding pass on Facebook, get your account stolen (gilt übrinx nicht nur für Facebook) + + + http://activitystrea.ms/schema/1.0/post + 2017-08-23T15:14:29+00:00 + 2017-08-23T15:14:29+00:00 + + tag:social.stopwatchingus-heidelberg.de,2017-08-23:noticeId=978503:objectType=thread:crc32=3de05c3a + + + + + + + tag:social.stopwatchingus-heidelberg.de,2017-08-23:fave:18330:activity:978458:2017-08-23T15:18:19+02:00 + Favorite + atarifrosch favorited something by einebiene: Haha, große Überraschung. <a href="http://www.sueddeutsche.de/wirtschaft/abgasaffaere-software-updates-fuer-dieselautos-helfen-kaum-1.3637636" title="http://www.sueddeutsche.de/wirtschaft/abgasaffaere-software-updates-fuer-dieselautos-helfen-kaum-1.3637636" rel="nofollow noreferrer" class="attachment">https://quitter.is/url/1122672</a><br /> Was ich an all diesen Artikeln schade finde, ist, daß immer nur auf den Umstieg von Auto zu anderem Auto gesprochen wird. Öffis werden nicht erwähnt, Carsharing nicht, radeln nicht, und in der Stadt wäre ne Vespa auch deutlich besser als ein SUV. + http://activitystrea.ms/schema/1.0/favorite + 2017-08-23T13:18:19+00:00 + 2017-08-23T13:18:19+00:00 + + http://activitystrea.ms/schema/1.0/note + tag:quitter.is,2017-08-23:noticeId=4032910:objectType=note + New note by einebiene + Haha, große Überraschung. <a href="http://www.sueddeutsche.de/wirtschaft/abgasaffaere-software-updates-fuer-dieselautos-helfen-kaum-1.3637636" title="http://www.sueddeutsche.de/wirtschaft/abgasaffaere-software-updates-fuer-dieselautos-helfen-kaum-1.3637636" rel="nofollow noreferrer" class="attachment">https://quitter.is/url/1122672</a><br /> Was ich an all diesen Artikeln schade finde, ist, daß immer nur auf den Umstieg von Auto zu anderem Auto gesprochen wird. Öffis werden nicht erwähnt, Carsharing nicht, radeln nicht, und in der Stadt wäre ne Vespa auch deutlich besser als ein SUV. + + + + + + + https://quitter.is/conversation/2535246 + + + + + + http://activitystrea.ms/schema/1.0/note + tag:social.stopwatchingus-heidelberg.de,2017-08-23:noticeId=978402:objectType=note + New note by atarifrosch + moin-quak + + + http://activitystrea.ms/schema/1.0/post + 2017-08-23T10:57:26+00:00 + 2017-08-23T10:57:26+00:00 + + tag:social.stopwatchingus-heidelberg.de,2017-08-23:noticeId=978402:objectType=thread:crc32=7050c397 + + + + + + + http://activitystrea.ms/schema/1.0/note + tag:social.stopwatchingus-heidelberg.de,2017-08-22:noticeId=978164:objectType=note + New note by atarifrosch + n8-quak + + + http://activitystrea.ms/schema/1.0/post + 2017-08-22T19:54:30+00:00 + 2017-08-22T19:54:30+00:00 + + tag:social.stopwatchingus-heidelberg.de,2017-08-22:noticeId=978164:objectType=thread:crc32=b0a209c7 + + + + + + + http://activitystrea.ms/schema/1.0/note + tag:social.stopwatchingus-heidelberg.de,2017-08-22:noticeId=978072:objectType=note + New note by atarifrosch + 2017-08-22 Bundesverfassungsgericht: Erfolgreiche Verfassungsbeschwerde gegen die Versagung vorläufiger Leistungen für Kosten der Unterkunft und Heizung – <a href="https://www.bundesverfassungsgericht.de/SharedDocs/Pressemitteilungen/DE/2017/bvg17-072.html" title="https://www.bundesverfassungsgericht.de/SharedDocs/Pressemitteilungen/DE/2017/bvg17-072.html" class="attachment" id="attachment-450768" rel="nofollow external">https://www.bundesverfassungsgericht.de/SharedDocs/Pressemitteilungen/DE/2017/bvg17-072.html</a> !<a href="http://quitter.se/group/2184/id" class="h-card group" title="HartzIV (hartziv)">hartziv</a> + + + http://activitystrea.ms/schema/1.0/post + 2017-08-22T12:00:21+00:00 + 2017-08-22T12:00:21+00:00 + + tag:social.stopwatchingus-heidelberg.de,2017-08-22:noticeId=978072:objectType=thread:crc32=28a35f44 + + + + + + + + + http://activitystrea.ms/schema/1.0/note + tag:social.stopwatchingus-heidelberg.de,2017-08-22:noticeId=978042:objectType=note + New note by atarifrosch + moin-quak! + + + http://activitystrea.ms/schema/1.0/post + 2017-08-22T07:55:27+00:00 + 2017-08-22T07:55:27+00:00 + + tag:social.stopwatchingus-heidelberg.de,2017-08-22:noticeId=978042:objectType=thread:crc32=f070a9f7 + + + + + + + http://activitystrea.ms/schema/1.0/note + tag:social.stopwatchingus-heidelberg.de,2017-08-21:noticeId=977914:objectType=note + New note by atarifrosch + So, morgen geht's weiter. n8-quak! + + + http://activitystrea.ms/schema/1.0/post + 2017-08-21T22:09:53+00:00 + 2017-08-21T22:09:53+00:00 + + tag:social.stopwatchingus-heidelberg.de,2017-08-21:noticeId=977914:objectType=thread:crc32=c0a9f7fa + + + + + + + http://activitystrea.ms/schema/1.0/note + tag:social.stopwatchingus-heidelberg.de,2017-08-21:noticeId=977710:objectType=note + New note by atarifrosch + moin-quak. + + + http://activitystrea.ms/schema/1.0/post + 2017-08-21T08:58:26+00:00 + 2017-08-21T08:58:26+00:00 + + tag:social.stopwatchingus-heidelberg.de,2017-08-21:noticeId=977710:objectType=thread:crc32=60cfb466 + + + + + + + http://activitystrea.ms/schema/1.0/note + tag:social.stopwatchingus-heidelberg.de,2017-08-20:noticeId=977526:objectType=note + New note by atarifrosch + Meine Augen meinen, für heute sei es genug. Nun denn. n8-quak. + + + http://activitystrea.ms/schema/1.0/post + 2017-08-20T19:58:16+00:00 + 2017-08-20T19:58:16+00:00 + + tag:social.stopwatchingus-heidelberg.de,2017-08-20:noticeId=977526:objectType=thread:crc32=ce79634 + + + + + + + http://activitystrea.ms/schema/1.0/note + tag:social.stopwatchingus-heidelberg.de,2017-08-20:noticeId=977369:objectType=note + New note by atarifrosch + [Blog] Im Netz aufgefischt #<span class="tag"><a href="https://social.stopwatchingus-heidelberg.de/tag/330" rel="tag">330</a></span> – <a href="https://blog.atari-frosch.de/2017/08/20/im-netz-aufgefischt-330/" title="https://blog.atari-frosch.de/2017/08/20/im-netz-aufgefischt-330/" class="attachment" id="attachment-450668" rel="nofollow external">https://blog.atari-frosch.de/2017/08/20/im-netz-aufgefischt-330/</a> (was ich diese Woche so gelesen habe) + + + http://activitystrea.ms/schema/1.0/post + 2017-08-20T09:14:07+00:00 + 2017-08-20T09:14:07+00:00 + + tag:social.stopwatchingus-heidelberg.de,2017-08-20:noticeId=977369:objectType=thread:crc32=2f800b86 + + + + + + + + http://activitystrea.ms/schema/1.0/note + tag:social.stopwatchingus-heidelberg.de,2017-08-19:noticeId=977268:objectType=note + New note by atarifrosch + Fast ständig husten müssen ist echt anstrengend … naja, n8-quak. + + + http://activitystrea.ms/schema/1.0/post + 2017-08-19T21:59:20+00:00 + 2017-08-19T21:59:20+00:00 + + tag:social.stopwatchingus-heidelberg.de,2017-08-19:noticeId=977268:objectType=thread:crc32=deda767a + + + + + + + tag:social.stopwatchingus-heidelberg.de,2017-08-19:fave:18330:activity:977146:2017-08-19T21:39:26+02:00 + Favorite + atarifrosch favorited something by einebienezwo: Ich mach gerade Kompetenztraining.<br /> Ich trainiere die Kompetenz, eine halb aufgegessene Gummibärchentüte nicht ganz aufzuessen. + http://activitystrea.ms/schema/1.0/favorite + 2017-08-19T19:39:26+00:00 + 2017-08-19T19:39:26+00:00 + + http://activitystrea.ms/schema/1.0/note + tag:gnusocial.de,2017-08-19:noticeId=11011264:objectType=note + New note by einebienezwo + Ich mach gerade Kompetenztraining.<br /> Ich trainiere die Kompetenz, eine halb aufgegessene Gummibärchentüte nicht ganz aufzuessen. + + + + + + + https://gnusocial.de/conversation/9363945 + + + + + + http://activitystrea.ms/schema/1.0/comment + tag:social.stopwatchingus-heidelberg.de,2017-08-19:noticeId=977242:objectType=comment + New comment by atarifrosch + Wir hatten hier schon Ordnungsdienst auf'm Radweg. Fotografisch dokumentiert (nicht von mir, Bekannter hatte es gesehen). Da hatte grad 'ne Pizzeria neu eröffnet … + + + http://activitystrea.ms/schema/1.0/post + 2017-08-19T19:38:53+00:00 + 2017-08-19T19:38:53+00:00 + + + + https://gnusocial.de/conversation/9363813 + + + + + + + + tag:social.stopwatchingus-heidelberg.de,2017-08-19:fave:18330:activity:977180:2017-08-19T21:37:36+02:00 + Favorite + atarifrosch favorited something by jcaktiv: BTW Hallo zusammen &lt;3, wo ich schon mal wieder hier bin + http://activitystrea.ms/schema/1.0/favorite + 2017-08-19T19:37:36+00:00 + 2017-08-19T19:37:36+00:00 + + http://activitystrea.ms/schema/1.0/note + tag:quitter.se,2017-08-19:noticeId=17372467:objectType=note + New note by jcaktiv + BTW Hallo zusammen &lt;3, wo ich schon mal wieder hier bin + + + + + + + tag:quitter.se,2017-08-19:objectType=thread:nonce=46c1c433d88aaa9f + + + + + + http://activitystrea.ms/schema/1.0/comment + tag:social.stopwatchingus-heidelberg.de,2017-08-19:noticeId=976985:objectType=comment + New comment by atarifrosch + Jo, oder einfach mal nachfragen, so als Realitätsabgleich. + + + http://activitystrea.ms/schema/1.0/post + 2017-08-19T10:34:50+00:00 + 2017-08-19T10:34:50+00:00 + + + + https://gnusocial.de/conversation/9362516 + + + + + + + + http://activitystrea.ms/schema/1.0/note + tag:social.stopwatchingus-heidelberg.de,2017-08-19:noticeId=976983:objectType=note + New note by atarifrosch + Schöne Alternative zu mit Werbung überladenen kommerziellen Anbietern: <a href="http://ifconfig.at/" title="http://ifconfig.at/" class="attachment" id="attachment-450636" rel="nofollow external">http://ifconfig.at/</a> – eigene IP, Hostname etc. abfragen, mit curl dann auch in Textform zur lokalen Weiterverarbeitung in Scripten etc. Leider (noch?) kein https. + + + http://activitystrea.ms/schema/1.0/post + 2017-08-19T10:33:04+00:00 + 2017-08-19T10:33:04+00:00 + + tag:social.stopwatchingus-heidelberg.de,2017-08-19:noticeId=976983:objectType=thread:crc32=4a3593c0 + + + + + + diff --git a/test/fixtures/httpoison_mock/atarifrosch_webfinger.xml b/test/fixtures/httpoison_mock/atarifrosch_webfinger.xml new file mode 100644 index 000000000..24188362c --- /dev/null +++ b/test/fixtures/httpoison_mock/atarifrosch_webfinger.xml @@ -0,0 +1,18 @@ + + + https://social.stopwatchingus-heidelberg.de/user/18330 + acct:atarifrosch@social.stopwatchingus-heidelberg.de + https://social.stopwatchingus-heidelberg.de/atarifrosch + + + + + + + + + + + + + diff --git a/test/fixtures/httpoison_mock/eal_sakamoto.xml b/test/fixtures/httpoison_mock/eal_sakamoto.xml new file mode 100644 index 000000000..934d539c9 --- /dev/null +++ b/test/fixtures/httpoison_mock/eal_sakamoto.xml @@ -0,0 +1 @@ +acct:eal@social.sakamoto.gqhttps://social.sakamoto.gq/users/eal \ No newline at end of file diff --git a/test/fixtures/httpoison_mock/gs.example.org_host_meta b/test/fixtures/httpoison_mock/gs.example.org_host_meta new file mode 100644 index 000000000..c2fcd7305 --- /dev/null +++ b/test/fixtures/httpoison_mock/gs.example.org_host_meta @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/test/fixtures/httpoison_mock/https___pawoo.net_users_aqidaqidaqid.xml b/test/fixtures/httpoison_mock/https___pawoo.net_users_aqidaqidaqid.xml new file mode 100644 index 000000000..2de8a44b9 --- /dev/null +++ b/test/fixtures/httpoison_mock/https___pawoo.net_users_aqidaqidaqid.xml @@ -0,0 +1,11 @@ + + + acct:aqidaqidaqid@pawoo.net + https://pawoo.net/@aqidaqidaqid + https://pawoo.net/users/aqidaqidaqid + + + + + + diff --git a/test/fixtures/httpoison_mock/lain_squeet.me_webfinger.xml b/test/fixtures/httpoison_mock/lain_squeet.me_webfinger.xml new file mode 100644 index 000000000..948e4758e --- /dev/null +++ b/test/fixtures/httpoison_mock/lain_squeet.me_webfinger.xml @@ -0,0 +1,42 @@ + + + lain@squeet.me + https://squeet.me/profile/lain + https://squeet.me/profile/lain + + + + + + + + + + + + + + + + + + RSA.AN3dwTkRhy60WL1-QBaR7MvYgv6SVAB8sb11wJvCraBSYy1WLHLZv60aSzufDZDBXjOjQGy2XTfD_rRiuDzRIZSHI8zgrv-kZXE36WDq4e2cpFeouUVBgyQqyK9svRExKRPzrIJz-UNFYyGJdbkSu_jsXxvHkzfAlc4HI3N5vdrONtFioCS6eWmVQwyPzab9MynlfzqJhKHM0lZ6wN3XySSJgq9bo6DydvUbKFosfittlXjQLmDW3soFnKsKvWMnTId4zxDBFVkt_xepyzlCjvNNN3I7lkqucaHyZla3dWAU0FRi9_QltPgAFKQWtcOGoP7Eq5C5dGOQCuIwSabopamKqphMlCnElyBlUduJ02IHlywQ9Zqv-HoIu-cilaPvhFl0Pa6CdZ1NU7_5wwnCFyGvH_5-CSzTtC5ghjGWeXCsIND31BXbSfrtP3vrNa2YvcAWKD8g4Rd1TihcgyuaC00wc3Q3jSF0ewrDPEyEX8tojJCPMeeAQcDQJHXraM9HqpH2q8-7zBlY9LSHWHnXy2RGzHCBFTTHWMY0G4B38IXtYJWCnSr3A_AY82ElAhnen_kRn5GqaIT446UZpj4cXnbHixInxSwm6GPUyAfhlL-azi5m51Jf67TesOJRvYwmrpJ02jSiXl1U3w3QBzhJVSrt7_zZotOr8nd_FSkXh1u_.AQAB + + diff --git a/test/fixtures/httpoison_mock/macgirvin.com_host_meta b/test/fixtures/httpoison_mock/macgirvin.com_host_meta new file mode 100644 index 000000000..cd30b602f --- /dev/null +++ b/test/fixtures/httpoison_mock/macgirvin.com_host_meta @@ -0,0 +1,11 @@ + + + + macgirvin.com + + + + + diff --git a/test/fixtures/httpoison_mock/mamot.fr_host_meta b/test/fixtures/httpoison_mock/mamot.fr_host_meta new file mode 100644 index 000000000..ed7a95094 --- /dev/null +++ b/test/fixtures/httpoison_mock/mamot.fr_host_meta @@ -0,0 +1,4 @@ + + + + diff --git a/test/fixtures/httpoison_mock/mastodon.social_host_meta b/test/fixtures/httpoison_mock/mastodon.social_host_meta new file mode 100644 index 000000000..78e46e260 --- /dev/null +++ b/test/fixtures/httpoison_mock/mastodon.social_host_meta @@ -0,0 +1,4 @@ + + + + diff --git a/test/fixtures/httpoison_mock/mastodon.xyz_host_meta b/test/fixtures/httpoison_mock/mastodon.xyz_host_meta new file mode 100644 index 000000000..8604316fb --- /dev/null +++ b/test/fixtures/httpoison_mock/mastodon.xyz_host_meta @@ -0,0 +1,4 @@ + + + + diff --git a/test/fixtures/httpoison_mock/pawoo.net_host_meta b/test/fixtures/httpoison_mock/pawoo.net_host_meta new file mode 100644 index 000000000..dbbe7be5f --- /dev/null +++ b/test/fixtures/httpoison_mock/pawoo.net_host_meta @@ -0,0 +1,4 @@ + + + + diff --git a/test/fixtures/httpoison_mock/pleroma.soykaf.com_host_meta b/test/fixtures/httpoison_mock/pleroma.soykaf.com_host_meta new file mode 100644 index 000000000..fb5c15a4f --- /dev/null +++ b/test/fixtures/httpoison_mock/pleroma.soykaf.com_host_meta @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/test/fixtures/httpoison_mock/shitposter.club_host_meta b/test/fixtures/httpoison_mock/shitposter.club_host_meta new file mode 100644 index 000000000..9d012e1df --- /dev/null +++ b/test/fixtures/httpoison_mock/shitposter.club_host_meta @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/test/fixtures/httpoison_mock/social.heldscal.la_host_meta b/test/fixtures/httpoison_mock/social.heldscal.la_host_meta new file mode 100644 index 000000000..540e6257e --- /dev/null +++ b/test/fixtures/httpoison_mock/social.heldscal.la_host_meta @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/test/fixtures/httpoison_mock/social.sakamoto.gq_host_meta b/test/fixtures/httpoison_mock/social.sakamoto.gq_host_meta new file mode 100644 index 000000000..f193dce2b --- /dev/null +++ b/test/fixtures/httpoison_mock/social.sakamoto.gq_host_meta @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/test/fixtures/httpoison_mock/social.stopwatchingus-heidelberg.de_host_meta b/test/fixtures/httpoison_mock/social.stopwatchingus-heidelberg.de_host_meta new file mode 100644 index 000000000..aafc9f60d --- /dev/null +++ b/test/fixtures/httpoison_mock/social.stopwatchingus-heidelberg.de_host_meta @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/test/fixtures/httpoison_mock/social.wxcafe.net_host_meta b/test/fixtures/httpoison_mock/social.wxcafe.net_host_meta new file mode 100644 index 000000000..5ffc40a90 --- /dev/null +++ b/test/fixtures/httpoison_mock/social.wxcafe.net_host_meta @@ -0,0 +1,4 @@ + + + + diff --git a/test/fixtures/httpoison_mock/squeet.me_host_meta b/test/fixtures/httpoison_mock/squeet.me_host_meta new file mode 100644 index 000000000..4a94ae574 --- /dev/null +++ b/test/fixtures/httpoison_mock/squeet.me_host_meta @@ -0,0 +1,16 @@ + + + + squeet.me + + + + + + + RSA.AMZTNgTQx_YZzt1urzlHyefrXFAml_q8fpCsnUHeIbdtQLeA-HdTK2epwELu653-aK_WGUYSKYLyb1walkqNM5gC5FGVFa7EvVoR-uSNKrduFzUz2SdRXTw3e3NQtd9Rs5Mpgm1wYnt1NiWk-7dKIpoVilHgOOYDX15NU9Zfu7-J.AQAB + diff --git a/test/fixtures/nil_mention_entry.xml b/test/fixtures/nil_mention_entry.xml new file mode 100644 index 000000000..e13024cb3 --- /dev/null +++ b/test/fixtures/nil_mention_entry.xml @@ -0,0 +1,52 @@ + + + GNU social + https://social.stopwatchingus-heidelberg.de/api/statuses/user_timeline/18330.atom + atarifrosch timeline + Updates from atarifrosch on social.stopwatchingus-heidelberg.de! + https://social.stopwatchingus-heidelberg.de/avatar/18330-96-20150628163706.png + 2017-08-24T11:36:49+02:00 + + http://activitystrea.ms/schema/1.0/person + https://social.stopwatchingus-heidelberg.de/user/18330 + atarifrosch + Nerd, Pirat, Debian user, CAcert assurer, Geocacher, Freifunker. Autismus/Depression, agender. GnuPG Key-ID: 0xBCF81ADE + + + + + + atarifrosch + Atari-Frosch + Nerd, Pirat, Debian user, CAcert assurer, Geocacher, Freifunker. Autismus/Depression, agender. GnuPG Key-ID: 0xBCF81ADE + + Düsseldorf, NRW, Germany + + + homepage + https://www.atari-frosch.de/ + true + + + + + + http://activitystrea.ms/schema/1.0/note + tag:social.stopwatchingus-heidelberg.de,2017-08-22:noticeId=978072:objectType=note + New note by atarifrosch + 2017-08-22 Bundesverfassungsgericht: Erfolgreiche Verfassungsbeschwerde gegen die Versagung vorläufiger Leistungen für Kosten der Unterkunft und Heizung – <a href="https://www.bundesverfassungsgericht.de/SharedDocs/Pressemitteilungen/DE/2017/bvg17-072.html" title="https://www.bundesverfassungsgericht.de/SharedDocs/Pressemitteilungen/DE/2017/bvg17-072.html" class="attachment" id="attachment-450768" rel="nofollow external">https://www.bundesverfassungsgericht.de/SharedDocs/Pressemitteilungen/DE/2017/bvg17-072.html</a> !<a href="http://quitter.se/group/2184/id" class="h-card group" title="HartzIV (hartziv)">hartziv</a> + + + http://activitystrea.ms/schema/1.0/post + 2017-08-22T12:00:21+00:00 + 2017-08-22T12:00:21+00:00 + + tag:social.stopwatchingus-heidelberg.de,2017-08-22:noticeId=978072:objectType=thread:crc32=28a35f44 + + + + + + + + diff --git a/test/support/httpoison_mock.ex b/test/support/httpoison_mock.ex index 08b566fcd..091fb9ded 100644 --- a/test/support/httpoison_mock.ex +++ b/test/support/httpoison_mock.ex @@ -10,6 +10,13 @@ def get("https://social.heldscal.la/.well-known/webfinger", [Accept: "applicatio }} end + def get("https://social.heldscal.la/.well-known/webfinger?resource=shp@social.heldscal.la", [Accept: "application/xrd+xml"], []) do + {:ok, %Response{ + status_code: 200, + body: File.read!("test/fixtures/httpoison_mock/shp@social.heldscal.la.xml") + }} + end + def get("https://social.heldscal.la/.well-known/webfinger", [Accept: "application/xrd+xml"], [params: [resource: "shp@social.heldscal.la"]]) do {:ok, %Response{ status_code: 200, @@ -23,7 +30,14 @@ def get("https://social.heldscal.la/.well-known/webfinger", [Accept: "applicatio body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_23211.xml") }} end - + + def get("https://social.heldscal.la/.well-known/webfinger?resource=https://social.heldscal.la/user/23211", [Accept: "application/xrd+xml"], []) do + {:ok, %Response{ + status_code: 200, + body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_23211.xml") + }} + end + def get("https://social.heldscal.la/.well-known/webfinger", [Accept: "application/xrd+xml"], [params: [resource: "https://social.heldscal.la/user/29191"]]) do {:ok, %Response{ status_code: 200, @@ -31,6 +45,13 @@ def get("https://social.heldscal.la/.well-known/webfinger", [Accept: "applicatio }} end + def get("https://social.heldscal.la/.well-known/webfinger?resource=https://social.heldscal.la/user/29191", [Accept: "application/xrd+xml"], []) do + {:ok, %Response{ + status_code: 200, + body: File.read!("test/fixtures/httpoison_mock/https___social.heldscal.la_user_29191.xml") + }} + end + def get("https://mastodon.social/.well-known/webfinger", [Accept: "application/xrd+xml"], [params: [resource: "https://mastodon.social/users/lambadalambda"]]) do {:ok, %Response{ status_code: 200, @@ -38,6 +59,13 @@ def get("https://mastodon.social/.well-known/webfinger", [Accept: "application/x }} end + def get("https://mastodon.social/.well-known/webfinger?resource=https://mastodon.social/users/lambadalambda", [Accept: "application/xrd+xml"], []) do + {:ok, %Response{ + status_code: 200, + body: File.read!("test/fixtures/httpoison_mock/https___mastodon.social_users_lambadalambda.xml") + }} + end + def get("https://shitposter.club/.well-known/webfinger", [Accept: "application/xrd+xml"], [params: [resource: "https://shitposter.club/user/1"]]) do {:ok, %Response{ status_code: 200, @@ -45,6 +73,13 @@ def get("https://shitposter.club/.well-known/webfinger", [Accept: "application/x }} end + def get("https://shitposter.club/.well-known/webfinger?resource=https://shitposter.club/user/1", [Accept: "application/xrd+xml"], []) do + {:ok, %Response{ + status_code: 200, + body: File.read!("test/fixtures/httpoison_mock/https___shitposter.club_user_1.xml") + }} + end + def get("http://gs.example.org/.well-known/webfinger", [Accept: "application/xrd+xml"], [params: [resource: "http://gs.example.org:4040/index.php/user/1"], follow_redirect: true]) do {:ok, %Response{ status_code: 200, @@ -52,6 +87,20 @@ def get("http://gs.example.org/.well-known/webfinger", [Accept: "application/xrd }} end + def get("http://gs.example.org/.well-known/webfinger?resource=http://gs.example.org:4040/index.php/user/1", [Accept: "application/xrd+xml"], []) do + {:ok, %Response{ + status_code: 200, + body: File.read!("test/fixtures/httpoison_mock/http___gs.example.org_4040_index.php_user_1.xml") + }} + end + + def get("https://social.stopwatchingus-heidelberg.de/.well-known/webfinger?resource=https://social.stopwatchingus-heidelberg.de/user/18330", [Accept: "application/xrd+xml"], []) do + {:ok, %Response{ + status_code: 200, + body: File.read!("test/fixtures/httpoison_mock/atarifrosch_webfinger.xml") + }} + end + def get("https://pleroma.soykaf.com/.well-known/webfinger", [Accept: "application/xrd+xml"], [params: [resource: "https://pleroma.soykaf.com/users/lain"]]) do {:ok, %Response{ status_code: 200, @@ -59,6 +108,13 @@ def get("https://pleroma.soykaf.com/.well-known/webfinger", [Accept: "applicatio }} end + def get("https://pleroma.soykaf.com/.well-known/webfinger?resource=https://pleroma.soykaf.com/users/lain", [Accept: "application/xrd+xml"], []) do + {:ok, %Response{ + status_code: 200, + body: File.read!("test/fixtures/httpoison_mock/https___pleroma.soykaf.com_users_lain.xml") + }} + end + def get("https://social.heldscal.la/api/statuses/user_timeline/29191.atom", _body, _headers) do {:ok, %Response{ status_code: 200, @@ -80,6 +136,13 @@ def get("https://mastodon.social/users/lambadalambda.atom", _body, _headers) do }} end + def get("https://social.stopwatchingus-heidelberg.de/api/statuses/user_timeline/18330.atom", _body, _headers) do + {:ok, %Response{ + status_code: 200, + body: File.read!("test/fixtures/httpoison_mock/atarifrosch_feed.xml") + }} + end + def get("https://pleroma.soykaf.com/users/lain/feed.atom", _body, _headers) do {:ok, %Response{ status_code: 200, @@ -135,6 +198,13 @@ def get("https://pawoo.net/.well-known/webfinger", [Accept: "application/xrd+xml }} end + def get("https://pawoo.net/.well-known/webfinger?resource=https://pawoo.net/users/pekorino", [Accept: "application/xrd+xml"], []) do + {:ok, %Response{ + status_code: 200, + body: File.read!("test/fixtures/httpoison_mock/https___pawoo.net_users_pekorino.xml") + }} + end + def get("https://pawoo.net/users/pekorino.atom", _, _) do {:ok, %Response{ status_code: 200, @@ -149,6 +219,13 @@ def get("https://mamot.fr/.well-known/webfinger", [Accept: "application/xrd+xml" }} end + def get("https://mamot.fr/.well-known/webfinger?resource=https://mamot.fr/users/Skruyb", [Accept: "application/xrd+xml"], []) do + {:ok, %Response{ + status_code: 200, + body: File.read!("test/fixtures/httpoison_mock/skruyb@mamot.fr.atom") + }} + end + def get("https://social.sakamoto.gq/.well-known/webfinger", [Accept: "application/xrd+xml"], [params: [resource: "https://social.sakamoto.gq/users/eal"]]) do {:ok, %Response{ status_code: 200, @@ -156,6 +233,20 @@ def get("https://social.sakamoto.gq/.well-known/webfinger", [Accept: "applicatio }} end + def get("https://social.sakamoto.gq/.well-known/webfinger?resource=https://social.sakamoto.gq/users/eal", [Accept: "application/xrd+xml"], []) do + {:ok, %Response{ + status_code: 200, + body: File.read!("test/fixtures/httpoison_mock/eal_sakamoto.xml") + }} + end + + def get("https://squeet.me/xrd/?uri=lain@squeet.me", [Accept: "application/xrd+xml"], []) do + {:ok, %Response{ + status_code: 200, + body: File.read!("test/fixtures/httpoison_mock/lain_squeet.me_webfinger.xml") + }} + end + def get("https://mamot.fr/users/Skruyb.atom", _, _) do {:ok, %Response{ status_code: 200, @@ -171,6 +262,97 @@ def get("https://social.sakamoto.gq/objects/0ccc1a2c-66b0-4305-b23a-7f7f2b040056 end + def get("http://social.heldscal.la/.well-known/host-meta", [], [follow_redirect: true]) do + {:ok, %Response{ + status_code: 200, + body: File.read!("test/fixtures/httpoison_mock/social.heldscal.la_host_meta") + }} + end + + def get("http://macgirvin.com/.well-known/host-meta", [], [follow_redirect: true]) do + {:ok, %Response{ + status_code: 200, + body: File.read!("test/fixtures/httpoison_mock/macgirvin.com_host_meta") + }} + end + + def get("http://mastodon.social/.well-known/host-meta", [], [follow_redirect: true]) do + {:ok, %Response{ + status_code: 200, + body: File.read!("test/fixtures/httpoison_mock/mastodon.social_host_meta") + }} + end + + def get("http://shitposter.club/.well-known/host-meta", [], [follow_redirect: true]) do + {:ok, %Response{ + status_code: 200, + body: File.read!("test/fixtures/httpoison_mock/shitposter.club_host_meta") + }} + end + + def get("http://pleroma.soykaf.com/.well-known/host-meta", [], [follow_redirect: true]) do + {:ok, %Response{ + status_code: 200, + body: File.read!("test/fixtures/httpoison_mock/pleroma.soykaf.com_host_meta") + }} + end + + def get("http://social.sakamoto.gq/.well-known/host-meta", [], [follow_redirect: true]) do + {:ok, %Response{ + status_code: 200, + body: File.read!("test/fixtures/httpoison_mock/social.sakamoto.gq_host_meta") + }} + end + + def get("http://gs.example.org/.well-known/host-meta", [], [follow_redirect: true]) do + {:ok, %Response{ + status_code: 200, + body: File.read!("test/fixtures/httpoison_mock/gs.example.org_host_meta") + }} + end + + def get("http://pawoo.net/.well-known/host-meta", [], [follow_redirect: true]) do + {:ok, %Response{ + status_code: 200, + body: File.read!("test/fixtures/httpoison_mock/pawoo.net_host_meta") + }} + end + + def get("http://mamot.fr/.well-known/host-meta", [], [follow_redirect: true]) do + {:ok, %Response{ + status_code: 200, + body: File.read!("test/fixtures/httpoison_mock/mamot.fr_host_meta") + }} + end + + def get("http://mastodon.xyz/.well-known/host-meta", [], [follow_redirect: true]) do + {:ok, %Response{ + status_code: 200, + body: File.read!("test/fixtures/httpoison_mock/mastodon.xyz_host_meta") + }} + end + + def get("http://social.wxcafe.net/.well-known/host-meta", [], [follow_redirect: true]) do + {:ok, %Response{ + status_code: 200, + body: File.read!("test/fixtures/httpoison_mock/social.wxcafe.net_host_meta") + }} + end + + def get("http://squeet.me/.well-known/host-meta", [], [follow_redirect: true]) do + {:ok, %Response{ + status_code: 200, + body: File.read!("test/fixtures/httpoison_mock/squeet.me_host_meta") + }} + end + + def get("http://social.stopwatchingus-heidelberg.de/.well-known/host-meta", [], [follow_redirect: true]) do + {:ok, %Response{ + status_code: 200, + body: File.read!("test/fixtures/httpoison_mock/social.stopwatchingus-heidelberg.de_host_meta") + }} + end + def get(url, body, headers) do {:error, "Not implemented the mock response for get #{inspect(url)}, #{inspect(body)}, #{inspect(headers)}"} end diff --git a/test/web/web_finger/web_finger_test.exs b/test/web/web_finger/web_finger_test.exs index 495d3d50b..38640b6d3 100644 --- a/test/web/web_finger/web_finger_test.exs +++ b/test/web/web_finger/web_finger_test.exs @@ -31,17 +31,32 @@ test "works for ap_ids" do test "returns the info for a user" do user = "shp@social.heldscal.la" - getter = fn(_url, _headers, [params: [resource: ^user]]) -> - {:ok, %{status_code: 200, body: File.read!("test/fixtures/webfinger.xml")}} - end - - {:ok, data} = WebFinger.finger(user, getter) + {:ok, data} = WebFinger.finger(user) assert data["magic_key"] == "RSA.wQ3i9UA0qmAxZ0WTIp4a-waZn_17Ez1pEEmqmqoooRsG1_BvpmOvLN0G2tEcWWxl2KOtdQMCiPptmQObeZeuj48mdsDZ4ArQinexY2hCCTcbV8Xpswpkb8K05RcKipdg07pnI7tAgQ0VWSZDImncL6YUGlG5YN8b5TjGOwk2VG8=.AQAB" assert data["topic"] == "https://social.heldscal.la/api/statuses/user_timeline/29191.atom" assert data["subject"] == "acct:shp@social.heldscal.la" assert data["salmon"] == "https://social.heldscal.la/main/salmon/user/29191" end + + test "it works for friendica" do + user = "lain@squeet.me" + + {:ok, data} = WebFinger.finger(user) + + end + + test "it gets the xrd endpoint" do + {:ok, template} = WebFinger.find_lrdd_template("social.heldscal.la") + + assert template == "https://social.heldscal.la/.well-known/webfinger?resource={uri}" + end + + test "it gets the xrd endpoint for hubzilla" do + {:ok, template} = WebFinger.find_lrdd_template("macgirvin.com") + + assert template == "https://macgirvin.com/xrd/?uri={uri}" + end end describe "ensure_keys_present" do