From 3476e21b28e6d3cc9e55a56bd29335c8c33c87b3 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Mon, 28 Dec 2015 16:49:19 +0100 Subject: [PATCH 1/2] Scrape the public key from the hcard if not present in webfinger --- include/Scrape.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/include/Scrape.php b/include/Scrape.php index 6ee3dabfca..af91d38d5c 100644 --- a/include/Scrape.php +++ b/include/Scrape.php @@ -529,9 +529,9 @@ function probe_url($url, $mode = PROBE_NORMAL, $level = 1) { } } - if(strlen($dfrn)) { $ret = scrape_dfrn(($hcard) ? $hcard : $dfrn, true); + if(is_array($ret) && x($ret,'dfrn-request')) { $network = NETWORK_DFRN; $request = $ret['dfrn-request']; @@ -547,6 +547,19 @@ function probe_url($url, $mode = PROBE_NORMAL, $level = 1) { } } + // Scrape the public key from the hcard. + // Diaspora will remove it from the webfinger somewhere in the future. + if (($hcard != "") AND ($pubkey == "")) { + $ret = scrape_dfrn(($hcard) ? $hcard : $dfrn, true); + if (isset($ret["key"])) { + $hcard_key = $ret["key"]; + if(strstr($hcard_key,'RSA ')) + $pubkey = rsatopem($hcard_key); + else + $pubkey = $hcard_key; + } + } + if($diaspora && $diaspora_base && $diaspora_guid) { if($mode == PROBE_DIASPORA || ! $notify) { $notify = $diaspora_base . 'receive/users/' . $diaspora_guid; From 4c08b0ceb6e4f12452a124ced63c0711e908d2bf Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Mon, 28 Dec 2015 17:09:22 +0100 Subject: [PATCH 2/2] code cleanup --- include/Scrape.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/Scrape.php b/include/Scrape.php index af91d38d5c..cb192c77c2 100644 --- a/include/Scrape.php +++ b/include/Scrape.php @@ -529,9 +529,9 @@ function probe_url($url, $mode = PROBE_NORMAL, $level = 1) { } } + if(strlen($dfrn)) { $ret = scrape_dfrn(($hcard) ? $hcard : $dfrn, true); - if(is_array($ret) && x($ret,'dfrn-request')) { $network = NETWORK_DFRN; $request = $ret['dfrn-request'];