diff options
author | Joas Schilling <coding@schilljs.com> | 2020-04-15 16:26:52 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2020-05-12 11:40:20 +0300 |
commit | bbcb75c589c9a2f52a4fa035fa76ec0a82e9eee8 (patch) | |
tree | a1b0a04506c354c281149be892ec4540233555fc /lib | |
parent | bf5489fefe41e66d7fdedee6a70b4f7d53fed354 (diff) |
Require a distributed MemCache
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Controller/PageController.php | 3 | ||||
-rw-r--r-- | lib/Files/TemplateLoader.php | 3 | ||||
-rw-r--r-- | lib/PublicShare/TemplateLoader.php | 3 | ||||
-rw-r--r-- | lib/PublicShareAuth/TemplateLoader.php | 3 | ||||
-rw-r--r-- | lib/TInitialState.php | 11 |
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() |