diff options
author | zotlabs <mike@macgirvin.com> | 2017-04-30 18:24:48 -0700 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2017-04-30 18:24:48 -0700 |
commit | 968209471ef807ed8d89ecc8cc2f0e3425509a19 (patch) | |
tree | cc401cfaaca7931717bff49032b59d11c07e0f3d /Zotlabs/Daemon/Onepoll.php | |
parent | d71a53f24ee464fba5d4373397a3a797e8f0c6a3 (diff) | |
download | volse-hubzilla-968209471ef807ed8d89ecc8cc2f0e3425509a19.tar.gz volse-hubzilla-968209471ef807ed8d89ecc8cc2f0e3425509a19.tar.bz2 volse-hubzilla-968209471ef807ed8d89ecc8cc2f0e3425509a19.zip |
authenticate onepoll so we can receive private posts/comments in zotfeed; if local server bypass the network access and invoke zotfeed directly.
Diffstat (limited to 'Zotlabs/Daemon/Onepoll.php')
-rw-r--r-- | Zotlabs/Daemon/Onepoll.php | 24 |
1 files changed, 20 insertions, 4 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'])) { |