mirror of
https://github.com/nextcloud/spreed.git
synced 2025-12-17 21:12:20 +01:00
Merge pull request #16206 from nextcloud/dependabot/composer/cuyz/valinor-2.3.1
build(deps): Bump cuyz/valinor from 1.17.0 to 2.3.1
This commit is contained in:
commit
bb76f1f4c2
8 changed files with 221 additions and 95 deletions
|
|
@ -45,7 +45,7 @@
|
|||
},
|
||||
"require": {
|
||||
"bamarni/composer-bin-plugin": "^1.8",
|
||||
"cuyz/valinor": "^1.17",
|
||||
"cuyz/valinor": "^2.3",
|
||||
"cweagans/composer-patches": "^1.7.3",
|
||||
"firebase/php-jwt": "^6.11"
|
||||
},
|
||||
|
|
|
|||
70
composer.lock
generated
70
composer.lock
generated
|
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "ab880d38cab09d7cb58fca5214ba8091",
|
||||
"content-hash": "12ee0aab01bfdf0129c5b0b1f47e1cf5",
|
||||
"packages": [
|
||||
{
|
||||
"name": "bamarni/composer-bin-plugin",
|
||||
|
|
@ -65,22 +65,21 @@
|
|||
},
|
||||
{
|
||||
"name": "cuyz/valinor",
|
||||
"version": "1.17.0",
|
||||
"version": "2.3.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/CuyZ/Valinor.git",
|
||||
"reference": "9eb2802797e36f3af1fd6e13ff23e4e3d0058022"
|
||||
"reference": "212835b2efb89becd9881f4836e9b0b32ea105bf"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/CuyZ/Valinor/zipball/9eb2802797e36f3af1fd6e13ff23e4e3d0058022",
|
||||
"reference": "9eb2802797e36f3af1fd6e13ff23e4e3d0058022",
|
||||
"url": "https://api.github.com/repos/CuyZ/Valinor/zipball/212835b2efb89becd9881f4836e9b0b32ea105bf",
|
||||
"reference": "212835b2efb89becd9881f4836e9b0b32ea105bf",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"composer-runtime-api": "^2.0",
|
||||
"php": "~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0",
|
||||
"psr/simple-cache": "^1.0 || ^2.0 || ^3.0"
|
||||
"php": "~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0"
|
||||
},
|
||||
"conflict": {
|
||||
"phpstan/phpstan": "<1.0 || >= 3.0",
|
||||
|
|
@ -88,7 +87,7 @@
|
|||
},
|
||||
"require-dev": {
|
||||
"friendsofphp/php-cs-fixer": "^3.4",
|
||||
"infection/infection": "^0.29",
|
||||
"infection/infection": "^0.31",
|
||||
"marcocesarato/php-conventional-changelog": "^1.12",
|
||||
"mikey179/vfsstream": "^1.6.10",
|
||||
"phpbench/phpbench": "^1.3",
|
||||
|
|
@ -131,7 +130,7 @@
|
|||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/CuyZ/Valinor/issues",
|
||||
"source": "https://github.com/CuyZ/Valinor/tree/1.17.0"
|
||||
"source": "https://github.com/CuyZ/Valinor/tree/2.3.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
|
@ -139,7 +138,7 @@
|
|||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2025-06-20T06:40:38+00:00"
|
||||
"time": "2025-10-21T12:16:56+00:00"
|
||||
},
|
||||
{
|
||||
"name": "cweagans/composer-patches",
|
||||
|
|
@ -251,57 +250,6 @@
|
|||
"source": "https://github.com/firebase/php-jwt/tree/v6.11.1"
|
||||
},
|
||||
"time": "2025-04-09T20:32:01+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/simple-cache",
|
||||
"version": "3.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/php-fig/simple-cache.git",
|
||||
"reference": "764e0b3939f5ca87cb904f570ef9be2d78a07865"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-fig/simple-cache/zipball/764e0b3939f5ca87cb904f570ef9be2d78a07865",
|
||||
"reference": "764e0b3939f5ca87cb904f570ef9be2d78a07865",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=8.0.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.0.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Psr\\SimpleCache\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "PHP-FIG",
|
||||
"homepage": "https://www.php-fig.org/"
|
||||
}
|
||||
],
|
||||
"description": "Common interfaces for simple caching",
|
||||
"keywords": [
|
||||
"cache",
|
||||
"caching",
|
||||
"psr",
|
||||
"psr-16",
|
||||
"simple-cache"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/php-fig/simple-cache/tree/3.0.0"
|
||||
},
|
||||
"time": "2021-10-29T13:26:27+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [
|
||||
|
|
|
|||
|
|
@ -17,11 +17,18 @@ use OCA\Talk\Manager;
|
|||
use OCA\Talk\Middleware\Attribute\RequireLoggedInModeratorParticipant;
|
||||
use OCA\Talk\Middleware\Attribute\RequireModeratorParticipant;
|
||||
use OCA\Talk\Middleware\Attribute\RequireRoom;
|
||||
use OCA\Talk\Recording\RecordingFailedRequest;
|
||||
use OCA\Talk\Recording\RecordingRequest;
|
||||
use OCA\Talk\Recording\RecordingStartedRequest;
|
||||
use OCA\Talk\Recording\RecordingStoppedRequest;
|
||||
use OCA\Talk\Room;
|
||||
use OCA\Talk\Service\CertificateService;
|
||||
use OCA\Talk\Service\ParticipantService;
|
||||
use OCA\Talk\Service\RecordingService;
|
||||
use OCA\Talk\Service\RoomService;
|
||||
use OCA\Talk\Vendor\CuyZ\Valinor\Mapper\MappingError;
|
||||
use OCA\Talk\Vendor\CuyZ\Valinor\Mapper\Source\Source;
|
||||
use OCA\Talk\Vendor\CuyZ\Valinor\MapperBuilder;
|
||||
use OCP\AppFramework\Http;
|
||||
use OCP\AppFramework\Http\Attribute\BruteForceProtection;
|
||||
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
|
||||
|
|
@ -154,8 +161,6 @@ class RecordingController extends AEnvironmentAwareOCSController {
|
|||
/**
|
||||
* Return the body of the backend request. This can be overridden in
|
||||
* tests.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getInputStream(): string {
|
||||
return (string)file_get_contents('php://input');
|
||||
|
|
@ -191,36 +196,39 @@ class RecordingController extends AEnvironmentAwareOCSController {
|
|||
return $response;
|
||||
}
|
||||
|
||||
$message = json_decode($json, true);
|
||||
switch ($message['type'] ?? '') {
|
||||
case 'started':
|
||||
return $this->backendStarted($message['started']);
|
||||
case 'stopped':
|
||||
return $this->backendStopped($message['stopped']);
|
||||
case 'failed':
|
||||
return $this->backendFailed($message['failed']);
|
||||
default:
|
||||
return new DataResponse([
|
||||
'type' => 'error',
|
||||
'error' => [
|
||||
'code' => 'unknown_type',
|
||||
'message' => 'The given type ' . json_encode($message) . ' is not supported.',
|
||||
],
|
||||
], Http::STATUS_BAD_REQUEST);
|
||||
try {
|
||||
$request = (new MapperBuilder())
|
||||
->mapper()
|
||||
->map(RecordingRequest::class, Source::json($json));
|
||||
} catch (MappingError $e) {
|
||||
$this->logger->error($e->getMessage(), ['exception' => $e]);
|
||||
return new DataResponse([
|
||||
'type' => 'error',
|
||||
'error' => [
|
||||
'code' => 'unknown_type',
|
||||
'message' => 'The given request is not supported.',
|
||||
],
|
||||
], Http::STATUS_BAD_REQUEST);
|
||||
}
|
||||
|
||||
return match ($request->type) {
|
||||
RecordingRequest::TYPE_STARTED => $this->backendStarted($request->started),
|
||||
RecordingRequest::TYPE_STOPPED => $this->backendStopped($request->stopped),
|
||||
RecordingRequest::TYPE_FAILED => $this->backendFailed($request->failed),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @return DataResponse<Http::STATUS_OK, null, array{}>|DataResponse<Http::STATUS_NOT_FOUND, array{type: string, error: array{code: string, message: string}}, array{}>
|
||||
*/
|
||||
private function backendStarted(array $started): DataResponse {
|
||||
$token = $started['token'];
|
||||
$status = $started['status'];
|
||||
$actor = $started['actor'];
|
||||
private function backendStarted(RecordingStartedRequest $started): DataResponse {
|
||||
$token = $started->token;
|
||||
$status = $started->status;
|
||||
$actor = $started->actor;
|
||||
|
||||
try {
|
||||
$room = $this->manager->getRoomByToken($token);
|
||||
} catch (RoomNotFoundException $e) {
|
||||
} catch (RoomNotFoundException) {
|
||||
$this->logger->debug('Failed to get room {token}', [
|
||||
'token' => $token,
|
||||
'app' => 'spreed-recording',
|
||||
|
|
@ -252,7 +260,7 @@ class RecordingController extends AEnvironmentAwareOCSController {
|
|||
|
||||
try {
|
||||
$participant = $this->participantService->getParticipantByActor($room, $actor['type'], $actor['id']);
|
||||
} catch (ParticipantNotFoundException $e) {
|
||||
} catch (ParticipantNotFoundException) {
|
||||
$participant = null;
|
||||
}
|
||||
|
||||
|
|
@ -264,12 +272,9 @@ class RecordingController extends AEnvironmentAwareOCSController {
|
|||
/**
|
||||
* @return DataResponse<Http::STATUS_OK, null, array{}>|DataResponse<Http::STATUS_NOT_FOUND, array{type: string, error: array{code: string, message: string}}, array{}>
|
||||
*/
|
||||
private function backendStopped(array $stopped): DataResponse {
|
||||
$token = $stopped['token'];
|
||||
$actor = null;
|
||||
if (array_key_exists('actor', $stopped)) {
|
||||
$actor = $stopped['actor'];
|
||||
}
|
||||
private function backendStopped(RecordingStoppedRequest $stopped): DataResponse {
|
||||
$token = $stopped->token;
|
||||
$actor = $stopped->actor;
|
||||
|
||||
try {
|
||||
$room = $this->manager->getRoomByToken($token);
|
||||
|
|
@ -305,12 +310,12 @@ class RecordingController extends AEnvironmentAwareOCSController {
|
|||
/**
|
||||
* @return DataResponse<Http::STATUS_OK, null, array{}>|DataResponse<Http::STATUS_NOT_FOUND, array{type: string, error: array{code: string, message: string}}, array{}>
|
||||
*/
|
||||
private function backendFailed(array $failed): DataResponse {
|
||||
$token = $failed['token'];
|
||||
private function backendFailed(RecordingFailedRequest $failed): DataResponse {
|
||||
$token = $failed->token;
|
||||
|
||||
try {
|
||||
$room = $this->manager->getRoomByToken($token);
|
||||
} catch (RoomNotFoundException $e) {
|
||||
} catch (RoomNotFoundException) {
|
||||
$this->logger->debug('Failed to get room {token}', [
|
||||
'token' => $token,
|
||||
'app' => 'spreed-recording',
|
||||
|
|
|
|||
17
lib/Recording/RecordingFailedRequest.php
Normal file
17
lib/Recording/RecordingFailedRequest.php
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace OCA\Talk\Recording;
|
||||
|
||||
final readonly class RecordingFailedRequest {
|
||||
public function __construct(
|
||||
/** @var non-empty-string */
|
||||
public string $token,
|
||||
) {
|
||||
}
|
||||
}
|
||||
24
lib/Recording/RecordingRequest.php
Normal file
24
lib/Recording/RecordingRequest.php
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace OCA\Talk\Recording;
|
||||
|
||||
final readonly class RecordingRequest {
|
||||
public const TYPE_STARTED = 'started';
|
||||
public const TYPE_STOPPED = 'stopped';
|
||||
public const TYPE_FAILED = 'failed';
|
||||
|
||||
public function __construct(
|
||||
/** @var self::TYPE_* */
|
||||
public string $type,
|
||||
public ?RecordingStartedRequest $started = null,
|
||||
public ?RecordingStoppedRequest $stopped = null,
|
||||
public ?RecordingFailedRequest $failed = null,
|
||||
) {
|
||||
}
|
||||
}
|
||||
23
lib/Recording/RecordingStartedRequest.php
Normal file
23
lib/Recording/RecordingStartedRequest.php
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace OCA\Talk\Recording;
|
||||
|
||||
use OCA\Talk\Room;
|
||||
|
||||
final readonly class RecordingStartedRequest {
|
||||
public function __construct(
|
||||
/** @var non-empty-string */
|
||||
public string $token,
|
||||
/** @var Room::RECORDING_* */
|
||||
public int $status,
|
||||
/** @var array{type: string, id: string} */
|
||||
public array $actor,
|
||||
) {
|
||||
}
|
||||
}
|
||||
19
lib/Recording/RecordingStoppedRequest.php
Normal file
19
lib/Recording/RecordingStoppedRequest.php
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace OCA\Talk\Recording;
|
||||
|
||||
final readonly class RecordingStoppedRequest {
|
||||
public function __construct(
|
||||
/** @var non-empty-string */
|
||||
public string $token,
|
||||
/** @var ?array{type: string, id: string} */
|
||||
public ?array $actor = null,
|
||||
) {
|
||||
}
|
||||
}
|
||||
90
tests/php/Recording/RecordingRequestTest.php
Normal file
90
tests/php/Recording/RecordingRequestTest.php
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace OCA\Talk\Tests\php\Recording;
|
||||
|
||||
use OCA\Talk\Recording\RecordingRequest;
|
||||
use OCA\Talk\Room;
|
||||
use OCA\Talk\Vendor\CuyZ\Valinor\Mapper\Source\Source;
|
||||
use OCA\Talk\Vendor\CuyZ\Valinor\MapperBuilder;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use Test\TestCase;
|
||||
|
||||
class RecordingRequestTest extends TestCase {
|
||||
public static function dataRequests(): array {
|
||||
return [
|
||||
[
|
||||
[
|
||||
'type' => 'started',
|
||||
'started' => [
|
||||
'token' => '0123456789',
|
||||
'actor' => [
|
||||
'type' => 'users',
|
||||
'id' => 'user1',
|
||||
],
|
||||
'status' => Room::RECORDING_VIDEO,
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
'type' => 'started',
|
||||
'started' => [
|
||||
'token' => '0123456789',
|
||||
'actor' => [
|
||||
'type' => 'users',
|
||||
'id' => 'user1',
|
||||
],
|
||||
'status' => Room::RECORDING_AUDIO,
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
[
|
||||
[
|
||||
'type' => 'stopped',
|
||||
'stopped' => [
|
||||
'token' => '0123456789',
|
||||
'actor' => [
|
||||
'type' => 'users',
|
||||
'id' => 'user1',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
[
|
||||
'type' => 'stopped',
|
||||
'stopped' => [
|
||||
'token' => '0123456789',
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
[
|
||||
[
|
||||
'type' => 'failed',
|
||||
'failed' => [
|
||||
'token' => '0123456789',
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
#[DataProvider('dataRequests')]
|
||||
public function testRequests(array $requestArray): void {
|
||||
$json = json_encode($requestArray, JSON_THROW_ON_ERROR);
|
||||
|
||||
$request = (new MapperBuilder())
|
||||
->mapper()
|
||||
->map(RecordingRequest::class, Source::json($json));
|
||||
|
||||
$this->assertInstanceOf(RecordingRequest::class, $request);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue