aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2021-04-21 07:55:35 +0000
committerMario <mario@mariovavti.com>2021-04-21 07:55:35 +0000
commit35df50c39d95e19dcd7e67bd3328059dbb591b66 (patch)
tree05559dd4093c8953d850c25cc1be4467147b32f6
parent5dfe4ef6f8efc34de03953a91980b52646233a29 (diff)
downloadvolse-hubzilla-35df50c39d95e19dcd7e67bd3328059dbb591b66.tar.gz
volse-hubzilla-35df50c39d95e19dcd7e67bd3328059dbb591b66.tar.bz2
volse-hubzilla-35df50c39d95e19dcd7e67bd3328059dbb591b66.zip
start sending author id, id_sig and key fields along with author/owner and adjust import_author_xchan() accordingly
-rw-r--r--Zotlabs/Lib/Libzot.php6
-rw-r--r--include/items.php28
2 files changed, 22 insertions, 12 deletions
diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php
index db35dfb70..a19c8e544 100644
--- a/Zotlabs/Lib/Libzot.php
+++ b/Zotlabs/Lib/Libzot.php
@@ -2664,9 +2664,9 @@ class Libzot {
// we may only end up with one; which results in posts with no author name or photo and are a bit
// of a hassle to repair. If either or both are missing, do a full discovery probe.
- if (!array_key_exists('id', $x)) {
- return import_author_activitypub($x);
- }
+ //if (!array_key_exists('id', $x)) {
+ //return import_author_activitypub($x);
+ //}
$hash = self::make_xchan_hash($x['id'], $x['key']);
diff --git a/include/items.php b/include/items.php
index 8b22a7b4c..0d1047e13 100644
--- a/include/items.php
+++ b/include/items.php
@@ -908,7 +908,6 @@ function get_item_elements($x,$allow_code = false) {
$arr['item_type'] = ITEM_TYPE_DOC;
}
}
-
return $arr;
}
@@ -926,17 +925,26 @@ function import_author_xchan($x) {
* * \e string \b xchan_hash - Thre returned value
*/
call_hooks('import_author_xchan', $arr);
- if($arr['xchan_hash'])
+ if($arr['xchan_hash']) {
return $arr['xchan_hash'];
+ }
$y = false;
- if((! array_key_exists('network', $x)) || ($x['network'] === 'zot')) {
+ if((isset($x['id']) && isset($x['key'])) && (!isset($x['network']) || $x['network'] === 'zot6')) {
+ $y = Libzot::import_author_zot($x);
+ }
+
+ if(!isset($x['network']) || $x['network'] === 'zot') {
$y = import_author_zot($x);
}
- // if we were told that it's a zot connection, don't probe/import anything else
- if(array_key_exists('network',$x) && $x['network'] === 'zot') {
+ // if we were told that it's a zot6 connection, don't probe/import anything else
+ if(isset($x['network']) && $x['network'] === 'zot6') {
+ return $y;
+ }
+
+ if(isset($x['network']) && $x['network'] === 'zot') {
if($x['url']) {
// check if we already have the zot6 xchan of this xchan_url. if not import it.
$r = q("SELECT xchan_hash FROM xchan WHERE xchan_url = '%s' AND xchan_network = 'zot6'",
@@ -951,10 +959,8 @@ function import_author_xchan($x) {
}
// perform zot6 discovery
-
if($x['url']) {
- $y = discover_by_webbie($x['url'],'zot6');
-
+ $y = discover_by_webbie($x['url'], 'zot6');
if($y) {
return $y;
}
@@ -968,7 +974,7 @@ function import_author_xchan($x) {
$y = import_author_unknown($x);
}
- return($y);
+ return $y;
}
/**
@@ -1296,6 +1302,10 @@ function encode_item_xchan($xchan) {
$ret['guid'] = $xchan['xchan_guid'];
$ret['guid_sig'] = $xchan['xchan_guid_sig'];
+ $ret['id'] = $xchan['xchan_guid'];
+ $ret['id_sig'] = $xchan['xchan_guid_sig'];
+ $ret['key'] = $xchan['xchan_pubkey'];
+
return $ret;
}