From 2de1285121b5f0260699a93249bab11dc74edec5 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 16 Jan 2018 18:15:58 -0800 Subject: z6 deliver --- include/queue_fn.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'include/queue_fn.php') diff --git a/include/queue_fn.php b/include/queue_fn.php index 5fb0d5f1e..88da90479 100644 --- a/include/queue_fn.php +++ b/include/queue_fn.php @@ -216,7 +216,24 @@ function queue_deliver($outq, $immediate = false) { // normal zot delivery logger('deliver: dest: ' . $outq['outq_posturl'], LOGGER_DEBUG); - $result = zot_zot($outq['outq_posturl'],$outq['outq_notify']); + + + + $msg = $outq['outq_notify']; + $channel = null; + + if($outq['outq_msg']) { + $tmp = json_decode($msg,true); + $tmp['pickup'] = json_decode($outq['outq_msg'],true); + $msg = json_encode($tmp); + if($outq['outq_channel']) { + $channel = channelx_by_n($outq['outq_channel']); + } + } + + $result = zot_zot($outq['outq_posturl'],$msg,$channel); + + if($result['success']) { logger('deliver: remote zot delivery succeeded to ' . $outq['outq_posturl']); zot_process_response($outq['outq_posturl'],$result, $outq); -- cgit v1.2.3 From 05de59d4ad174cb106c3a5b5890732af51730384 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 16 Jan 2018 20:08:10 -0800 Subject: initial z6 delivery --- include/queue_fn.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'include/queue_fn.php') diff --git a/include/queue_fn.php b/include/queue_fn.php index 88da90479..d1c50de67 100644 --- a/include/queue_fn.php +++ b/include/queue_fn.php @@ -217,19 +217,19 @@ function queue_deliver($outq, $immediate = false) { logger('deliver: dest: ' . $outq['outq_posturl'], LOGGER_DEBUG); - - - $msg = $outq['outq_notify']; $channel = null; if($outq['outq_msg']) { - $tmp = json_decode($msg,true); - $tmp['pickup'] = json_decode($outq['outq_msg'],true); - $msg = json_encode($tmp); + $msg = json_decode($outq['outq_notify'],true); + $msg['pickup'] = [ 'notify' => json_decode($outq['outq_notify'],true), 'message' => json_decode($outq['outq_msg'],true) ]; + $msg = json_encode($msg); if($outq['outq_channel']) { $channel = channelx_by_n($outq['outq_channel']); } } + else { + $msg = $outq['outq_notify']; + } $result = zot_zot($outq['outq_posturl'],$msg,$channel); -- cgit v1.2.3 From 3a0db39fa05668831e7661ac6edaabfd09d864e2 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 7 Feb 2018 18:38:10 -0800 Subject: more zot6 delivery work --- include/queue_fn.php | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'include/queue_fn.php') diff --git a/include/queue_fn.php b/include/queue_fn.php index d1c50de67..d31e41b61 100644 --- a/include/queue_fn.php +++ b/include/queue_fn.php @@ -219,18 +219,12 @@ function queue_deliver($outq, $immediate = false) { $channel = null; - if($outq['outq_msg']) { - $msg = json_decode($outq['outq_notify'],true); - $msg['pickup'] = [ 'notify' => json_decode($outq['outq_notify'],true), 'message' => json_decode($outq['outq_msg'],true) ]; - $msg = json_encode($msg); - if($outq['outq_channel']) { - $channel = channelx_by_n($outq['outq_channel']); - } - } - else { - $msg = $outq['outq_notify']; + if($outq['outq_msg'] && $outq['outq_channel']) { + $channel = channelx_by_n($outq['outq_channel']); } + $msg = $outq['outq_notify']; + $result = zot_zot($outq['outq_posturl'],$msg,$channel); -- cgit v1.2.3 From 6cf2e9945a08451e3d53b6e79002843e9cdb8dc6 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 7 Feb 2018 21:53:47 -0800 Subject: encrypt the httpsig for zot6 transport --- include/queue_fn.php | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'include/queue_fn.php') diff --git a/include/queue_fn.php b/include/queue_fn.php index d31e41b61..e50d58dd7 100644 --- a/include/queue_fn.php +++ b/include/queue_fn.php @@ -121,7 +121,7 @@ function queue_deliver($outq, $immediate = false) { $base = null; $h = parse_url($outq['outq_posturl']); - if($h) + if($h !== false) $base = $h['scheme'] . '://' . $h['host'] . (($h['port']) ? ':' . $h['port'] : ''); if(($base) && ($base !== z_root()) && ($immediate)) { @@ -160,6 +160,9 @@ function queue_deliver($outq, $immediate = false) { + + + $arr = array('outq' => $outq, 'base' => $base, 'handled' => false, 'immediate' => $immediate); call_hooks('queue_deliver',$arr); if($arr['handled']) @@ -223,9 +226,24 @@ function queue_deliver($outq, $immediate = false) { $channel = channelx_by_n($outq['outq_channel']); } + $host_crypto = null; + + if($channel && $base) { + $h = q("select hubloc_sitekey, site_crypto from hubloc left join site on hubloc_url = site_url where site_url = '%s' order by hubloc_id desc limit 1", + dbesc($base) + ); + if($h) { + $host_crypto = $h[0]; + } + } + + + + + $msg = $outq['outq_notify']; - $result = zot_zot($outq['outq_posturl'],$msg,$channel); + $result = zot_zot($outq['outq_posturl'],$msg,$channel,$host_crypto); if($result['success']) { -- cgit v1.2.3 From 635c5e532bd945fe50dc3fae73e4da005158e3de Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 8 Feb 2018 15:32:54 -0800 Subject: z6 testing --- include/queue_fn.php | 4 ---- 1 file changed, 4 deletions(-) (limited to 'include/queue_fn.php') diff --git a/include/queue_fn.php b/include/queue_fn.php index e50d58dd7..798ac36db 100644 --- a/include/queue_fn.php +++ b/include/queue_fn.php @@ -237,10 +237,6 @@ function queue_deliver($outq, $immediate = false) { } } - - - - $msg = $outq['outq_notify']; $result = zot_zot($outq['outq_posturl'],$msg,$channel,$host_crypto); -- cgit v1.2.3