Idea to prevent exit inside Nextcloud

This commit is contained in:
the-djmaze 2023-11-21 00:13:22 +01:00
parent 8247357184
commit 9ded40ba9c
2 changed files with 19 additions and 5 deletions

View file

@ -38,7 +38,7 @@ class PageController extends Controller
SnappyMailHelper::loadApp(); SnappyMailHelper::loadApp();
$bAdmin = \RainLoop\Api::Config()->Get('security', 'admin_panel_key', 'admin') == $_SERVER['QUERY_STRING']; $bAdmin = \RainLoop\Api::Config()->Get('security', 'admin_panel_key', 'admin') == $_SERVER['QUERY_STRING'];
if (!$bAdmin) { if (!$bAdmin) {
SnappyMailHelper::startApp(true); return SnappyMailHelper::startApp(true);
} }
} }
@ -109,7 +109,7 @@ class PageController extends Controller
*/ */
public function appGet() public function appGet()
{ {
SnappyMailHelper::startApp(true); return SnappyMailHelper::startApp(true);
} }
/** /**
@ -118,7 +118,7 @@ class PageController extends Controller
*/ */
public function appPost() public function appPost()
{ {
SnappyMailHelper::startApp(true); return SnappyMailHelper::startApp(true);
} }
/** /**
@ -127,6 +127,6 @@ class PageController extends Controller
*/ */
public function indexPost() public function indexPost()
{ {
SnappyMailHelper::startApp(true); return SnappyMailHelper::startApp(true);
} }
} }

View file

@ -2,6 +2,19 @@
namespace OCA\SnappyMail\Util; 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 class SnappyMailHelper
{ {
@ -31,7 +44,7 @@ class SnappyMailHelper
require_once $app_dir . '/index.php'; require_once $app_dir . '/index.php';
} }
public static function startApp(bool $handle = false) : void public static function startApp(bool $handle = false)
{ {
static::loadApp(); static::loadApp();
@ -105,6 +118,7 @@ class SnappyMailHelper
\RainLoop\Service::Handle(); \RainLoop\Service::Handle();
// https://github.com/the-djmaze/snappymail/issues/1069 // https://github.com/the-djmaze/snappymail/issues/1069
exit; exit;
// return new SnappyMailResponse();
} }
} catch (\Throwable $e) { } catch (\Throwable $e) {
// Ignore login failure // Ignore login failure