policy.js 1.4 KB

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