Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJoas Schilling <213943+nickvergessen@users.noreply.github.com>2021-11-04 17:24:52 +0300
committerGitHub <noreply@github.com>2021-11-04 17:24:52 +0300
commit951db802e2b01c152b389c2d5cbf6b920ecb503d (patch)
treeeb7c13842eede674d508d55a97903a38be712d84 /lib
parenta2fc75e507521f657bd522b0fec5efb6f80a4cd6 (diff)
parent1ed22880a14ede677282e32209a736f3bb135a57 (diff)
Merge pull request #6442 from nextcloud/bugfix/noid/admin-warning-when-incompatible-HPB
Show an error/warning when the HPB is incompatible
Diffstat (limited to 'lib')
-rw-r--r--lib/Controller/SignalingController.php4
-rw-r--r--lib/Signaling/BackendNotifier.php6
-rw-r--r--lib/Signaling/Manager.php9
3 files changed, 18 insertions, 1 deletions
diff --git a/lib/Controller/SignalingController.php b/lib/Controller/SignalingController.php
index 9ea43f400..6627c0ebd 100644
--- a/lib/Controller/SignalingController.php
+++ b/lib/Controller/SignalingController.php
@@ -216,6 +216,10 @@ class SignalingController extends OCSController {
],
]);
+ if (!$this->signalingManager->isCompatibleSignalingServer($response)) {
+ return new DataResponse(['error' => 'UPDATE_REQUIRED'], Http::STATUS_INTERNAL_SERVER_ERROR);
+ }
+
$body = $response->getBody();
$data = json_decode($body, true);
diff --git a/lib/Signaling/BackendNotifier.php b/lib/Signaling/BackendNotifier.php
index 310be8ec3..4fdada9c0 100644
--- a/lib/Signaling/BackendNotifier.php
+++ b/lib/Signaling/BackendNotifier.php
@@ -84,7 +84,11 @@ class BackendNotifier {
$client = $this->clientService->newClient();
try {
- $client->post($url, $params);
+ $response = $client->post($url, $params);
+
+ if (!$this->signalingManager->isCompatibleSignalingServer($response)) {
+ throw new \RuntimeException('Signaling server needs to be updated to be compatible with this version of Talk');
+ }
} catch (\Exception $e) {
$this->logger->error('Failed to send message to signaling server', ['exception' => $e]);
}
diff --git a/lib/Signaling/Manager.php b/lib/Signaling/Manager.php
index 36486c78d..d39a4b397 100644
--- a/lib/Signaling/Manager.php
+++ b/lib/Signaling/Manager.php
@@ -25,11 +25,13 @@ namespace OCA\Talk\Signaling;
use OCA\Talk\Config;
use OCA\Talk\Room;
+use OCP\Http\Client\IResponse;
use OCP\ICache;
use OCP\ICacheFactory;
use OCP\IConfig;
class Manager {
+ public const FEATURE_HEADER = 'X-Spreed-Signaling-Features';
/** @var IConfig */
protected $serverConfig;
@@ -46,6 +48,13 @@ class Manager {
$this->cache = $cacheFactory->createDistributed('hpb_servers');
}
+ public function isCompatibleSignalingServer(IResponse $response): bool {
+ $featureHeader = $response->getHeader(self::FEATURE_HEADER);
+ $features = explode(',', $featureHeader);
+ $features = array_map('trim', $features);
+ return in_array('audio-video-permissions', $features, true);
+ }
+
public function getSignalingServerLinkForConversation(?Room $room): string {
if ($this->talkConfig->getSignalingMode() === Config::SIGNALING_INTERNAL) {
return '';