mirror of
https://github.com/remittor/zapret-openwrt.git
synced 2026-01-27 04:40:34 +03:00
settings: Add new options on "Reset settings" dialog
This commit is contained in:
@@ -244,8 +244,18 @@ return view.extend({
|
|||||||
' ', _('Set AutoHostList mode')
|
' ', _('Set AutoHostList mode')
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
let erase_autohostlist = E('label', [
|
||||||
|
E('input', { type: 'checkbox', id: 'cfg_erase_autohostlist' }),
|
||||||
|
' ', _('Erase AutoHostList (ipset)')
|
||||||
|
]);
|
||||||
|
|
||||||
|
let enable_custom_d = E('label', [
|
||||||
|
E('input', { type: 'checkbox', id: 'cfg_enable_custom_d' }),
|
||||||
|
' ', _('Enable use custom.d scripts')
|
||||||
|
]);
|
||||||
|
|
||||||
let strat_list = [ ];
|
let strat_list = [ ];
|
||||||
strat_list.push( E('option', { value: 'strat__skip__' }, [ '-' ] ) );
|
strat_list.push( E('option', { value: 'strat__skip__' }, [ 'not change' ] ) );
|
||||||
for (let id = 0; id < this.nfqws_strat_list.length; id++) {
|
for (let id = 0; id < this.nfqws_strat_list.length; id++) {
|
||||||
let strat = '' + this.nfqws_strat_list[id];
|
let strat = '' + this.nfqws_strat_list[id];
|
||||||
strat_list.push( E('option', { value: 'strat_' + id }, [ strat ] ) );
|
strat_list.push( E('option', { value: 'strat_' + id }, [ strat ] ) );
|
||||||
@@ -276,10 +286,19 @@ return view.extend({
|
|||||||
if (document.getElementById('cfg_autohostlist').checked) {
|
if (document.getElementById('cfg_autohostlist').checked) {
|
||||||
opt_flags += '(set_mode_autohostlist)';
|
opt_flags += '(set_mode_autohostlist)';
|
||||||
};
|
};
|
||||||
|
if (document.getElementById('cfg_erase_autohostlist').checked) {
|
||||||
|
opt_flags += '(erase_autohostlist)';
|
||||||
|
};
|
||||||
|
if (document.getElementById('enable_custom_d').checked) {
|
||||||
|
opt_flags += '(enable_custom_d)';
|
||||||
|
};
|
||||||
//console.log('RESET: opt_flags = ' + opt_flags);
|
//console.log('RESET: opt_flags = ' + opt_flags);
|
||||||
let sel_strat = document.getElementById('cfg_nfqws_strat');
|
let sel_strat = document.getElementById('cfg_nfqws_strat');
|
||||||
let opt_strat = sel_strat.options[sel_strat.selectedIndex].text;
|
let opt_strat = sel_strat.options[sel_strat.selectedIndex].text;
|
||||||
//console.log('RESET: strat = ' + opt_strat);
|
//console.log('RESET: strat = ' + opt_strat);
|
||||||
|
if (opt_strat == 'not change') {
|
||||||
|
opt_strat = '-';
|
||||||
|
}
|
||||||
opt_flags += '(sync)';
|
opt_flags += '(sync)';
|
||||||
let args = [ opt_flags, opt_strat ];
|
let args = [ opt_flags, opt_strat ];
|
||||||
return this.serviceActionEx('reset', resetcfg_btn, args, true);
|
return this.serviceActionEx('reset', resetcfg_btn, args, true);
|
||||||
@@ -293,6 +312,10 @@ return view.extend({
|
|||||||
E('br'), E('br'),
|
E('br'), E('br'),
|
||||||
set_autohostlist,
|
set_autohostlist,
|
||||||
E('br'), E('br'),
|
E('br'), E('br'),
|
||||||
|
erase_autohostlist,
|
||||||
|
E('br'), E('br'),
|
||||||
|
enable_custom_d,
|
||||||
|
E('br'), E('br'),
|
||||||
nfqws_strat,
|
nfqws_strat,
|
||||||
E('br'), E('br')
|
E('br'), E('br')
|
||||||
]),
|
]),
|
||||||
|
|||||||
@@ -442,5 +442,17 @@ function set_cfg_default_values
|
|||||||
commit $cfgname
|
commit $cfgname
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
|
if echo "$opt_flags" | grep -q "(enable_custom_d)"; then
|
||||||
|
uci batch <<-EOF
|
||||||
|
set $cfgname.config.DISABLE_CUSTOM='0'
|
||||||
|
commit $cfgname
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
if echo "$opt_flags" | grep -q "(disable_custom_d)"; then
|
||||||
|
uci batch <<-EOF
|
||||||
|
set $cfgname.config.DISABLE_CUSTOM='1'
|
||||||
|
commit $cfgname
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,11 @@ opt_strat=$2
|
|||||||
if echo "$opt_flags" | grep -q "(reset_ipset)"; then
|
if echo "$opt_flags" | grep -q "(reset_ipset)"; then
|
||||||
restore_all_ipset_cfg
|
restore_all_ipset_cfg
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if echo "$opt_flags" | grep -q "(erase_autohostlist)"; then
|
||||||
|
: > $ZAPRET_BASE/ipset/zapret-hosts-auto.txt
|
||||||
|
: > $ZAPRET_BASE/ipset/zapret-hosts-auto-debug.log
|
||||||
|
fi
|
||||||
|
|
||||||
create_default_cfg "$opt_flags" "$opt_strat"
|
create_default_cfg "$opt_flags" "$opt_strat"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user