aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2024-01-10 13:33:57 +0000
committerMario <mario@mariovavti.com>2024-01-10 13:33:57 +0000
commit58593d7da6a893e681b7c64fdf21a02c93dfa0d0 (patch)
tree9da45b10745d41f4fe66afff9c27b87589ce5e91 /Zotlabs/Module
parent4aa29db7aac6c389a1908a53bce2ec36d7f94ee1 (diff)
downloadvolse-hubzilla-58593d7da6a893e681b7c64fdf21a02c93dfa0d0.tar.gz
volse-hubzilla-58593d7da6a893e681b7c64fdf21a02c93dfa0d0.tar.bz2
volse-hubzilla-58593d7da6a893e681b7c64fdf21a02c93dfa0d0.zip
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
Diffstat (limited to 'Zotlabs/Module')
-rw-r--r--Zotlabs/Module/Activity.php38
-rw-r--r--Zotlabs/Module/Apschema.php65
-rw-r--r--Zotlabs/Module/Event.php26
-rw-r--r--Zotlabs/Module/Follow.php23
4 files changed, 12 insertions, 140 deletions
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));
diff --git a/Zotlabs/Module/Apschema.php b/Zotlabs/Module/Apschema.php
index 8d57fb777..2ec11086a 100644
--- a/Zotlabs/Module/Apschema.php
+++ b/Zotlabs/Module/Apschema.php
@@ -2,70 +2,13 @@
namespace Zotlabs\Module;
+use Zotlabs\Web\Controller;
+use Zotlabs\Lib\Activity;
-class Apschema extends \Zotlabs\Web\Controller {
-
+class Apschema extends Controller {
function init() {
-
- $base = z_root();
-
- $arr = [
- '@context' => [
- 'zot' => z_root() . '/apschema#',
- 'id' => '@id',
- 'type' => '@type',
- 'commentPolicy' => 'zot:commentPolicy',
- 'meData' => 'zot:meData',
- 'meDataType' => 'zot:meDataType',
- 'meEncoding' => 'zot:meEncoding',
- 'meAlgorithm' => 'zot:meAlgorithm',
- 'meCreator' => 'zot:meCreator',
- 'meSignatureValue' => 'zot:meSignatureValue',
- 'locationAddress' => 'zot:locationAddress',
- 'locationPrimary' => 'zot:locationPrimary',
- 'locationDeleted' => 'zot:locationDeleted',
- 'nomadicLocation' => 'zot:nomadicLocation',
- 'nomadicHubs' => 'zot:nomadicHubs',
- 'emojiReaction' => 'zot:emojiReaction',
- 'expires' => 'zot:expires',
- 'directMessage' => 'zot:directMessage',
- 'schema' => 'http://schema.org#',
- 'PropertyValue' => 'schema:PropertyValue',
- 'value' => 'schema:value',
-
- 'manuallyApprovesFollowers' => 'as:manuallyApprovesFollowers',
-
-
- 'magicEnv' => [
- '@id' => 'zot:magicEnv',
- '@type' => '@id'
- ],
-
- 'nomadicLocations' => [
- '@id' => 'zot:nomadicLocations',
- '@type' => '@id'
- ],
-
- 'ostatus' => 'http://ostatus.org#',
- 'conversation' => 'ostatus:conversation',
-
- 'diaspora' => 'https://diasporafoundation.org/ns/',
- 'guid' => 'diaspora:guid',
-
- 'Hashtag' => 'as:Hashtag',
- 'Bookmark' => 'zot:Bookmark',
- 'Category' => 'zot:Category'
-
- ]
- ];
-
header('Content-Type: application/ld+json');
- echo json_encode($arr,JSON_UNESCAPED_SLASHES);
+ echo json_encode(Activity::ap_context(), JSON_UNESCAPED_SLASHES);
killme();
-
}
-
-
-
-
}
diff --git a/Zotlabs/Module/Event.php b/Zotlabs/Module/Event.php
index 22a1341cc..767a8f494 100644
--- a/Zotlabs/Module/Event.php
+++ b/Zotlabs/Module/Event.php
@@ -4,7 +4,6 @@ namespace Zotlabs\Module;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\ActivityStreams;
use Zotlabs\Lib\Activity;
-use Zotlabs\Lib\LDSignatures;
use Zotlabs\Web\HTTPSig;
class Event extends Controller {
@@ -17,7 +16,7 @@ class Event extends Controller {
if(! $item_id)
return;
- $item_normal = " and item.item_hidden = 0 and item.item_type = 0 and item.item_unpublished = 0
+ $item_normal = " and item.item_hidden = 0 and item.item_type = 0 and item.item_unpublished = 0
and item.item_delayed = 0 and item.item_blocked = 0 ";
$sql_extra = item_permissions_sql(0);
@@ -49,28 +48,9 @@ class Event extends Controller {
$obj = $items[0]['obj'];
}
- $x = array_merge(['@context' => [
- ACTIVITYSTREAMS_JSONLD_REV,
- 'https://w3id.org/security/v1',
- z_root() . ZOT_APSCHEMA_REV
- ]], $obj );
-
- $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($obj, $channel);
}
}
-} \ No newline at end of file
+}
diff --git a/Zotlabs/Module/Follow.php b/Zotlabs/Module/Follow.php
index f8bfc11f3..55ff507c8 100644
--- a/Zotlabs/Module/Follow.php
+++ b/Zotlabs/Module/Follow.php
@@ -7,7 +7,6 @@ use Zotlabs\Lib\Libsync;
use Zotlabs\Lib\ActivityStreams;
use Zotlabs\Lib\Activity;
use Zotlabs\Web\HTTPSig;
-use Zotlabs\Lib\LDSignatures;
use Zotlabs\Lib\Connect;
use Zotlabs\Daemon\Master;
@@ -39,30 +38,14 @@ class Follow extends Controller {
http_status_exit(404, 'Not found');
}
- $x = array_merge(['@context' => [
- ACTIVITYSTREAMS_JSONLD_REV,
- 'https://w3id.org/security/v1',
- z_root() . ZOT_APSCHEMA_REV
- ]],
- [
+ $obj = [
'id' => z_root() . '/follow/' . $r[0]['abook_id'],
'type' => 'Follow',
'actor' => $actor,
'object' => $r[0]['xchan_url']
- ]);
-
- $headers = [];
- $headers['Content-Type'] = 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"' ;
- $x['signature'] = LDSignatures::sign($x,$chan);
- $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,$chan['channel_prvkey'],channel_url($chan));
- HTTPSig::set_headers($h);
- echo $ret;
- killme();
+ ];
+ as_return_and_die($obj, $chan);
}
if (! local_channel()) {