policy.js 1.4 KB

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