New "Enable restrictions on browser restart" option.

This commit is contained in:
hackademix 2022-03-25 08:51:44 +01:00
parent d5bb18b453
commit 28be872273
4 changed files with 12 additions and 0 deletions

View File

@ -167,6 +167,9 @@
"Enforce": {
"message": "Enable restrictions globally"
},
"EnforceOnRestart": {
"message": "Restore restrictions on browser restart"
},
"NoEnforcementForTab": {
"message": "Disable restrictions for this tab"
},

View File

@ -56,6 +56,10 @@
let policyData = (await Storage.get("sync", "policy")).policy;
if (policyData && policyData.DEFAULT) {
ns.policy = new Policy(policyData);
if (ns.local.enforceOnRestart && !ns.policy.enforced) {
ns.policy.enforced = true;
await ns.savePolicy();
}
} else {
await include("/legacy/Legacy.js");
ns.policy = await Legacy.createOrMigratePolicy();

View File

@ -50,6 +50,9 @@ SPDX-License-Identifier: GPL-3.0-or-later
<span id="global-opt">
<input type="checkbox" id="opt-global"><label for="opt-global" id="lbl-global">__MSG_NoEnforcement__</label>
</span>
<span id="enforceOnRestart-opt">
<input type="checkbox" id="opt-enforceOnRestart"><label for="opt-enforceOnRestart" id="lbl-enforceOnRestart">__MSG_EnforceOnRestart__</label>
</span>
</div>
<div class="opt-group">
<span id="auto-opt">

View File

@ -46,6 +46,8 @@ document.querySelector("#version").textContent = _("Version",
return disabled;
});
opt("enforceOnRestart", "local");
opt("auto", o => {
if (o) {
policy.autoAllowTop = o.checked;