aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Zotlabs/Daemon/Gprobe.php28
-rw-r--r--Zotlabs/Lib/Activity.php18
-rw-r--r--Zotlabs/Lib/Libzot.php10
3 files changed, 41 insertions, 15 deletions
diff --git a/Zotlabs/Daemon/Gprobe.php b/Zotlabs/Daemon/Gprobe.php
index 29efcf475..1124ead54 100644
--- a/Zotlabs/Daemon/Gprobe.php
+++ b/Zotlabs/Daemon/Gprobe.php
@@ -15,19 +15,31 @@ class Gprobe {
return;
$url = hex2bin($argv[1]);
+ $is_webbie = false;
+ $r = null;
- if (!strpos($url, '@'))
- return;
+ if (filter_var($url, FILTER_VALIDATE_EMAIL)) {
+ $is_webbie = true;
- $r = q("select * from hubloc where hubloc_addr = '%s' and hubloc_network = 'zot6' limit 1",
- dbesc($url)
- );
+ $r = q("select * from hubloc where hubloc_addr = '%s' and hubloc_network = 'zot6' limit 1",
+ dbesc($url)
+ );
+ }
+ elseif (filter_var($url, FILTER_VALIDATE_URL)) {
+ $r = q("select * from hubloc where hubloc_id_url = '%s' and hubloc_network = 'zot6' limit 1",
+ dbesc($url)
+ );
+ }
if (!$r) {
- $href = Webfinger::zot_url(punify($url));
- if ($href) {
- $zf = Zotfinger::exec($href, null);
+ if ($is_webbie) {
+ $url = Webfinger::zot_url(punify($url));
}
+
+ if ($url) {
+ $zf = Zotfinger::exec($url, null);
+ }
+
if (is_array($zf) && array_path_exists('signature/signer', $zf) && $zf['signature']['signer'] === $href && intval($zf['signature']['header_valid'])) {
Libzot::import_xchan($zf['data']);
}
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php
index fe5ee0ec7..e959ac879 100644
--- a/Zotlabs/Lib/Activity.php
+++ b/Zotlabs/Lib/Activity.php
@@ -1618,6 +1618,7 @@ class Activity {
$ap_hubloc = null;
$hublocs = self::get_actor_hublocs($url);
+ $has_zot_hubloc = false;
if ($hublocs) {
foreach ($hublocs as $hub) {
@@ -1625,6 +1626,7 @@ class Activity {
$ap_hubloc = $hub;
}
if ($hub['hubloc_network'] === 'zot6') {
+ $has_zot_hubloc = true;
Libzot::update_cached_hubloc($hub);
}
}
@@ -1648,16 +1650,18 @@ class Activity {
return;
}
- $inbox = $person_obj['inbox'];
+ $inbox = $person_obj['inbox'] ?? null;
- // invalid identity
+ // invalid AP identity
if (!$inbox || strpos($inbox, z_root()) !== false) {
return;
}
// store the actor record in XConfig
- XConfig::Set($url, 'system', 'actor_record', $person_obj);
+
+ // we already store this in Activity::fetch()
+ // XConfig::Set($url, 'system', 'actor_record', $person_obj);
$name = $person_obj['name'];
if (!$name) {
@@ -1814,12 +1818,12 @@ class Activity {
// Adding zot discovery urls to the actor record will cause federation to fail with the 20-30 projects which don't accept arrays in the url field.
$actor_protocols = self::get_actor_protocols($person_obj);
- if (in_array('zot6', $actor_protocols)) {
+ if (!$has_zot_hubloc && in_array('zot6', $actor_protocols)) {
$zx = q("select * from hubloc where hubloc_id_url = '%s' and hubloc_network = 'zot6'",
dbesc($url)
);
- if (!$zx && $webfinger_addr) {
- Master::Summon(['Gprobe', bin2hex($webfinger_addr)]);
+ if (!$zx) {
+ Master::Summon(['Gprobe', bin2hex($url)]);
}
}
@@ -3796,7 +3800,7 @@ class Activity {
return $ret;
}
- foreach ($tag as $t) {
+ foreach ($actor['tag'] as $t) {
if ((isset($t['type']) && $t['type'] === 'PropertyValue') &&
(isset($t['name']) && $t['name'] === 'Protocol') &&
(isset($t['value']) && in_array($t['value'], ['zot6', 'activitypub', 'diaspora']))
diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php
index 83536a033..52d08e000 100644
--- a/Zotlabs/Lib/Libzot.php
+++ b/Zotlabs/Lib/Libzot.php
@@ -1227,6 +1227,16 @@ class Libzot {
dbesc($AS->actor['id'])
);
+ if (! $r) {
+ // Author is unknown to this site. Perform channel discovery and try again.
+ $z = discover_by_webbie($AS->actor['id']);
+ if ($z) {
+ $r = q("select hubloc_hash, hubloc_network, hubloc_url from hubloc where hubloc_id_url = '%s'",
+ dbesc($AS->actor['id'])
+ );
+ }
+ }
+
if ($r) {
$r = self::zot_record_preferred($r);
$arr['author_xchan'] = $r['hubloc_hash'];