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 <coding@schilljs.com>2020-04-15 16:26:52 +0300
committerJoas Schilling <coding@schilljs.com>2020-05-12 11:40:20 +0300
commitbbcb75c589c9a2f52a4fa035fa76ec0a82e9eee8 (patch)
treea1b0a04506c354c281149be892ec4540233555fc /lib
parentbf5489fefe41e66d7fdedee6a70b4f7d53fed354 (diff)
Require a distributed MemCache
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/Controller/PageController.php3
-rw-r--r--lib/Files/TemplateLoader.php3
-rw-r--r--lib/PublicShare/TemplateLoader.php3
-rw-r--r--lib/PublicShareAuth/TemplateLoader.php3
-rw-r--r--lib/TInitialState.php11
5 files changed, 23 insertions, 0 deletions
diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php
index e13f3ff70..e7174b249 100644
--- a/lib/Controller/PageController.php
+++ b/lib/Controller/PageController.php
@@ -45,6 +45,7 @@ use OCP\AppFramework\Http\Template\PublicTemplateResponse;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\IRootFolder;
use OCP\Files\NotPermittedException;
+use OCP\ICacheFactory;
use OCP\IConfig;
use OCP\IInitialStateService;
use OCP\ILogger;
@@ -95,6 +96,7 @@ class PageController extends Controller {
INotificationManager $notificationManager,
IAppManager $appManager,
IInitialStateService $initialStateService,
+ ICacheFactory $memcacheFactory,
IRootFolder $rootFolder,
Config $talkConfig,
IConfig $serverConfig) {
@@ -110,6 +112,7 @@ class PageController extends Controller {
$this->notificationManager = $notificationManager;
$this->appManager = $appManager;
$this->initialStateService = $initialStateService;
+ $this->memcacheFactory = $memcacheFactory;
$this->rootFolder = $rootFolder;
$this->talkConfig = $talkConfig;
$this->serverConfig = $serverConfig;
diff --git a/lib/Files/TemplateLoader.php b/lib/Files/TemplateLoader.php
index 7bc38b472..185e8cb13 100644
--- a/lib/Files/TemplateLoader.php
+++ b/lib/Files/TemplateLoader.php
@@ -32,6 +32,7 @@ use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\EventDispatcher\IEventListener;
use OCP\Files\IRootFolder;
+use OCP\ICacheFactory;
use OCP\IConfig;
use OCP\IInitialStateService;
use OCP\IUser;
@@ -53,12 +54,14 @@ class TemplateLoader implements IEventListener {
private $userSession;
public function __construct(IInitialStateService $initialStateService,
+ ICacheFactory $memcacheFactory,
Config $talkConfig,
IConfig $serverConfig,
IAppManager $appManager,
IRootFolder $rootFolder,
IUserSession $userSession) {
$this->initialStateService = $initialStateService;
+ $this->memcacheFactory = $memcacheFactory;
$this->talkConfig = $talkConfig;
$this->serverConfig = $serverConfig;
$this->appManager = $appManager;
diff --git a/lib/PublicShare/TemplateLoader.php b/lib/PublicShare/TemplateLoader.php
index e03bb3327..de5f55554 100644
--- a/lib/PublicShare/TemplateLoader.php
+++ b/lib/PublicShare/TemplateLoader.php
@@ -28,6 +28,7 @@ use OCA\Talk\Config;
use OCA\Talk\TInitialState;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\FileInfo;
+use OCP\ICacheFactory;
use OCP\IConfig;
use OCP\IInitialStateService;
use OCP\Share\IShare;
@@ -46,10 +47,12 @@ class TemplateLoader {
use TInitialState;
public function __construct(IInitialStateService $initialStateService,
+ ICacheFactory $memcacheFactory,
Config $talkConfig,
IConfig $serverConfig) {
$this->initialStateService = $initialStateService;
$this->talkConfig = $talkConfig;
+ $this->memcacheFactory = $memcacheFactory;
$this->serverConfig = $serverConfig;
}
diff --git a/lib/PublicShareAuth/TemplateLoader.php b/lib/PublicShareAuth/TemplateLoader.php
index 9aeccf565..1e7e0ab58 100644
--- a/lib/PublicShareAuth/TemplateLoader.php
+++ b/lib/PublicShareAuth/TemplateLoader.php
@@ -26,6 +26,7 @@ namespace OCA\Talk\PublicShareAuth;
use OCA\Talk\Config;
use OCA\Talk\TInitialState;
use OCP\EventDispatcher\IEventDispatcher;
+use OCP\ICacheFactory;
use OCP\IConfig;
use OCP\IInitialStateService;
use OCP\Share\IShare;
@@ -44,9 +45,11 @@ class TemplateLoader {
use TInitialState;
public function __construct(IInitialStateService $initialStateService,
+ ICacheFactory $memcacheFactory,
Config $talkConfig,
IConfig $serverConfig) {
$this->initialStateService = $initialStateService;
+ $this->memcacheFactory = $memcacheFactory;
$this->talkConfig = $talkConfig;
$this->serverConfig = $serverConfig;
}
diff --git a/lib/TInitialState.php b/lib/TInitialState.php
index 7452436de..6004f7538 100644
--- a/lib/TInitialState.php
+++ b/lib/TInitialState.php
@@ -23,10 +23,12 @@ declare(strict_types=1);
namespace OCA\Talk;
+use OC\HintException;
use OC\User\NoUserException;
use OCP\App\IAppManager;
use OCP\Files\IRootFolder;
use OCP\Files\NotPermittedException;
+use OCP\ICacheFactory;
use OCP\IConfig;
use OCP\IInitialStateService;
use OCP\IUser;
@@ -40,6 +42,8 @@ trait TInitialState {
protected $serverConfig;
/** @var IInitialStateService */
protected $initialStateService;
+ /** @var ICacheFactory */
+ protected $memcacheFactory;
protected function publishInitialStateShared(): void {
// Needed to enable the screensharing extension in Chromium < 72.
@@ -50,6 +54,13 @@ trait TInitialState {
$this->serverConfig->getAppValue('spreed', 'prefer_h264', 'no') === 'yes'
);
+ $signalingMode = $this->talkConfig->getSignalingMode();
+ if ($signalingMode !== 'internal' && !$this->memcacheFactory->isAvailable()) {
+ throw new HintException(
+ 'External signaling is only supported with a distributed cache'
+ );
+ }
+
$this->initialStateService->provideInitialState(
'talk', 'signaling_mode',
$this->talkConfig->getSignalingMode()