policy.js 1.2 KB

12345678910111213141516171819202122232425262728293031
  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. } else {
  15. // Disable browser policy and allow all framing and including.
  16. // Use only at internal LAN, not at Internet.
  17. BrowserPolicy.framing.allowAll();
  18. //BrowserPolicy.content.allowDataUrlForAll();
  19. }
  20. // Allow all images from anywhere
  21. //BrowserPolicy.content.allowImageOrigin('*');
  22. // If Matomo URL is set, allow it.
  23. const matomoUrl = process.env.MATOMO_ADDRESS;
  24. if (matomoUrl) {
  25. //BrowserPolicy.content.allowScriptOrigin(matomoUrl);
  26. //BrowserPolicy.content.allowImageOrigin(matomoUrl);
  27. }
  28. });