policy.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. import { BrowserPolicy } from 'meteor/browser-policy-common';
  2. Meteor.startup(() => {
  3. if ( process.env.BROWSER_POLICY_ENABLED === 'true' ) {
  4. // Trusted URL that can embed Wekan in iFrame.
  5. const trusted = process.env.TRUSTED_URL;
  6. BrowserPolicy.framing.disallow();
  7. //Allow inline scripts, otherwise there is errors in browser/inspect/console
  8. //BrowserPolicy.content.disallowInlineScripts();
  9. //BrowserPolicy.content.disallowEval();
  10. //BrowserPolicy.content.allowInlineStyles();
  11. //BrowserPolicy.content.allowFontDataUrl();
  12. BrowserPolicy.framing.restrictToOrigin(trusted);
  13. //BrowserPolicy.content.allowScriptOrigin(trusted);
  14. }
  15. else {
  16. // Disable browser policy and allow all framing and including.
  17. // Use only at internal LAN, not at Internet.
  18. BrowserPolicy.framing.allowAll();
  19. //BrowserPolicy.content.allowDataUrlForAll();
  20. }
  21. // Allow all images from anywhere
  22. //BrowserPolicy.content.allowImageOrigin('*');
  23. // If Matomo URL is set, allow it.
  24. const matomoUrl = process.env.MATOMO_ADDRESS;
  25. if (matomoUrl){
  26. //BrowserPolicy.content.allowScriptOrigin(matomoUrl);
  27. //BrowserPolicy.content.allowImageOrigin(matomoUrl);
  28. }
  29. });