rmagic discovery for z6 networks
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
<?php
|
||||
|
||||
use Zotlabs\Lib\Zotfinger;
|
||||
use Zotlabs\Lib\Libzot;
|
||||
|
||||
/**
|
||||
* @file include/network.php
|
||||
* @brief Network related functions.
|
||||
@@ -1196,6 +1200,31 @@ function discover_by_webbie($webbie, $protocol = '') {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach($x['links'] as $link) {
|
||||
if(array_key_exists('rel',$link)) {
|
||||
if($link['rel'] === PROTOCOL_ZOT6 && ((! $protocol) || (strtolower($protocol) === 'zot6'))) {
|
||||
logger('zot6 found for ' . $webbie, LOGGER_DEBUG);
|
||||
$record = Zotfinger::exec($link['href']);
|
||||
|
||||
// Check the HTTP signature
|
||||
|
||||
$hsig = $record['signature'];
|
||||
if($hsig && ($hsig['signer'] === $url || $hsig['signer'] === $link['href']) && $hsig['header_valid'] === true && $hsig['content_valid'] === true)
|
||||
$hsig_valid = true;
|
||||
|
||||
if(! $hsig_valid) {
|
||||
logger('http signature not valid: ' . print_r($hsig,true));
|
||||
continue;
|
||||
}
|
||||
|
||||
$x = Libzot::import_xchan($record['data']);
|
||||
if($x['success']) {
|
||||
return $x['hash'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
logger('webfinger: ' . print_r($x,true), LOGGER_DATA, LOG_INFO);
|
||||
|
||||
Reference in New Issue
Block a user