2018-07-27 18:08:09 +02:00
|
|
|
import { BrowserPolicy } from 'meteor/browser-policy-common';
|
|
|
|
|
|
|
|
Meteor.startup(() => {
|
2019-06-28 12:52:09 -05:00
|
|
|
if (process.env.BROWSER_POLICY_ENABLED === 'true') {
|
2018-08-13 19:24:07 +03:00
|
|
|
// Trusted URL that can embed Wekan in iFrame.
|
|
|
|
const trusted = process.env.TRUSTED_URL;
|
|
|
|
BrowserPolicy.framing.disallow();
|
2018-08-15 23:41:01 +03:00
|
|
|
//Allow inline scripts, otherwise there is errors in browser/inspect/console
|
|
|
|
//BrowserPolicy.content.disallowInlineScripts();
|
2018-08-16 14:29:38 +03:00
|
|
|
//BrowserPolicy.content.disallowEval();
|
|
|
|
//BrowserPolicy.content.allowInlineStyles();
|
|
|
|
//BrowserPolicy.content.allowFontDataUrl();
|
2018-08-13 19:24:07 +03:00
|
|
|
BrowserPolicy.framing.restrictToOrigin(trusted);
|
2018-08-16 14:29:38 +03:00
|
|
|
//BrowserPolicy.content.allowScriptOrigin(trusted);
|
2019-06-28 12:52:09 -05:00
|
|
|
} else {
|
2018-08-13 19:24:07 +03:00
|
|
|
// Disable browser policy and allow all framing and including.
|
|
|
|
// Use only at internal LAN, not at Internet.
|
|
|
|
BrowserPolicy.framing.allowAll();
|
2018-08-16 14:29:38 +03:00
|
|
|
//BrowserPolicy.content.allowDataUrlForAll();
|
2018-08-13 19:24:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// Allow all images from anywhere
|
2018-08-16 14:29:38 +03:00
|
|
|
//BrowserPolicy.content.allowImageOrigin('*');
|
2018-08-13 19:24:07 +03:00
|
|
|
|
|
|
|
// If Matomo URL is set, allow it.
|
2018-07-27 18:08:09 +02:00
|
|
|
const matomoUrl = process.env.MATOMO_ADDRESS;
|
2019-06-28 12:52:09 -05:00
|
|
|
if (matomoUrl) {
|
2018-08-16 14:29:38 +03:00
|
|
|
//BrowserPolicy.content.allowScriptOrigin(matomoUrl);
|
|
|
|
//BrowserPolicy.content.allowImageOrigin(matomoUrl);
|
2018-07-27 18:08:09 +02:00
|
|
|
}
|
|
|
|
});
|