wekan/server/policy.js

32 lines
1.2 KiB
JavaScript
Raw Normal View History

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') {
// Trusted URL that can embed Wekan in iFrame.
const trusted = process.env.TRUSTED_URL;
BrowserPolicy.framing.disallow();
//Allow inline scripts, otherwise there is errors in browser/inspect/console
//BrowserPolicy.content.disallowInlineScripts();
//BrowserPolicy.content.disallowEval();
//BrowserPolicy.content.allowInlineStyles();
//BrowserPolicy.content.allowFontDataUrl();
BrowserPolicy.framing.restrictToOrigin(trusted);
//BrowserPolicy.content.allowScriptOrigin(trusted);
2019-06-28 12:52:09 -05:00
} else {
// Disable browser policy and allow all framing and including.
// Use only at internal LAN, not at Internet.
BrowserPolicy.framing.allowAll();
//BrowserPolicy.content.allowDataUrlForAll();
}
// Allow all images from anywhere
//BrowserPolicy.content.allowImageOrigin('*');
// 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) {
//BrowserPolicy.content.allowScriptOrigin(matomoUrl);
//BrowserPolicy.content.allowImageOrigin(matomoUrl);
2018-07-27 18:08:09 +02:00
}
});