Merge branch 'dev' of codeberg.org:streams/streams into dev

This commit is contained in:
Mike Macgirvin 2024-09-04 07:23:32 +10:00
commit 77d9cafb88
6 changed files with 63 additions and 13 deletions

View file

@ -28,9 +28,6 @@ https://codeberg.org/node9/streams.docker
A Yunohost install is present in
https://apps.yunohost.org/app/streams
Managed hosting is available from
https://knthost.com/streams
Language translation instructions are provided in
https://codeberg.org/streams/streams/src/branch/release/util/README

View file

@ -625,7 +625,6 @@ class Notifier implements DaemonInterface
}
logger('notifier: recipients (may be delivered to more if public): ' . print_r($recip_list, true), LOGGER_DEBUG);
// Now we have collected recipients (except for external mentions, @FIXME)
// Let's reduce this to a set of hubs; checking that the site is not dead.
@ -661,7 +660,6 @@ class Notifier implements DaemonInterface
}
}
}
if (! $hubs) {
logger('notifier: no hubs', LOGGER_NORMAL, LOG_NOTICE);
return;
@ -865,9 +863,7 @@ class Notifier implements DaemonInterface
if ($parentItem['replyto']) {
$ptr = unserialise($parentItem['replyto']);
if (is_string($ptr)) {
if (ActivityStreams::is_url($ptr)) {
$audience[] = $ptr;
}
} elseif (is_array($ptr)) {
foreach ($ptr as $rto) {
if (is_string($rto) && ActivityStreams::is_url($rto)) {

View file

@ -2407,9 +2407,10 @@ class Activity
$ap_hubloc = null;
$hublocs = self::get_actor_hublocs($url);
if ($hublocs) {
foreach ($hublocs as $hub) {
if ($hub['hubloc_network'] === 'activitypub') {
if (in_array($hub['hubloc_network'], ['activitypub', 'apnomadic'])) {
$ap_hubloc = $hub;
}
if (in_array($hub['hubloc_network'],['zot6','nomad'])) {
@ -2847,6 +2848,15 @@ class Activity
return;
}
$hublocs = self::get_actor_hublocs($portableId);
if ($hublocs) {
foreach ($hublocs as $hubloc) {
if (in_array($hubloc['hubloc_network'], ['zot6', 'nomad'])) {
return;
}
}
}
$count = 0;
foreach ($gateways as $gateway) {
@ -4650,6 +4660,20 @@ class Activity
public static function find_best_identity($xchan)
{
$actorId = new ActorId($xchan);
if ($actorId->getType() === ActorId::ACTORID_TYPE_DIDKEY) {
$query = q("select * from xchan where xchan_epubkey = '%s'",
dbesc(str_replace('did:key:', '', $actorId->getId()))
);
if ($query) {
foreach ($query as $test) {
if (in_array($test['xchan_network'], ['zot6', 'nomad'])) {
return $test['xchan_hash'];
}
}
}
}
$r = q(
"select hubloc_hash, hubloc_network from hubloc where hubloc_id_url = '%s' and hubloc_deleted = 0 order by hubloc_id desc",
dbesc($xchan)
@ -5159,6 +5183,26 @@ class Activity
}
}
// Edge case. Communications from an apnomadic URL, but they also have a zot6 or nomad hubloc record
// with a traditional hubloc_id_url. Pull out the xchan_hash of the zot6/nomad identity and use it
// instead of the URL that was passed.
$actorId = new ActorId($url);
if ($actorId->getType() === ActorId::ACTORID_TYPE_DIDKEY) {
$ekey = str_replace('did:key:', '', $actorId->getId());
$query = q("select * from xchan where epubkey = '%s'",
dbesc($ekey)
);
if ($query) {
foreach ($query as $test) {
if (in_array($test['xchan_network'], ['nomad', 'zot6'])) {
$url = $test['xchan_hash'];
break;
}
}
}
}
return match (trim($options_arr[0])) {
'activitypub' => q(
"select * from hubloc left join xchan on hubloc_hash = xchan_hash where hubloc_hash = '%s' $sql_options order by hubloc_id DESC ",

View file

@ -117,6 +117,12 @@ class ActivityStreams
if (!$this->replyto) {
$this->replyto = $this->get_property_obj('replyTo');
}
if ($this->replyto) {
$actorId = new ActorId($this->replyto);
if ($actorId->getType() !== ActorId::ACTORID_TYPE_URL) {
$this->replyto = Activity::find_best_identity($actorId->getId());
}
}
$this->edsig = $this->get_compound_property('proof');
if ($this->edsig) {

View file

@ -145,7 +145,14 @@ class Inbox extends Controller
// if the sender has the ability to send messages over zot/nomad, ignore messages sent via activitypub
// as observer aware features and client side markup will be unavailable
if (str_starts_with($hsig['portable_id'], 'did:key:')) {
$test = q("select xchan_network as hubloc_network from xchan where xchan_epubkey = '%s'",
dbesc(str_replace('did:key:', '', $hsig['portable_id']))
);
}
else {
$test = Activity::get_actor_hublocs($hsig['portable_id'], 'all,not_deleted');
}
if ($test) {
foreach ($test as $t) {
if (in_array($t['hubloc_network'], ['zot6', 'nomad'])) {

View file

@ -1,7 +1,7 @@
name: Fresh
description: 'A Fresh new look for Streams.'
version: 'Version: 0.24'
credits: 'Development provided by: <a href="https://www.knthost.com/streams">K&T Host - (www.knthost.com)</a>'
version: 'Version: 0.26'
credits: 'Maintained by community'
author: 'K&T Host'
maintainer:
- 'K&T Host'
- 'Streams community'