mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-19 23:35:12 +00:00
Merge branch 'dev' of /home/macgirvin/z into dev
This commit is contained in:
commit
bfe81e52f9
6 changed files with 65 additions and 14 deletions
|
@ -153,13 +153,13 @@ class Notifier {
|
||||||
}
|
}
|
||||||
elseif (in_array($cmd, [ 'permissions_update', 'permissions_reject', 'permissions_accept', 'permissions_create' ])) {
|
elseif (in_array($cmd, [ 'permissions_update', 'permissions_reject', 'permissions_accept', 'permissions_create' ])) {
|
||||||
|
|
||||||
// Get the (single) recipient
|
// Get the (single) recipient
|
||||||
|
|
||||||
$r = q("select * from abook left join xchan on abook_xchan = xchan_hash where abook_id = %d and abook_self = 0",
|
$r = q("select * from abook left join xchan on abook_xchan = xchan_hash where abook_id = %d and abook_self = 0",
|
||||||
intval($item_id)
|
intval($item_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($r) {
|
if ($r) {
|
||||||
|
|
||||||
$recip = array_shift($r);
|
$recip = array_shift($r);
|
||||||
$uid = $recip['abook_channel'];
|
$uid = $recip['abook_channel'];
|
||||||
// Get the sender
|
// Get the sender
|
||||||
|
|
|
@ -484,7 +484,9 @@ class ActivityPub {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($person_obj)) {
|
if (isset($person_obj)) {
|
||||||
|
|
||||||
Activity::actor_store($person_obj['id'],$person_obj, $force);
|
Activity::actor_store($person_obj['id'],$person_obj, $force);
|
||||||
return $person_obj['id'];
|
return $person_obj['id'];
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,10 +15,17 @@ class Nodeinfo {
|
||||||
if ($n['success']) {
|
if ($n['success']) {
|
||||||
$j = json_decode($n['body'], true);
|
$j = json_decode($n['body'], true);
|
||||||
if ($j && $j['links']) {
|
if ($j && $j['links']) {
|
||||||
foreach ($j['links'] as $l) {
|
// lemmy just sends one result
|
||||||
if ($l['rel'] === 'http://nodeinfo.diaspora.software/ns/schema/2.0' && $l['href']) {
|
if (isset($j['links']['rel'])) {
|
||||||
$href = $l['href'];
|
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 (isset($l['rel']) && $l['rel'] === 'http://nodeinfo.diaspora.software/ns/schema/2.0' && isset($l['href'])) {
|
||||||
|
$href = $l['href'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,11 +12,31 @@ class Queue {
|
||||||
static function update($id, $add_priority = 0) {
|
static function update($id, $add_priority = 0) {
|
||||||
|
|
||||||
logger('queue: requeue item ' . $id,LOGGER_DEBUG);
|
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)
|
dbesc($id)
|
||||||
);
|
);
|
||||||
if(! $x)
|
if (! $x) {
|
||||||
return;
|
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'",
|
$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'])
|
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'))) {
|
if(($might_be_down) || ($since < datetime_convert('UTC','UTC','now - 12 hour'))) {
|
||||||
$next = datetime_convert('UTC','UTC','now + 1 hour');
|
$next = datetime_convert('UTC','UTC','now + 1 hour');
|
||||||
|
@ -63,7 +83,7 @@ class Queue {
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
intval($add_priority),
|
intval($add_priority),
|
||||||
dbesc($next),
|
dbesc($next),
|
||||||
dbesc($id)
|
dbesc($x[0]['outq_hash'])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -345,15 +345,37 @@ class HTTPSig {
|
||||||
// The record wasn't in cache. Fetch it now.
|
// The record wasn't in cache. Fetch it now.
|
||||||
|
|
||||||
$r = Activity::fetch($id);
|
$r = Activity::fetch($id);
|
||||||
|
$signatureAlgorithm = EMPTY_STR;
|
||||||
|
|
||||||
if ($r) {
|
if ($r) {
|
||||||
if (array_key_exists('publicKey',$r) && array_key_exists('publicKeyPem',$r['publicKey']) && array_key_exists('id',$r['publicKey'])) {
|
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) {
|
if ($r['publicKey']['id'] === $id || $r['id'] === $id) {
|
||||||
$portable_id = ((array_key_exists('owner',$r['publicKey'])) ? $r['publicKey']['owner'] : EMPTY_STR);
|
$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'])) {
|
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' => [] ];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
2
boot.php
2
boot.php
|
@ -17,7 +17,7 @@ use Zotlabs\Daemon\Run;
|
||||||
* @brief This file defines some global constants and includes the central App class.
|
* @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 ( 'ZOT_REVISION', '10.0' );
|
||||||
|
|
||||||
define ( 'DB_UPDATE_VERSION', 1254 );
|
define ( 'DB_UPDATE_VERSION', 1254 );
|
||||||
|
|
Loading…
Reference in a new issue