Skip to content

Commit

Permalink
Idea to prevent exit inside Nextcloud
Browse files Browse the repository at this point in the history
  • Loading branch information
the-djmaze committed Nov 20, 2023
1 parent 8247357 commit 9ded40b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function index()
SnappyMailHelper::loadApp();
$bAdmin = \RainLoop\Api::Config()->Get('security', 'admin_panel_key', 'admin') == $_SERVER['QUERY_STRING'];
if (!$bAdmin) {
SnappyMailHelper::startApp(true);
return SnappyMailHelper::startApp(true);
}
}

Expand Down Expand Up @@ -109,7 +109,7 @@ public function index()
*/
public function appGet()
{
SnappyMailHelper::startApp(true);
return SnappyMailHelper::startApp(true);
}

/**
Expand All @@ -118,7 +118,7 @@ public function appGet()
*/
public function appPost()
{
SnappyMailHelper::startApp(true);
return SnappyMailHelper::startApp(true);
}

/**
Expand All @@ -127,6 +127,6 @@ public function appPost()
*/
public function indexPost()
{
SnappyMailHelper::startApp(true);
return SnappyMailHelper::startApp(true);
}
}
16 changes: 15 additions & 1 deletion integrations/nextcloud/snappymail/lib/Util/SnappyMailHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@

namespace OCA\SnappyMail\Util;

class SnappyMailResponse extends \OCP\AppFramework\Http\Response
{
public function render(): string
{
$data = '';
$i = \ob_get_level();
while ($i--) {
$data .= \ob_get_clean();
}
return $data;
}
}

class SnappyMailHelper
{

Expand Down Expand Up @@ -31,7 +44,7 @@ public static function loadApp() : void
require_once $app_dir . '/index.php';
}

public static function startApp(bool $handle = false) : void
public static function startApp(bool $handle = false)
{
static::loadApp();

Expand Down Expand Up @@ -105,6 +118,7 @@ public static function startApp(bool $handle = false) : void
\RainLoop\Service::Handle();
// https://github.com/the-djmaze/snappymail/issues/1069
exit;
// return new SnappyMailResponse();
}
} catch (\Throwable $e) {
// Ignore login failure
Expand Down

0 comments on commit 9ded40b

Please sign in to comment.