1
0
Fork 0

Scrape the public key from the hcard if not present in webfinger

This commit is contained in:
Michael Vogel 2015-12-28 16:49:19 +01:00
parent 9d83892151
commit 3476e21b28

View file

@ -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;