app.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016 Bjoern Schiessle <bjoern@schiessle.org>
  4. * @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch>
  5. *
  6. * @author Bjoern Schiessle <bjoern@schiessle.org>
  7. * @author Joas Schilling <coding@schilljs.com>
  8. * @author Julius Härtl <jus@bitgrid.net>
  9. * @author Lukas Reschke <lukas@statuscode.ch>
  10. *
  11. * @license GNU AGPL version 3 or any later version
  12. *
  13. * This program is free software: you can redistribute it and/or modify
  14. * it under the terms of the GNU Affero General Public License as
  15. * published by the Free Software Foundation, either version 3 of the
  16. * License, or (at your option) any later version.
  17. *
  18. * This program is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. * GNU Affero General Public License for more details.
  22. *
  23. * You should have received a copy of the GNU Affero General Public License
  24. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  25. *
  26. */
  27. $app = new \OCP\AppFramework\App('theming');
  28. $app->getContainer()->registerCapability(\OCA\Theming\Capabilities::class);
  29. $linkToCSS = \OC::$server->getURLGenerator()->linkToRoute(
  30. 'theming.Theming.getStylesheet',
  31. [
  32. 'v' => \OC::$server->getConfig()->getAppValue('theming', 'cachebuster', '0'),
  33. ]
  34. );
  35. \OCP\Util::addHeader(
  36. 'link',
  37. [
  38. 'rel' => 'stylesheet',
  39. 'href' => $linkToCSS,
  40. ]
  41. );
  42. $linkToJs = \OC::$server->getURLGenerator()->linkToRoute(
  43. 'theming.Theming.getJavascript',
  44. [
  45. 'v' => \OC::$server->getConfig()->getAppValue('theming', 'cachebuster', '0'),
  46. ]
  47. );
  48. \OCP\Util::addHeader(
  49. 'script',
  50. [
  51. 'src' => $linkToJs,
  52. 'nonce' => \OC::$server->getContentSecurityPolicyNonceManager()->getNonce()
  53. ], ''
  54. );