aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2018-12-10 10:38:06 +0100
committerMario Vavti <mario@mariovavti.com>2018-12-10 10:38:06 +0100
commit15a689c6f549e25a1301a8cb8ba92c4cd4f90300 (patch)
tree7853e7adfa1c105038fdc0fe53f4e896925b3d65 /include
parent61f7c1e7d717cee4feb769e8e66cea53514a684f (diff)
parent30efeb5becb2b5e1133f429460c5c3bbc9b44f55 (diff)
downloadvolse-hubzilla-15a689c6f549e25a1301a8cb8ba92c4cd4f90300.tar.gz
volse-hubzilla-15a689c6f549e25a1301a8cb8ba92c4cd4f90300.tar.bz2
volse-hubzilla-15a689c6f549e25a1301a8cb8ba92c4cd4f90300.zip
Merge remote-tracking branch 'mike/master' into dev
Diffstat (limited to 'include')
-rw-r--r--include/network.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/include/network.php b/include/network.php
index 183a47105..cd352e7db 100644
--- a/include/network.php
+++ b/include/network.php
@@ -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);