Use Request object
Some checks are pending
ci/woodpecker/pr/build Pipeline is pending approval
ci/woodpecker/pr/security Pipeline is pending approval

This commit is contained in:
llaumgui 2025-04-30 09:30:35 +02:00
commit d485b728e7

View file

@ -49,6 +49,11 @@ class Application extends App implements IBootstrap
*/ */
protected $user; protected $user;
/**
* @var Request
*/
protected $request;
public function __construct(array $urlParams = []) public function __construct(array $urlParams = [])
{ {
parent::__construct(self::APP_ID, $urlParams); parent::__construct(self::APP_ID, $urlParams);
@ -96,6 +101,7 @@ class Application extends App implements IBootstrap
$this->config = \OC::$server->getConfig(); $this->config = \OC::$server->getConfig();
$this->cspnm = \OC::$server->getContentSecurityPolicyNonceManager(); $this->cspnm = \OC::$server->getContentSecurityPolicyNonceManager();
$this->user = \OC::$server[IUserSession::class]->getUser(); $this->user = \OC::$server[IUserSession::class]->getUser();
$this->request = \OC::$server->getRequest();
if (!$this->isEnabled()) { if (!$this->isEnabled()) {
return; return;
@ -106,7 +112,7 @@ class Application extends App implements IBootstrap
protected function isEnabled(): bool protected function isEnabled(): bool
{ {
if (isset($_SERVER["HTTP_USER_AGENT"]) && preg_match('/MemoriesNative/', $_SERVER['HTTP_USER_AGENT'])) { if (isset($this->request->server['HTTP_USER_AGENT']) && preg_match('/MemoriesNative/', $this->request->server['HTTP_USER_AGENT'])) {
return false; return false;
} }