aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Lib/Activity.php42
-rw-r--r--Zotlabs/Module/Admin/Queue.php14
2 files changed, 46 insertions, 10 deletions
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php
index 74a146345..881bd04e2 100644
--- a/Zotlabs/Lib/Activity.php
+++ b/Zotlabs/Lib/Activity.php
@@ -660,11 +660,11 @@ class Activity {
return $ret;
}
- static function encode_attachment($item) {
+ static function encode_attachment($item, $iconfig = false) {
$ret = [];
- if (array_key_exists('attach', $item)) {
+ if (!$iconfig && array_key_exists('attach', $item)) {
$atts = ((is_array($item['attach'])) ? $item['attach'] : json_decode($item['attach'], true));
if ($atts) {
foreach ($atts as $att) {
@@ -677,7 +677,7 @@ class Activity {
}
}
}
- if (array_key_exists('iconfig', $item) && is_array($item['iconfig'])) {
+ if ($iconfig && array_key_exists('iconfig', $item) && is_array($item['iconfig'])) {
foreach ($item['iconfig'] as $att) {
if ($att['sharing']) {
$value = ((is_string($att['v']) && preg_match('|^a:[0-9]+:{.*}$|s', $att['v'])) ? unserialize($att['v']) : $att['v']);
@@ -930,6 +930,11 @@ class Activity {
$ret['tag'] = $t;
}
+ $a = self::encode_attachment($i, true);
+ if ($a) {
+ $ret['attachment'] = $a;
+ }
+
// addressing madness
$public = (($i['item_private']) ? false : true);
@@ -2638,28 +2643,47 @@ class Activity {
}
}
- $zot_rawmsg = '';
+ $ap_rawmsg = '';
$raw_arr = [];
$raw_arr = json_decode($act->raw, true);
// This is a zot6 packet and the raw activitypub message json
// is possibly available in the attachement.
- if (array_key_exists('signed', $raw_arr) && is_array($act->obj) && is_array($act->obj['attachment'])) {
- foreach($act->obj['attachment'] as $a) {
+ if (array_key_exists('signed', $raw_arr) && is_array($act->data['attachment'])) {
+ foreach($act->data['attachment'] as $a) {
if (
isset($a['type']) && $a['type'] === 'PropertyValue' &&
isset($a['name']) && $a['name'] === 'zot.activitypub.rawmsg' &&
isset($a['value'])
) {
- $zot_rawmsg = $a['value'];
+ $ap_rawmsg = $a['value'];
break;
}
}
}
- if ($zot_rawmsg) {
- set_iconfig($s, 'activitypub', 'rawmsg', $zot_rawmsg, 1);
+ // old style: can be removed after most hubs are on 7.0.2
+ if (!$ap_rawmsg && array_key_exists('signed', $raw_arr) && is_array($act->obj) && is_array($act->obj['attachment'])) {
+ foreach($act->obj['attachment'] as $a) {
+ if (
+ isset($a['type']) && $a['type'] === 'propertyvalue' &&
+ isset($a['name']) && $a['name'] === 'zot.activitypub.rawmsg' &&
+ isset($a['value'])
+ ) {
+ $ap_rawmsg = $a['value'];
+ break;
+ }
+ }
+ }
+
+ if (!$ap_rawmsg && $response_activity) {
+ $ap_rawmsg = json_encode($act->data, JSON_UNESCAPED_SLASHES);
+ }
+ // end old style
+
+ if ($ap_rawmsg) {
+ set_iconfig($s, 'activitypub', 'rawmsg', $ap_rawmsg, 1);
}
else {
set_iconfig($s, 'activitypub', 'rawmsg', $act->raw, 1);
diff --git a/Zotlabs/Module/Admin/Queue.php b/Zotlabs/Module/Admin/Queue.php
index baa50591f..8a843083b 100644
--- a/Zotlabs/Module/Admin/Queue.php
+++ b/Zotlabs/Module/Admin/Queue.php
@@ -23,7 +23,18 @@ class Queue {
LibQueue::remove_by_posturl($_REQUEST['emptyhub']);
}
- $r = q("select count(outq_posturl) as total, max(outq_priority) as priority, outq_posturl from outq
+ if($_REQUEST['deliverhub']) {
+
+ $hubq = q("SELECT * FROM outq WHERE outq_posturl = '%s'",
+ dbesc($_REQUEST['deliverhub'])
+ );
+
+ foreach ($hubq as $q) {
+ LibQueue::deliver($q, true);
+ }
+ }
+
+ $r = dbq("select count(outq_posturl) as total, max(outq_priority) as priority, outq_posturl from outq
where outq_delivered = 0 group by outq_posturl order by total desc");
for($x = 0; $x < count($r); $x ++) {
@@ -37,6 +48,7 @@ class Queue {
'$priority' => t('Priority'),
'$desturl' => t('Destination URL'),
'$nukehub' => t('Mark hub permanently offline'),
+ '$deliverhub' => t('Retry delivery to this hub'),
'$empty' => t('Empty queue for this hub'),
'$lastconn' => t('Last known contact'),
'$hasentries' => ((count($r)) ? true : false),