From 58593d7da6a893e681b7c64fdf21a02c93dfa0d0 Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 10 Jan 2024 13:33:57 +0000 Subject: prepare outbound fep-8b32 (object integrity) but do not enable yet since the additional context seems to break ldsig for some reason, introduce Activity::build_packet() and Activity::ap_context() to reduce code duplication, implement fep-2c59 (webfinger) and some cleanup --- Zotlabs/Module/Activity.php | 38 ++------------------------------------ 1 file changed, 2 insertions(+), 36 deletions(-) (limited to 'Zotlabs/Module/Activity.php') diff --git a/Zotlabs/Module/Activity.php b/Zotlabs/Module/Activity.php index 4ddfe602d..b2f0ce498 100644 --- a/Zotlabs/Module/Activity.php +++ b/Zotlabs/Module/Activity.php @@ -7,7 +7,6 @@ use Zotlabs\Web\Controller; use Zotlabs\Daemon\Master; use Zotlabs\Lib\Activity as ZlibActivity; use Zotlabs\Lib\ActivityStreams; -use Zotlabs\Lib\LDSignatures; use Zotlabs\Web\HTTPSig; use Zotlabs\Lib\Libzot; use Zotlabs\Lib\ThreadListener; @@ -155,22 +154,7 @@ class Activity extends Controller { if(! $i) http_status_exit(404, 'Not found'); - $x = array_merge(['@context' => [ - ACTIVITYSTREAMS_JSONLD_REV, - 'https://w3id.org/security/v1', - z_root() . ZOT_APSCHEMA_REV - ]], $i); - - $headers = []; - $headers['Content-Type'] = 'application/x-zot+json' ; - $x['signature'] = LDSignatures::sign($x,$chan); - $ret = json_encode($x, JSON_UNESCAPED_SLASHES); - $headers['Digest'] = HTTPSig::generate_digest_header($ret); - $headers['(request-target)'] = strtolower($_SERVER['REQUEST_METHOD']) . ' ' . $_SERVER['REQUEST_URI']; - $h = HTTPSig::create_sig($headers,$chan['channel_prvkey'],channel_url($chan)); - HTTPSig::set_headers($h); - echo $ret; - killme(); + as_return_and_die($i, $chan); } @@ -260,25 +244,7 @@ class Activity extends Controller { $channel = channelx_by_n($items[0]['uid']); - $x = array_merge( ['@context' => [ - ACTIVITYSTREAMS_JSONLD_REV, - 'https://w3id.org/security/v1', - z_root() . ZOT_APSCHEMA_REV - ]], ZlibActivity::encode_activity($items[0],true)); - - $headers = []; - $headers['Content-Type'] = 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"' ; - $x['signature'] = LDSignatures::sign($x,$channel); - $ret = json_encode($x, JSON_UNESCAPED_SLASHES); - $headers['Date'] = datetime_convert('UTC','UTC', 'now', 'D, d M Y H:i:s \\G\\M\\T'); - $headers['Digest'] = HTTPSig::generate_digest_header($ret); - $headers['(request-target)'] = strtolower($_SERVER['REQUEST_METHOD']) . ' ' . $_SERVER['REQUEST_URI']; - - $h = HTTPSig::create_sig($headers,$channel['channel_prvkey'],channel_url($channel)); - HTTPSig::set_headers($h); - echo $ret; - killme(); - + as_return_and_die(ZlibActivity::encode_activity($items[0]), $channel); } goaway(z_root() . '/item/' . argv(1)); -- cgit v1.2.3 From af839a05892f9446e86327ba04787b3a697c379c Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 1 Mar 2024 15:47:40 +0000 Subject: AS2 Follow/Ignore --- Zotlabs/Module/Activity.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Module/Activity.php') diff --git a/Zotlabs/Module/Activity.php b/Zotlabs/Module/Activity.php index b2f0ce498..133312e28 100644 --- a/Zotlabs/Module/Activity.php +++ b/Zotlabs/Module/Activity.php @@ -25,7 +25,7 @@ class Activity extends Controller { $portable_id = EMPTY_STR; - $item_normal_extra = sprintf(" and not verb in ('%s', '%s') ", + $item_normal_extra = sprintf(" and not verb in ('Follow', 'Ignore', '%s', '%s') ", dbesc(ACTIVITY_FOLLOW), dbesc(ACTIVITY_UNFOLLOW) ); @@ -186,7 +186,7 @@ class Activity extends Controller { } } - $item_normal_extra = sprintf(" and not verb in ('%s', '%s') ", + $item_normal_extra = sprintf(" and not verb in ('Follow', 'Ignore', '%s', '%s') ", dbesc(ACTIVITY_FOLLOW), dbesc(ACTIVITY_UNFOLLOW) ); -- cgit v1.2.3