aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module/Sse.php
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs/Module/Sse.php')
-rw-r--r--Zotlabs/Module/Sse.php17
1 files changed, 14 insertions, 3 deletions
diff --git a/Zotlabs/Module/Sse.php b/Zotlabs/Module/Sse.php
index 46b4a8d87..3dab3d465 100644
--- a/Zotlabs/Module/Sse.php
+++ b/Zotlabs/Module/Sse.php
@@ -34,6 +34,7 @@ class Sse extends Controller {
self::$uid = local_channel();
self::$ob_hash = get_observer_hash();
self::$sse_id = false;
+ self::$vnotify = -1;
if(! self::$ob_hash) {
if(session_id()) {
@@ -45,9 +46,10 @@ class Sse extends Controller {
}
}
- self::$vnotify = get_pconfig(self::$uid, 'system', 'vnotify');
+ if (self::$uid) {
+ self::$vnotify = get_pconfig(self::$uid, 'system', 'vnotify');
+ }
- $sys = get_sys_channel();
$sleep_seconds = 3;
self::$sse_enabled = get_config('system', 'sse_enabled', 0);
@@ -95,6 +97,14 @@ class Sse extends Controller {
$result = XConfig::Get(self::$ob_hash, 'sse', 'notifications', []);
$lock = XConfig::Get(self::$ob_hash, 'sse', 'lock');
+ // We do not have the local_channel in the addon.
+ // Reset pubs here if the app is not installed.
+ if (self::$uid && (!(self::$vnotify & VNOTIFY_PUBS) || !Apps::system_app_installed(self::$uid, 'Public Stream'))) {
+ $result['pubs']['count'] = 0;
+ $result['pubs']['notifications'] = [];
+ $result['pubs']['offset'] = -1;
+ }
+
if($result && !$lock) {
echo "event: notifications\n";
echo 'data: ' . json_encode($result);
@@ -109,7 +119,8 @@ class Sse extends Controller {
echo 'data: {}';
echo "\n\n";
- ob_end_flush();
+ if(ob_get_length() > 0)
+ ob_end_flush();
flush();
if(connection_status() != CONNECTION_NORMAL || connection_aborted()) {