aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs/Module')
-rw-r--r--Zotlabs/Module/Login.php2
-rw-r--r--Zotlabs/Module/Sse.php83
-rw-r--r--Zotlabs/Module/Wall_attach.php6
3 files changed, 69 insertions, 22 deletions
diff --git a/Zotlabs/Module/Login.php b/Zotlabs/Module/Login.php
index 6430939b4..721ac15ac 100644
--- a/Zotlabs/Module/Login.php
+++ b/Zotlabs/Module/Login.php
@@ -12,5 +12,5 @@ class Login extends \Zotlabs\Web\Controller {
return login(true);
}
-
+
}
diff --git a/Zotlabs/Module/Sse.php b/Zotlabs/Module/Sse.php
index df4a74f7b..daf344f2d 100644
--- a/Zotlabs/Module/Sse.php
+++ b/Zotlabs/Module/Sse.php
@@ -23,14 +23,7 @@ class Sse extends Controller {
killme();
}
- if(! intval(Config::Get('system','open_pubstream',1))) {
- if(! get_observer_hash()) {
- killme();
- }
- }
-
// this is important!
- session_write_close();
ignore_user_abort(true);
self::$uid = local_channel();
@@ -102,7 +95,6 @@ class Sse extends Controller {
}
}
-
$result = [];
XConfig::Load(self::$ob_hash);
@@ -110,9 +102,19 @@ class Sse extends Controller {
$lock = XConfig::Get(self::$ob_hash, 'sse', 'lock');
if (!$lock) {
- $result = XConfig::Get(self::$ob_hash, 'sse', 'notifications', []);
+ $result_db = XConfig::Get(self::$ob_hash, 'sse', 'notifications', []);
+ }
+
+ if (!empty($_SESSION['sysmsg'])) {
+ $result['notice']['notifications'] = $_SESSION['sysmsg'];
+ }
+
+ if (!empty($_SESSION['sysmsg_info'])) {
+ $result['info']['notifications'] = $_SESSION['sysmsg_info'];
}
+ $result = array_merge($result, $result_db);
+
// 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'))) {
@@ -133,22 +135,45 @@ class Sse extends Controller {
echo "\n\n";
}
- if (ob_get_length() > 0) {
- ob_end_flush();
- }
+ if (connection_status() != CONNECTION_NORMAL || connection_aborted()) {
- flush();
+ // IMPORTANT: in case the channel was changed we need to reset the
+ // session here to it's current stored state.
+ // Otherwise the uid might switch back to the previous value
+ // in the background.
+
+ session_reset();
- if (connection_status() != CONNECTION_NORMAL || connection_aborted()) {
XConfig::Set(self::$ob_hash, 'sse', 'timestamp', NULL_DATE);
XConfig::Set(self::$ob_hash, 'sse', 'notifications', []);
+
+ $_SESSION['sysmsg'] = [];
+ $_SESSION['sysmsg_info'] = [];
+
+ if (ob_get_length() > 0) {
+ ob_end_flush();
+ }
+
+ flush();
+
exit;
}
+ if (ob_get_length() > 0) {
+ ob_flush();
+ }
+
+ flush();
+
usleep($sleep);
if ($result) {
- XConfig::Set(self::$ob_hash, 'sse', 'notifications', []);
+ if ($result_db) {
+ XConfig::Set(self::$ob_hash, 'sse', 'notifications', []);
+ }
+
+ $_SESSION['sysmsg'] = [];
+ $_SESSION['sysmsg_info'] = [];
}
$i++;
@@ -186,13 +211,35 @@ class Sse extends Controller {
}
}
+ $result = [];
+ $result_db = [];
+
XConfig::Load(self::$ob_hash);
- $result = XConfig::Get(self::$ob_hash, 'sse', 'notifications', []);
$lock = XConfig::Get(self::$ob_hash, 'sse', 'lock');
- if($result && !$lock) {
- XConfig::Set(self::$ob_hash, 'sse', 'notifications', []);
+ if (!$lock) {
+ $result_db = XConfig::Get(self::$ob_hash, 'sse', 'notifications', []);
+ }
+
+ if (!empty($_SESSION['sysmsg'])) {
+ $result['notice']['notifications'] = $_SESSION['sysmsg'];
+ }
+
+ if (!empty($_SESSION['sysmsg_info'])) {
+ $result['info']['notifications'] = $_SESSION['sysmsg_info'];
+ }
+
+ $result = array_merge($result, $result_db);
+
+ if($result) {
+ if ($result_db) {
+ XConfig::Set(self::$ob_hash, 'sse', 'notifications', []);
+ }
+
+ $_SESSION['sysmsg'] = [];
+ $_SESSION['sysmsg_info'] = [];
+
json_return_and_die($result);
}
diff --git a/Zotlabs/Module/Wall_attach.php b/Zotlabs/Module/Wall_attach.php
index 3c57d4b94..e354f58f1 100644
--- a/Zotlabs/Module/Wall_attach.php
+++ b/Zotlabs/Module/Wall_attach.php
@@ -111,7 +111,7 @@ class Wall_attach extends \Zotlabs\Web\Controller {
// give a wee bit of time for the background thumbnail processor to do its thing
// or else we'll never see a video poster
sleep(3);
- $url = z_root() . '/cloud/' . $channel['channel_address'] . '/' . $r['data']['display_path'];
+ $url = z_root() . '/attach/' . $r['data']['hash'];
$thumb = Linkinfo::get_video_poster($url);
if($thumb) {
$s = '[zvideo poster=\'' . $thumb . '\']' . $url . '[/zvideo]';
@@ -120,8 +120,8 @@ class Wall_attach extends \Zotlabs\Web\Controller {
$s = '[zvideo]' . $url . '[/zvideo]';
}
}
- if(strpos($r['data']['filetype'],'audio') === 0) {
- $url = z_root() . '/cloud/' . $channel['channel_address'] . '/' . $r['data']['display_path'];
+ if(strpos($r['data']['filetype'], 'audio') === 0) {
+ $url = z_root() . '/attach/' . $r['data']['hash'];
$s = '[zaudio]' . $url . '[/zaudio]';
}
if ($r['data']['filetype'] === 'image/svg+xml') {