diff --git a/CHANGELOG.md b/CHANGELOG.md index 56859925..68de0f72 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,11 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). -## [2.7.1 - 2024-07-xx] +## [2.8.0 - 2024-07-1x] ### Added - New OCS API endpoint to setAppInitProgress. The old one is marked as deprecated. #319 +- Added default timeout for requestToExApp function set to 3s. #277 ### Fixed diff --git a/appinfo/info.xml b/appinfo/info.xml index 998a2522..063c6ced 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -43,7 +43,7 @@ to join us in shaping a more versatile, stable, and secure app landscape. *Your insights, suggestions, and contributions are invaluable to us.* ]]> - 2.7.1 + 2.8.0 agpl Andrey Borysenko Alexander Piskun diff --git a/lib/Service/AppAPIService.php b/lib/Service/AppAPIService.php index 06a91409..8b54ab70 100644 --- a/lib/Service/AppAPIService.php +++ b/lib/Service/AppAPIService.php @@ -235,6 +235,9 @@ private function prepareRequestToExApp( if (!empty($auth)) { $options['auth'] = $auth; } + if (!isset($options['timeout'])) { + $options['timeout'] = 3; + } if ((!array_key_exists('multipart', $options)) && (count($params)) > 0) { if ($method === 'GET') { @@ -281,6 +284,9 @@ private function prepareRequestToExApp2( if (!empty($auth)) { $options['auth'] = $auth; } + if (!isset($options['timeout'])) { + $options['timeout'] = 3; + } if ((!array_key_exists('multipart', $options))) { if (count($queryParams) > 0) { @@ -658,7 +664,7 @@ public function getExAppDomain(ExApp $exApp): string { */ public function enableExApp(ExApp $exApp): bool { if ($this->exAppService->enableExAppInternal($exApp)) { - $exAppEnabled = $this->requestToExApp($exApp, '/enabled?enabled=1', null, 'PUT'); + $exAppEnabled = $this->requestToExApp($exApp, '/enabled?enabled=1', null, 'PUT', options: ['timeout' => 30]); if ($exAppEnabled instanceof IResponse) { $response = json_decode($exAppEnabled->getBody(), true); if (empty($response['error'])) { @@ -683,7 +689,7 @@ public function enableExApp(ExApp $exApp): bool { */ public function disableExApp(ExApp $exApp): bool { $result = true; - $exAppDisabled = $this->requestToExApp($exApp, '/enabled?enabled=0', null, 'PUT'); + $exAppDisabled = $this->requestToExApp($exApp, '/enabled?enabled=0', null, 'PUT', options: ['timeout' => 30]); if ($exAppDisabled instanceof IResponse) { $response = json_decode($exAppDisabled->getBody(), true); if (isset($response['error']) && strlen($response['error']) !== 0) {