Skip to content

Commit 28be872

Browse files
committed
New "Enable restrictions on browser restart" option.
1 parent d5bb18b commit 28be872

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

src/_locales/en/messages.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,9 @@
167167
"Enforce": {
168168
"message": "Enable restrictions globally"
169169
},
170+
"EnforceOnRestart": {
171+
"message": "Restore restrictions on browser restart"
172+
},
170173
"NoEnforcementForTab": {
171174
"message": "Disable restrictions for this tab"
172175
},

src/bg/main.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@
5656
let policyData = (await Storage.get("sync", "policy")).policy;
5757
if (policyData && policyData.DEFAULT) {
5858
ns.policy = new Policy(policyData);
59+
if (ns.local.enforceOnRestart && !ns.policy.enforced) {
60+
ns.policy.enforced = true;
61+
await ns.savePolicy();
62+
}
5963
} else {
6064
await include("/legacy/Legacy.js");
6165
ns.policy = await Legacy.createOrMigratePolicy();

src/ui/options.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ <h3 class="flextabs__tab"><button class="flextabs__toggle">__MSG_SectionGeneral_
5050
<span id="global-opt">
5151
<input type="checkbox" id="opt-global"><label for="opt-global" id="lbl-global">__MSG_NoEnforcement__</label>
5252
</span>
53+
<span id="enforceOnRestart-opt">
54+
<input type="checkbox" id="opt-enforceOnRestart"><label for="opt-enforceOnRestart" id="lbl-enforceOnRestart">__MSG_EnforceOnRestart__</label>
55+
</span>
5356
</div>
5457
<div class="opt-group">
5558
<span id="auto-opt">

src/ui/options.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ document.querySelector("#version").textContent = _("Version",
4646
return disabled;
4747
});
4848

49+
opt("enforceOnRestart", "local");
50+
4951
opt("auto", o => {
5052
if (o) {
5153
policy.autoAllowTop = o.checked;

0 commit comments

Comments
 (0)