From a25f4e5f7bcb2b82d326eec2aed3d3e8d8a2ea65 Mon Sep 17 00:00:00 2001 From: Mike Macgirvin Date: Sat, 6 Jul 2024 06:16:49 +1000 Subject: [PATCH] cleanup and fixes --- include/attach.php | 6 +++--- src/Lib/Channel.php | 9 ++++++++- src/Module/Outbox.php | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/include/attach.php b/include/attach.php index 94d54ea08..14af3710f 100644 --- a/include/attach.php +++ b/include/attach.php @@ -1101,9 +1101,9 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) } if ($notify) { - $cloudPath = Channel::getDidResolver($channel) . '/cloud/' . $channel['channel_address'] . '/' . $r['0']['display_path']; - $object = get_file_activity_object($channel['channel_id'], $r['0']['hash'], $cloudPath); - file_activity($channel['channel_id'], $object, $r['0']['allow_cid'], $r['0']['allow_gid'], $r['0']['deny_cid'], $r['0']['deny_gid'], 'post', $notify); + $cloudPath = Channel::getDidResolver($channel) . '/cloud/' . $channel['channel_address'] . '/' . $r[0]['display_path']; + $object = get_file_activity_object($channel['channel_id'], $r[0]['hash'], $cloudPath); + file_activity($channel['channel_id'], $object, $r[0]['allow_cid'], $r[0]['allow_gid'], $r[0]['deny_cid'], $r[0]['deny_gid'], 'post', $notify); } return $ret; diff --git a/src/Lib/Channel.php b/src/Lib/Channel.php index 2c4a41813..c91ec6d6c 100644 --- a/src/Lib/Channel.php +++ b/src/Lib/Channel.php @@ -2089,7 +2089,14 @@ class Channel public static function getDidResolver($channel, $isActor = false) { - return z_root() . '/.well-known/apgateway/' . self::getDid($channel) . (($isActor) ? '/actor' : ''); + $isNomadic = PConfig::Get($channel['channel_id'], 'system', 'nomadicAP'); + if ($isActor) { + return (($isNomadic) + ? z_root() . '/.well-known/apgateway/' . self::getDid($channel) . '/actor' + : z_root() . '/channel/' . $channel['channel_address'] + ); + } + return z_root() . '/.well-known/apgateway/' . self::getDid($channel); } public static function getNomadResolver($channel, $isActor = false) diff --git a/src/Module/Outbox.php b/src/Module/Outbox.php index 384f0b893..98ee72de9 100644 --- a/src/Module/Outbox.php +++ b/src/Module/Outbox.php @@ -271,7 +271,7 @@ class Outbox extends Controller } if (App::$pager['unset'] && $total > 100) { - $ret = Activity::paged_collection_init($total, App::$query_string, attributedTo: z_root() . '/channel/' . $channel['channel_address']); + $ret = Activity::paged_collection_init($total, App::$query_string, attributedTo: Channel::getDidResolver($channel, true)); } else { $items = items_fetch( [