Merge branch 'dev' into nomadic

This commit is contained in:
Mike Macgirvin 2024-04-02 09:22:37 +11:00
commit 6fe2fc9e55
3 changed files with 13 additions and 7 deletions

View file

@ -21,11 +21,12 @@ In the conversational model, the same basic steps occur, but respects the rights
A constrained conversation is implemented as a Collection. [FEP-400e](https://codeberg.org/fediverse/fep/src/branch/main/fep/400e/fep-400e.md) provides a model for working with collections. In that proposal, ActivityPub objects which are created as part of a collection are indicated by a `target` "stub" property containing
- type -- ( `Collection` or `OrderedCollection` )
- type -- ( `Collection` or `OrderedCollection` of activities)
- id -- a URL where this collection can be found
- attributedTo -- the `id` of the collection owner
In a constrained conversation, conforming implementations will implement FEP-400e with some very minor additions:
In a constrained conversation, conforming implementations will implement FEP-400e with some very minor additions:
- The collection contains complete activities, not simple objects.
- In a constrained conversation, the target->id and the context are identical. This provides easy identification.
- In a constrained conversation, replies SHOULD only be addressed to the target->attributedTo actor.
- When receiving a correctly signed `Add` activity, checking that the id of the target is a collection owned by `actor` is slightly different from FEP-400e. This can be accomplished by fetching the Collection object and validating the attributedTo field.
@ -205,7 +206,7 @@ Processing is otherwise identical. In the reference implementation of conversati
}
},
"target": {
"id": "https://streams.lndo.site/item/ed4775f8-18ee-46a5-821e-b2ed2dc546e8",
"id": "https://streams.lndo.site/conversation/ed4775f8-18ee-46a5-821e-b2ed2dc546e8",
"type": "Collection",
"attributedTo": "https://streams.lndo.site/channel/red"
},
@ -442,7 +443,7 @@ Processing is otherwise identical. In the reference implementation of conversati
}
},
"target": {
"id": "https://streams.lndo.site/item/ed4775f8-18ee-46a5-821e-b2ed2dc546e8",
"id": "https://streams.lndo.site/conversation/ed4775f8-18ee-46a5-821e-b2ed2dc546e8",
"type": "Collection",
"attributedTo": "https://streams.lndo.site/channel/red"
},

View file

@ -4987,7 +4987,6 @@ class Activity
public static function addToCollection($channel, $object, $target, $sourceItem = null, $deliver = true)
{
btlogger('addtocollection');
if (!isset($channel['xchan_hash'])) {
$channel = Channel::from_hash($channel['channel_hash']);
}
@ -5004,7 +5003,7 @@ class Activity
->setReplyto(z_root() . '/channel/' . $channel['channel_address'])
->setTgtType('Collection')
->setTarget([
'id' => $target,
'id' => str_replace('/item/','/conversation/', $target),
'type' => 'Collection',
'attributedTo' => z_root() . '/channel/' . $channel['channel_address']
]
@ -5041,7 +5040,7 @@ class Activity
->setReplyto(z_root() . '/channel/' . $channel['channel_address'])
->setTgtType('Collection')
->setTarget([
'id' => $target,
'id' => str_replace('/item/','/conversation/', $target),
'type' => 'Collection',
'attributedTo' => z_root() . '/channel/' . $channel['channel_address']
]

View file

@ -213,6 +213,9 @@ class HTTPSig
logger('verified: ' . intval($x), LOGGER_DEBUG);
if (!$x) {
// try again, ignoring the local actor (xchan) cache and refetching the key
// from its source
@ -226,9 +229,12 @@ class HTTPSig
if (!$y) {
btlogger('verify failed for ' . $result['signer'] . ' alg=' . $algorithm . (($fkey['public_key']) ? '' : ' no key'));
$sig_block['signature'] = base64_encode($sig_block['signature']);
logger('affected sigblock: ' . print_r($sig_block, true));
logger('headers: ' . print_r($headers, true));
logger('server: ' . print_r($_SERVER, true));
logger('signed_data: ' . print_r($signed_data,true));
return $result;
}
}