aboutsummaryrefslogtreecommitdiffstats
path: root/include/network.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/network.php')
-rw-r--r--include/network.php17
1 files changed, 5 insertions, 12 deletions
diff --git a/include/network.php b/include/network.php
index 13339eccd..854434d5a 100644
--- a/include/network.php
+++ b/include/network.php
@@ -1,6 +1,6 @@
<?php
-use Zotlabs\Lib\LDSignatures;
+use Zotlabs\Lib\Activity;
use Zotlabs\Lib\Zotfinger;
use Zotlabs\Lib\Libzot;
use Zotlabs\Lib\Queue;
@@ -423,24 +423,17 @@ function json_return_and_die($x, $content_type = 'application/json') {
killme();
}
-function as_return_and_die($obj,$channel) {
+function as_return_and_die($obj, $channel) {
- $x = array_merge(['@context' => [
- ACTIVITYSTREAMS_JSONLD_REV,
- 'https://w3id.org/security/v1',
- z_root() . ZOT_APSCHEMA_REV
- ]], $obj );
+ $ret = Activity::build_packet($obj, $channel);
+ logger('data: ' . jindent($ret), LOGGER_DATA);
- $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);
- logger('data: ' . jindent($ret), LOGGER_DATA);
$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));
+ $h = HTTPSig::create_sig($headers, $channel['channel_prvkey'], channel_url($channel));
HTTPSig::set_headers($h);
echo $ret;