diff options
author | zotlabs <mike@macgirvin.com> | 2017-04-30 18:24:48 -0700 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2017-05-01 15:14:10 +0200 |
commit | 71e508c7cda281115f9edf783639846cdb324508 (patch) | |
tree | 5f4aa0afcb3e50e21139b0e0d7f407905bdf68b1 | |
parent | d3fcef43f8b87ba1a78f2bcf7526a6a8c0e5c819 (diff) | |
download | volse-hubzilla-71e508c7cda281115f9edf783639846cdb324508.tar.gz volse-hubzilla-71e508c7cda281115f9edf783639846cdb324508.tar.bz2 volse-hubzilla-71e508c7cda281115f9edf783639846cdb324508.zip |
authenticate onepoll so we can receive private posts/comments in zotfeed; if local server bypass the network access and invoke zotfeed directly.
-rw-r--r-- | Zotlabs/Daemon/Onepoll.php | 24 | ||||
-rw-r--r-- | Zotlabs/Module/Zotfeed.php | 3 |
2 files changed, 22 insertions, 5 deletions
diff --git a/Zotlabs/Daemon/Onepoll.php b/Zotlabs/Daemon/Onepoll.php index 33b244dc5..476e861d1 100644 --- a/Zotlabs/Daemon/Onepoll.php +++ b/Zotlabs/Daemon/Onepoll.php @@ -118,13 +118,29 @@ class Onepoll { if($fetch_feed) { - $feedurl = str_replace('/poco/','/zotfeed/',$contact['xchan_connurl']); - $feedurl .= '?f=&mindate=' . urlencode($last_update); + if(strpos($contact['xchan_connurl'],z_root()) === 0) { + // local channel - save a network fetch + $c = channelx_by_hash($contact['xchan_hash']); + if($c) { + $x = [ + 'success' => true, + 'body' => json_encode( [ + 'success' => true, + 'messages' => zot_feed($c['channel_id'], $importer['xchan_hash'], [ 'mindate' => $last_update ]) + ]) + ]; + } + } + else { + // remote fetch - $x = z_fetch_url($feedurl); + $feedurl = str_replace('/poco/','/zotfeed/',$contact['xchan_connurl']); + $feedurl .= '?f=&mindate=' . urlencode($last_update) . '&zid=' . $importer['channel_address'] . '@' . z_root(); + $recurse = 0; + $x = z_fetch_url($feedurl, false, $recurse, [ 'session' => true ]); + } logger('feed_update: ' . print_r($x,true), LOGGER_DATA); - } if(($x) && ($x['success'])) { diff --git a/Zotlabs/Module/Zotfeed.php b/Zotlabs/Module/Zotfeed.php index 6b505c890..381e3acb2 100644 --- a/Zotlabs/Module/Zotfeed.php +++ b/Zotlabs/Module/Zotfeed.php @@ -22,7 +22,8 @@ class Zotfeed extends \Zotlabs\Web\Controller { $observer = \App::get_observer(); - + logger('observer: ' . get_observer_hash(), LOGGER_DEBUG); + $channel_address = ((argc() > 1) ? argv(1) : ''); if($channel_address) { $r = q("select channel_id, channel_name from channel where channel_address = '%s' and channel_removed = 0 limit 1", |