Skip to content

Commit 3dd71b3

Browse files
committed
Make container presets mirror the default policy's presets
1 parent ec339bd commit 3dd71b3

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

src/bg/Settings.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ var Settings = {
175175

176176
if (contextStore) {
177177
let newContextStore = new ContextStore(contextStore);
178-
debug("set contextstore", newContextStore);
179178
ns.contextStore = newContextStore
180179
await ns.saveContextStore();
181180
}

src/bg/main.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,7 @@
359359

360360
async saveContextStore() {
361361
if (this.contextStore) {
362+
debug("save contextstore", this.contextStore);
362363
await Storage.set("sync", {
363364
contextStore: this.contextStore.dry()
364365
});
@@ -367,8 +368,6 @@
367368
return this.contextStore;
368369
},
369370

370-
371-
372371
async save(obj) {
373372
if (obj && obj.storage) {
374373
let toBeSaved = {

src/nscl

src/ui/options.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,12 @@
153153
let parent = document.getElementById("presets");
154154
let presetsUI = new UI.Sites(parent,
155155
{"DEFAULT": true, "TRUSTED": true, "UNTRUSTED": true});
156+
presetsUI.onChange = () => {
157+
if (UI.policy && UI.contextStore) { // contextStore presets always copy default policy's
158+
UI.contextStore.updatePresets(UI.policy);
159+
UI.updateSettings({policy: UI.policy, contextStore: UI.contextStore});
160+
}
161+
}
156162

157163
presetsUI.render([""]);
158164
window.setTimeout(() => {

0 commit comments

Comments
 (0)