From 4c79f4d46406d01c0fb0291e0abc5c25b6bc1819 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Wed, 22 Jul 2020 22:30:40 +0200 Subject: Use IBootstrap for the app Signed-off-by: Morris Jobke --- appinfo/app.php | 24 ------------------------ appinfo/info.xml | 1 + lib/AppInfo/Application.php | 41 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 24 deletions(-) delete mode 100755 appinfo/app.php create mode 100644 lib/AppInfo/Application.php diff --git a/appinfo/app.php b/appinfo/app.php deleted file mode 100755 index 4899266..0000000 --- a/appinfo/app.php +++ /dev/null @@ -1,24 +0,0 @@ -addAllowedWorkerSrcDomain('\'self\''); -$csp->addAllowedWorkerSrcDomain('blob:'); -$cspManager = \OC::$server->query(\OCP\Security\IContentSecurityPolicyManager::class); -$cspManager->addDefaultPolicy($csp); diff --git a/appinfo/info.xml b/appinfo/info.xml index 1f2e9a8..e115153 100755 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -13,6 +13,7 @@ 1.9.0 MIT Björn Korella + FilesVideoPlayer https://github.com/nextcloud/files_videoplayer/blob/master/README.md diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php new file mode 100644 index 0000000..9165050 --- /dev/null +++ b/lib/AppInfo/Application.php @@ -0,0 +1,41 @@ + + * + * @author Morris Jobke + * + * @license MIT + */ + +namespace OCA\FilesVideoPlayer\AppInfo; + +use OCP\AppFramework\App; +use OCP\AppFramework\Bootstrap\IBootContext; +use OCP\AppFramework\Bootstrap\IBootstrap; +use OCP\AppFramework\Bootstrap\IRegistrationContext; +use OCP\AppFramework\Http\ContentSecurityPolicy; +use OCP\Security\IContentSecurityPolicyManager; +use OCP\Util; + +class Application extends App implements IBootstrap { + public const APP_ID = 'files_videoplayer'; + + public function __construct() { + parent::__construct(self::APP_ID); + } + + public function register(IRegistrationContext $context): void { + } + + public function boot(IBootContext $context): void { + Util::addScript('files_videoplayer', 'main'); + + $csp = new ContentSecurityPolicy(); + $csp->addAllowedWorkerSrcDomain('\'self\''); + $csp->addAllowedWorkerSrcDomain('blob:'); + $cspManager = $context->getServerContainer()->query(IContentSecurityPolicyManager::class); + $cspManager->addDefaultPolicy($csp); + } +} -- cgit v1.2.3