Fix missing element for Chromium screensharing extension

In Chromium < 72 an extension is needed to share the screen
(https://github.com/nextcloud/spreed-screensharing-chrome-extension).
Once installed, the extension enables itself only in those pages that
contain an element with id "app" and class
"nc-enable-screensharing-extension" when the document is loaded.

As the element can not be added after the document has loaded and the
screen sharing should work also when Talk is enabled in other apps a
(hacky and very likely not compliant) meta element is added in the
header element to be found by the extension whenever Talk is used.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
Daniel Calviño Sánchez 2020-04-06 21:05:39 +02:00
Родитель b9422fd3a0
Коммит 51e0ed85d0
4 изменённых файлов: 16 добавлений и 0 удалений

Просмотреть файл

@ -52,6 +52,7 @@ use OCP\IURLGenerator;
use OCP\IUser;
use OCP\IUserSession;
use OCP\Notification\IManager as INotificationManager;
use OCP\Util;
class PageController extends Controller {
/** @var string|null */
@ -233,6 +234,9 @@ class PageController extends Controller {
}
}
// Needed to enable the screensharing extension in Chromium < 72.
Util::addHeader('meta', ['id' => "app", 'class' => 'nc-enable-screensharing-extension']);
$this->initialStateService->provideInitialState(
'talk', 'prefer_h264',
$this->serverConfig->getAppValue('spreed', 'prefer_h264', 'no') === 'yes'
@ -311,6 +315,9 @@ class PageController extends Controller {
}
}
// Needed to enable the screensharing extension in Chromium < 72.
Util::addHeader('meta', ['id' => "app", 'class' => 'nc-enable-screensharing-extension']);
$this->initialStateService->provideInitialState(
'talk', 'prefer_h264',
$this->serverConfig->getAppValue('spreed', 'prefer_h264', 'no') === 'yes'

Просмотреть файл

@ -58,6 +58,9 @@ class TemplateLoader implements IEventListener {
Util::addStyle(Application::APP_ID, 'merged-files');
Util::addScript(Application::APP_ID, 'talk-files-sidebar');
Util::addScript(Application::APP_ID, 'talk-files-sidebar-loader');
// Needed to enable the screensharing extension in Chromium < 72.
Util::addHeader('meta', ['id' => "app", 'class' => 'nc-enable-screensharing-extension']);
}
}

Просмотреть файл

@ -68,6 +68,9 @@ class TemplateLoader {
Util::addStyle('spreed', 'merged-public-share');
Util::addScript('spreed', 'talk-public-share-sidebar');
// Needed to enable the screensharing extension in Chromium < 72.
Util::addHeader('meta', ['id' => "app", 'class' => 'nc-enable-screensharing-extension']);
}
}

Просмотреть файл

@ -65,6 +65,9 @@ class TemplateLoader {
Util::addStyle('spreed', 'merged-share-auth');
Util::addScript('spreed', 'talk-public-share-auth-sidebar');
// Needed to enable the screensharing extension in Chromium < 72.
Util::addHeader('meta', ['id' => "app", 'class' => 'nc-enable-screensharing-extension']);
}
}