summaryrefslogtreecommitdiff
path: root/src/bg/main.js
diff options
context:
space:
mode:
authortilpner2020-05-17 20:44:16 +0200
committertilpner2020-05-18 12:59:15 +0200
commit3b623a74bfb3f1e04f8cbc77dceccb545b7d955f (patch)
tree5bb798afbfcf2f12ef3560909c19840fdd861bb1 /src/bg/main.js
parent95a44c07d26b25818fd1a4ae62f57440e4fe7aa2 (diff)
downloadnoscript-3b623a74bfb3f1e04f8cbc77dceccb545b7d955f.tar.gz
noscript-3b623a74bfb3f1e04f8cbc77dceccb545b7d955f.tar.xz
noscript-3b623a74bfb3f1e04f8cbc77dceccb545b7d955f.zip
Use managed policy for default settings, if available
Diffstat (limited to 'src/bg/main.js')
-rw-r--r--src/bg/main.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/bg/main.js b/src/bg/main.js
index d220274..919c971 100644
--- a/src/bg/main.js
+++ b/src/bg/main.js
@@ -42,9 +42,15 @@
if (policyData && policyData.DEFAULT) {
ns.policy = new Policy(policyData);
} else {
- await include("/legacy/Legacy.js");
- ns.policy = await Legacy.createOrMigratePolicy();
- await ns.savePolicy();
+ let managedData = await Storage.get("managed", "defaultSettings");
+ if (managedData != null) {
+ let defaultSettings = JSON.parse(managedData.defaultSettings);
+ ns.policy = new Policy(defaultSettings.policy);
+ } else {
+ await include("/legacy/Legacy.js");
+ ns.policy = await Legacy.createOrMigratePolicy();
+ await ns.savePolicy();
+ }
}
Sites.onionSecure = ns.local.isTorBrowser;