Merge branch 'dev' of /home/macgirvin/z into dev

This commit is contained in:
nobody 2021-11-20 15:45:19 -08:00
commit bfe81e52f9
6 changed files with 65 additions and 14 deletions

View file

@ -158,8 +158,8 @@ class Notifier {
$r = q("select * from abook left join xchan on abook_xchan = xchan_hash where abook_id = %d and abook_self = 0",
intval($item_id)
);
if ($r) {
$recip = array_shift($r);
$uid = $recip['abook_channel'];
// Get the sender

View file

@ -484,7 +484,9 @@ class ActivityPub {
}
}
}
if (isset($person_obj)) {
Activity::actor_store($person_obj['id'],$person_obj, $force);
return $person_obj['id'];
}

View file

@ -15,10 +15,17 @@ class Nodeinfo {
if ($n['success']) {
$j = json_decode($n['body'], true);
if ($j && $j['links']) {
// lemmy just sends one result
if (isset($j['links']['rel'])) {
if ($j['links']['rel'] === 'http://nodeinfo.diaspora.software/ns/schema/2.0' && isset($j['links']['href'])) {
$href = $j['links']['href'];
}
}
else {
foreach ($j['links'] as $l) {
if ($l['rel'] === 'http://nodeinfo.diaspora.software/ns/schema/2.0' && $l['href']) {
if (isset($l['rel']) && $l['rel'] === 'http://nodeinfo.diaspora.software/ns/schema/2.0' && isset($l['href'])) {
$href = $l['href'];
}
}
}
}

View file

@ -12,11 +12,31 @@ class Queue {
static function update($id, $add_priority = 0) {
logger('queue: requeue item ' . $id,LOGGER_DEBUG);
$x = q("select outq_created, outq_posturl from outq where outq_hash = '%s' limit 1",
// This queue item failed. Perhaps it was rejected. Perhaps the site is dead.
// Since we don't really know, check and see if we've got something else destined
// for that server and give it priority. At a minimum it will keep the queue from
// getting stuck on a particular message when another one with different content
// might actually succeed.
$x = q("select outq_created, outq_hash, outq_posturl from outq where outq_hash = '%s' limit 1",
dbesc($id)
);
if(! $x)
if (! $x) {
return;
}
$g = q("select outq_created, outq_hash, outq_posturl from outq where outq_posturl = '%s' and outq_hash != '%s' limit 1",
dbesc($x[0]['outq_posturl']),
dbesc($id)
);
// swap them
if ($g) {
$x = $g;
}
$y = q("select min(outq_created) as earliest from outq where outq_posturl = '%s'",
@ -46,7 +66,7 @@ class Queue {
dbesc($x[0]['outq_posturl'])
);
$since = datetime_convert('UTC','UTC',$x[0]['outq_created']);
$since = datetime_convert('UTC','UTC',$y[0]['earliest']);
if(($might_be_down) || ($since < datetime_convert('UTC','UTC','now - 12 hour'))) {
$next = datetime_convert('UTC','UTC','now + 1 hour');
@ -63,7 +83,7 @@ class Queue {
dbesc(datetime_convert()),
intval($add_priority),
dbesc($next),
dbesc($id)
dbesc($x[0]['outq_hash'])
);
}

View file

@ -345,15 +345,37 @@ class HTTPSig {
// The record wasn't in cache. Fetch it now.
$r = Activity::fetch($id);
$signatureAlgorithm = EMPTY_STR;
if ($r) {
if (array_key_exists('publicKey',$r) && array_key_exists('publicKeyPem',$r['publicKey']) && array_key_exists('id',$r['publicKey'])) {
if ($r['publicKey']['id'] === $id || $r['id'] === $id) {
$portable_id = ((array_key_exists('owner',$r['publicKey'])) ? $r['publicKey']['owner'] : EMPTY_STR);
// the w3c sec context has conflicting names and no defined values for this property except
// "http://www.w3.org/2000/09/xmldsig#rsa-sha1"
// Since the names conflict, it could mess up LD-signatures but we will accept both, and at this
// time we will only look for the substrings 'rsa-sha256' and 'rsa-sha512' within those properties.
// We will also accept a toplevel 'sigAlgorithm' regardless of namespace with the same constraints.
// Default to rsa-sha256 if we can't figure out. If they're sending 'hs2019' we have to
// look for something.
if (isset($r['publicKey']['signingAlgorithm'])) {
set_xconfig($portable_id,'system','signing_algorithm',$r['publicKey']['signingAlgorithm']);
$signatureAlgorithm = $r['publicKey']['signingAlgorithm'];
set_xconfig($portable_id,'system','signing_algorithm',$signatureAlgorithm);
}
return [ 'public_key' => self::convertKey($r['publicKey']['publicKeyPem']), 'portable_id' => $portable_id, 'algorithm' => ((isset($r['publicKey']['signingAlgorithm'])) ? $r['publicKey']['signingAlgorithm'] : EMPTY_STR), 'hubloc' => [] ];
if (isset($r['publicKey']['signatureAlgorithm'])) {
$signatureAlgorithm = $r['publicKey']['signatureAlgorithm'];
set_xconfig($portable_id,'system','signing_algorithm',$signatureAlgorithm);
}
if (isset($r['sigAlgorithm'])) {
$signatureAlgorithm = $r['sigAlgorithm'];
set_xconfig($portable_id,'system','signing_algorithm',$signatureAlgorithm);
}
return [ 'public_key' => self::convertKey($r['publicKey']['publicKeyPem']), 'portable_id' => $portable_id, 'algorithm' => (($signatureAlgorithm) ? $signatureAlgorithm : 'rsa-sha256'), 'hubloc' => [] ];
}
}
}

View file

@ -17,7 +17,7 @@ use Zotlabs\Daemon\Run;
* @brief This file defines some global constants and includes the central App class.
*/
define ( 'STD_VERSION', '21.11.14' );
define ( 'STD_VERSION', '21.11.20' );
define ( 'ZOT_REVISION', '10.0' );
define ( 'DB_UPDATE_VERSION', 1254 );