New "Enable restrictions on browser restart" option.
This commit is contained in:
parent
d5bb18b453
commit
28be872273
|
@ -167,6 +167,9 @@
|
|||
"Enforce": {
|
||||
"message": "Enable restrictions globally"
|
||||
},
|
||||
"EnforceOnRestart": {
|
||||
"message": "Restore restrictions on browser restart"
|
||||
},
|
||||
"NoEnforcementForTab": {
|
||||
"message": "Disable restrictions for this tab"
|
||||
},
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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">
|
||||
|
|
|
@ -46,6 +46,8 @@ document.querySelector("#version").textContent = _("Version",
|
|||
return disabled;
|
||||
});
|
||||
|
||||
opt("enforceOnRestart", "local");
|
||||
|
||||
opt("auto", o => {
|
||||
if (o) {
|
||||
policy.autoAllowTop = o.checked;
|
||||
|
|
Loading…
Reference in New Issue