Compare commits

...

7 Commits

Author SHA1 Message Date
remittor
ce26fdff22 Bump version to v72.20260117 2026-01-17 17:06:40 +03:00
remittor
18cc8d4115 luci: Fix typo into get_svc_buttons 2026-01-17 16:20:44 +03:00
remittor
702fe4721d luci: Fix file permissions for saved configs 2026-01-17 15:58:30 +03:00
remittor
10997a443f luci: Using dict for arguments of function 2026-01-17 15:50:46 +03:00
remittor
d91f44c287 diag: dwc: Add detect JS-challenge 2026-01-17 14:59:25 +03:00
remittor
45974e191d config: Use --comment option for strategy naming 2026-01-17 13:59:07 +03:00
remittor
42d8ee8ba6 luci: NFQWS_OPT: Block enter text with quotes 2026-01-17 13:57:49 +03:00
7 changed files with 123 additions and 95 deletions

View File

@@ -5,7 +5,7 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-zapret PKG_NAME:=luci-app-zapret
PKG_VERSION:=72.20260116 PKG_VERSION:=72.20260117
PKG_RELEASE:=1 PKG_RELEASE:=1
PKG_LICENSE:=MIT PKG_LICENSE:=MIT
PKG_MAINTAINER:=remittor <https://github.com/remittor> PKG_MAINTAINER:=remittor <https://github.com/remittor>

View File

@@ -18,14 +18,14 @@ const btn_style_success = 'btn cbi-button-success important';
return view.extend({ return view.extend({
get_svc_buttons: function(elems = { }) { get_svc_buttons: function(elems = { }) {
return { return {
enable : elems.btn_enable || document.getElementById('btn_enable'), "enable" : elems.btn_enable || document.getElementById('btn_enable'),
disable : elems.btn_disable || document.getElementById('btn_disable'), "disable" : elems.btn_disable || document.getElementById('btn_disable'),
start : elems.btn_start || document.getElementById('btn_start'), "start" : elems.btn_start || document.getElementById('btn_start'),
restart : elems.btn_restart || document.getElementById('btn_restart'), "restart" : elems.btn_restart || document.getElementById('btn_restart'),
stop : elems.btn_stop || document.getElementById('btn_stop'), "stop" : elems.btn_stop || document.getElementById('btn_stop'),
reset : elems.btn_reset || document.getElementById('btn_reset'), "reset" : elems.btn_reset || document.getElementById('btn_reset'),
diag : elems.btn_diag || document.getElementById('btn_diag'), "diag" : elems.btn_diag || document.getElementById('btn_diag'),
update : elems.btn_update || document.getElementById('btn_update'), "update" : elems.btn_update || document.getElementById('btn_update'),
}; };
}, },

View File

@@ -157,7 +157,14 @@ return view.extend({
if (multiline == 2) { if (multiline == 2) {
desc += '<br/>' + _('Example') + ': <a target=_blank href=%s>%s</a>'.format(tools.nfqws_opt_url); desc += '<br/>' + _('Example') + ': <a target=_blank href=%s>%s</a>'.format(tools.nfqws_opt_url);
} }
btn.onclick = () => new tools.longstrEditDialog('config', param, param, desc, rows, multiline).show(); btn.onclick = () => new tools.longstrEditDialog({
cfgsec: 'config',
cfgparam: param,
title: param,
desc: desc,
rows: rows,
multiline: multiline,
}).show();
}; };
if (tools.appName == 'zapret2') { if (tools.appName == 'zapret2') {
@@ -313,13 +320,12 @@ return view.extend({
o.inputtitle = _('Edit'); o.inputtitle = _('Edit');
o.inputstyle = 'edit btn'; o.inputstyle = 'edit btn';
o.description = tools.autoHostListFN; o.description = tools.autoHostListFN;
o.onclick = () => new tools.fileEditDialog( o.onclick = () => new tools.fileEditDialog({
tools.autoHostListFN, file: tools.autoHostListFN,
_('Auto host list'), title: _('Auto host list'),
'', desc: '',
'', rows: 15,
15 }).show();
).show();
o = s.taboption(tabname, form.Flag, 'AUTOHOSTLIST_DEBUGLOG', _('DEBUGLOG')); o = s.taboption(tabname, form.Flag, 'AUTOHOSTLIST_DEBUGLOG', _('DEBUGLOG'));
o.rmempty = false; o.rmempty = false;
@@ -329,13 +335,12 @@ return view.extend({
o.inputtitle = _('Edit'); o.inputtitle = _('Edit');
o.inputstyle = 'edit btn'; o.inputstyle = 'edit btn';
o.description = tools.autoHostListDbgFN; o.description = tools.autoHostListDbgFN;
o.onclick = () => new tools.fileEditDialog( o.onclick = () => new tools.fileEditDialog({
tools.autoHostListDbgFN, file: tools.autoHostListDbgFN,
_('Auto host debug list'), title: _('Auto host debug list'),
'', desc: '',
'', rows: 15,
15 }).show();
).show();
/* HostList settings */ /* HostList settings */
@@ -346,37 +351,37 @@ return view.extend({
o.inputtitle = _('Edit'); o.inputtitle = _('Edit');
o.inputstyle = 'edit btn'; o.inputstyle = 'edit btn';
o.description = tools.hostsGoogleFN; o.description = tools.hostsGoogleFN;
o.onclick = () => new tools.fileEditDialog( o.onclick = () => new tools.fileEditDialog({
tools.hostsGoogleFN, file: tools.hostsGoogleFN,
_('Google hostname entries'), title: _('Google hostname entries'),
_('One hostname per line.<br />Examples:'), desc: _('One hostname per line.<br />Examples:'),
'<code>youtube.com<br />googlevideo.com</code>', aux: '<code>youtube.com<br />googlevideo.com</code>',
15 rows: 15,
).show(); }).show();
o = s.taboption(tabname, form.Button, '_user_entries_btn', _('User hostname entries <HOSTLIST>')); o = s.taboption(tabname, form.Button, '_user_entries_btn', _('User hostname entries <HOSTLIST>'));
o.inputtitle = _('Edit'); o.inputtitle = _('Edit');
o.inputstyle = 'edit btn'; o.inputstyle = 'edit btn';
o.description = tools.hostsUserFN; o.description = tools.hostsUserFN;
o.onclick = () => new tools.fileEditDialog( o.onclick = () => new tools.fileEditDialog({
tools.hostsUserFN, file: tools.hostsUserFN,
_('User entries'), title: _('User entries'),
_('One hostname per line.<br />Examples:'), desc: _('One hostname per line.<br />Examples:'),
'<code>domain.net<br />sub.domain.com<br />facebook.com</code>', aux: '<code>domain.net<br />sub.domain.com<br />facebook.com</code>',
15 rows: 15,
).show(); }).show();
o = s.taboption(tabname, form.Button, '_user_excluded_entries_btn', _('User excluded hostname entries')); o = s.taboption(tabname, form.Button, '_user_excluded_entries_btn', _('User excluded hostname entries'));
o.inputtitle = _('Edit'); o.inputtitle = _('Edit');
o.inputstyle = 'edit btn'; o.inputstyle = 'edit btn';
o.description = tools.hostsUserExcludeFN; o.description = tools.hostsUserExcludeFN;
o.onclick = () => new tools.fileEditDialog( o.onclick = () => new tools.fileEditDialog({
tools.hostsUserExcludeFN, file: tools.hostsUserExcludeFN,
_('User excluded entries'), title: _('User excluded entries'),
_('One hostname per line.<br />Examples:'), desc: _('One hostname per line.<br />Examples:'),
'<code>domain.net<br />sub.domain.com<br />gosuslugi.ru</code>', aux: '<code>domain.net<br />sub.domain.com<br />gosuslugi.ru</code>',
15 rows: 15,
).show(); }).show();
add_delim(s); add_delim(s);
@@ -384,37 +389,37 @@ return view.extend({
o.inputtitle = _('Edit'); o.inputtitle = _('Edit');
o.inputstyle = 'edit btn'; o.inputstyle = 'edit btn';
o.description = tools.iplstExcludeFN; o.description = tools.iplstExcludeFN;
o.onclick = () => new tools.fileEditDialog( o.onclick = () => new tools.fileEditDialog({
tools.iplstExcludeFN, file: tools.iplstExcludeFN,
_('Excluded IP filter'), title: _('Excluded IP filter'),
_('Patterns can be strings or regular expressions. Each pattern in a separate line<br />Examples:'), desc: _('Patterns can be strings or regular expressions. Each pattern in a separate line<br />Examples:'),
'<code>128.199.0.0/16<br />34.217.90.52<br />162.13.190.77</code>', aux: '<code>128.199.0.0/16<br />34.217.90.52<br />162.13.190.77</code>',
15 rows: 15,
).show(); }).show();
o = s.taboption(tabname, form.Button, '_user_ip_filter_btn', _('User IP entries')); o = s.taboption(tabname, form.Button, '_user_ip_filter_btn', _('User IP entries'));
o.inputtitle = _('Edit'); o.inputtitle = _('Edit');
o.inputstyle = 'edit btn'; o.inputstyle = 'edit btn';
o.description = tools.iplstUserFN; o.description = tools.iplstUserFN;
o.onclick = () => new tools.fileEditDialog( o.onclick = () => new tools.fileEditDialog({
tools.iplstUserFN, file: tools.iplstUserFN,
_('User IP filter'), title: _('User IP filter'),
_('Patterns can be strings or regular expressions. Each pattern in a separate line<br />Examples:'), desc: _('Patterns can be strings or regular expressions. Each pattern in a separate line<br />Examples:'),
'<code>128.199.0.0/16<br />34.217.90.52<br />162.13.190.77</code>', aux: '<code>128.199.0.0/16<br />34.217.90.52<br />162.13.190.77</code>',
15 rows: 15,
).show(); }).show();
o = s.taboption(tabname, form.Button, '_user_excluded_ip_filter_btn', _('User excluded IP entries')); o = s.taboption(tabname, form.Button, '_user_excluded_ip_filter_btn', _('User excluded IP entries'));
o.inputtitle = _('Edit'); o.inputtitle = _('Edit');
o.inputstyle = 'edit btn'; o.inputstyle = 'edit btn';
o.description = tools.iplstUserExcludeFN; o.description = tools.iplstUserExcludeFN;
o.onclick = () => new tools.fileEditDialog( o.onclick = () => new tools.fileEditDialog({
tools.iplstUserExcludeFN, file: tools.iplstUserExcludeFN,
_('User excluded IP filter'), title: _('User excluded IP filter'),
_('Patterns can be strings or regular expressions. Each pattern in a separate line<br />Examples:'), desc: _('Patterns can be strings or regular expressions. Each pattern in a separate line<br />Examples:'),
'<code>128.199.0.0/16<br />34.217.90.52<br />162.13.190.77</code>', aux: '<code>128.199.0.0/16<br />34.217.90.52<br />162.13.190.77</code>',
15 rows: 15,
).show(); }).show();
add_delim(s); add_delim(s);
@@ -425,7 +430,7 @@ return view.extend({
o.inputtitle = _('Edit'); o.inputtitle = _('Edit');
o.inputstyle = 'edit btn'; o.inputstyle = 'edit btn';
o.description = fn; o.description = fn;
o.onclick = () => new tools.fileEditDialog(fn, name, '', '', 15).show(); o.onclick = () => new tools.fileEditDialog({ file: fn, title: name, rows: 15}).show();
} }
/* custom.d files */ /* custom.d files */
@@ -467,7 +472,7 @@ return view.extend({
desc += '<a target=_blank href=' + url + '>' + filename + '</a>'; desc += '<a target=_blank href=' + url + '>' + filename + '</a>';
} }
} }
o.onclick = () => new tools.fileEditDialog(fn, name, desc, '', 15).show(); o.onclick = () => new tools.fileEditDialog({ file: fn, title: name, desc: desc, rows: 15}).show();
} }
let map_promise = m.render(); let map_promise = m.render();

View File

@@ -320,14 +320,18 @@ return baseclass.extend({
}, },
fileEditDialog: baseclass.extend({ fileEditDialog: baseclass.extend({
__init__: function(file, title, desc, aux = null, rows = 10, callback, file_exists = false) { __init__: function(opts = {})
this.file = file; {
this.title = title; Object.assign(this, {
this.desc = desc; file: '',
this.aux = aux; title: '',
this.rows = rows, desc: '',
this.callback = callback; aux: '',
this.file_exists = file_exists; rows: 10,
callback: null,
file_exists: false,
setperm: 644,
}, opts);
}, },
load: function() { load: function() {
@@ -387,6 +391,12 @@ return baseclass.extend({
throw new Error('tee failed, rc = ' + res.code); throw new Error('tee failed, rc = ' + res.code);
} }
} }
if (this.setperm) {
let res = await fs.exec('/bin/busybox', [ 'chmod', '644', tmpFile ]);
if (res.code != 0) {
throw new Error('chmod failed, rc = ' + res.code);
}
}
let res = await fs.exec('/bin/busybox', [ 'mv', '-f', tmpFile, fileName ]); let res = await fs.exec('/bin/busybox', [ 'mv', '-f', tmpFile, fileName ]);
if (res.code != 0) { if (res.code != 0) {
throw new Error('mv failed, rc = ' + res.code); throw new Error('mv failed, rc = ' + res.code);
@@ -455,13 +465,16 @@ return baseclass.extend({
}), }),
longstrEditDialog: baseclass.extend({ longstrEditDialog: baseclass.extend({
__init__: function(cfgsec, cfgparam, title, desc, rows = 10, multiline = false) { __init__: function(opts = {})
this.cfgsec = cfgsec; {
this.cfgparam = cfgparam; Object.assign(this, {
this.title = title; cfgsec: '',
this.desc = desc; cfgparam: '',
this.rows = rows; title: '',
this.multiline = multiline; desc: '',
rows: 10,
multiline: false // may be 2
}, opts);
env_tools.load_env(this); env_tools.load_env(this);
}, },
@@ -525,6 +538,10 @@ return baseclass.extend({
if (value != "" && value != "\t") { if (value != "" && value != "\t") {
value = '\n' + value + '\n'; value = '\n' + value + '\n';
if (this.multiline == 2) { if (this.multiline == 2) {
if (value.includes("'") || value.includes('"')) {
alert(_('Unable to save the contents') + ':\n' + _('text cannot contain quotes!'));
return false;
}
value = value.replace(/"/g, ''); value = value.replace(/"/g, '');
value = value.replace(/'/g, ''); value = value.replace(/'/g, '');
} }

View File

@@ -5,7 +5,7 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=zapret PKG_NAME:=zapret
PKG_VERSION:=72.20260116 PKG_VERSION:=72.20260117
PKG_RELEASE:=1 PKG_RELEASE:=1
PKG_MAINTAINER:=bol-van PKG_MAINTAINER:=bol-van
@@ -15,7 +15,7 @@ PKG_LICENSE_FILES:=docs/LICENSE.txt
PKG_SOURCE_URL:=https://github.com/bol-van/zapret.git PKG_SOURCE_URL:=https://github.com/bol-van/zapret.git
PKG_SOURCE_PROTO:=git PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=c849e55ef0f1c244206f5a05ff7b1ab41a3824ee PKG_SOURCE_VERSION:=c849e55ef0f1c244206f5a05ff7b1ab41a3824ee
PKG_SOURCE_DATE:=2026-01-16 PKG_SOURCE_DATE:=2026-01-17
#PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz #PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
#PKG_SOURCE_URL:=https://github.com/bol-van/zapret/archive/refs/tags/v$(PKG_VERSION).tar.gz? #PKG_SOURCE_URL:=https://github.com/bol-van/zapret/archive/refs/tags/v$(PKG_VERSION).tar.gz?

View File

@@ -75,7 +75,7 @@ function set_cfg_nfqws_strat
set $cfgname.config.NFQWS_PORTS_TCP='80,443' set $cfgname.config.NFQWS_PORTS_TCP='80,443'
set $cfgname.config.NFQWS_PORTS_UDP='443' set $cfgname.config.NFQWS_PORTS_UDP='443'
set $cfgname.config.NFQWS_OPT=" set $cfgname.config.NFQWS_OPT="
# Strategy $strat --comment=Strategy__$strat
--filter-tcp=443 <HOSTLIST> --filter-tcp=443 <HOSTLIST>
--hostlist=/opt/zapret/ipset/zapret-hosts-google.txt --hostlist=/opt/zapret/ipset/zapret-hosts-google.txt
@@ -104,7 +104,7 @@ function set_cfg_nfqws_strat
set $cfgname.config.NFQWS_PORTS_TCP='80,443' set $cfgname.config.NFQWS_PORTS_TCP='80,443'
set $cfgname.config.NFQWS_PORTS_UDP='443' set $cfgname.config.NFQWS_PORTS_UDP='443'
set $cfgname.config.NFQWS_OPT=" set $cfgname.config.NFQWS_OPT="
# Strategy $strat --comment=Strategy__$strat
--filter-tcp=443 <HOSTLIST> --filter-tcp=443 <HOSTLIST>
--hostlist=/opt/zapret/ipset/zapret-hosts-google.txt --hostlist=/opt/zapret/ipset/zapret-hosts-google.txt
@@ -137,7 +137,7 @@ function set_cfg_nfqws_strat
set $cfgname.config.NFQWS_PORTS_TCP='80,443' set $cfgname.config.NFQWS_PORTS_TCP='80,443'
set $cfgname.config.NFQWS_PORTS_UDP='443' set $cfgname.config.NFQWS_PORTS_UDP='443'
set $cfgname.config.NFQWS_OPT=" set $cfgname.config.NFQWS_OPT="
# Strategy $strat --comment=Strategy__$strat
--filter-tcp=443 <HOSTLIST> --filter-tcp=443 <HOSTLIST>
--hostlist=/opt/zapret/ipset/zapret-hosts-google.txt --hostlist=/opt/zapret/ipset/zapret-hosts-google.txt
@@ -170,7 +170,7 @@ function set_cfg_nfqws_strat
set $cfgname.config.NFQWS_PORTS_TCP='80,443' set $cfgname.config.NFQWS_PORTS_TCP='80,443'
set $cfgname.config.NFQWS_PORTS_UDP='443' set $cfgname.config.NFQWS_PORTS_UDP='443'
set $cfgname.config.NFQWS_OPT=" set $cfgname.config.NFQWS_OPT="
# Strategy $strat --comment=Strategy__$strat
--filter-tcp=443 --filter-tcp=443
--hostlist=/opt/zapret/ipset/zapret-hosts-google.txt --hostlist=/opt/zapret/ipset/zapret-hosts-google.txt
@@ -211,7 +211,7 @@ function set_cfg_nfqws_strat
set $cfgname.config.NFQWS_PORTS_TCP='80,443' set $cfgname.config.NFQWS_PORTS_TCP='80,443'
set $cfgname.config.NFQWS_PORTS_UDP='443' set $cfgname.config.NFQWS_PORTS_UDP='443'
set $cfgname.config.NFQWS_OPT=" set $cfgname.config.NFQWS_OPT="
# Strategy $strat --comment=Strategy__$strat
--filter-tcp=443 --filter-tcp=443
--hostlist=/opt/zapret/ipset/zapret-hosts-google.txt --hostlist=/opt/zapret/ipset/zapret-hosts-google.txt
@@ -252,7 +252,7 @@ function set_cfg_nfqws_strat
set $cfgname.config.NFQWS_PORTS_TCP='80,443,2053,2083,2087,2096,8443' set $cfgname.config.NFQWS_PORTS_TCP='80,443,2053,2083,2087,2096,8443'
set $cfgname.config.NFQWS_PORTS_UDP='443,19294-19344,50000-50100' set $cfgname.config.NFQWS_PORTS_UDP='443,19294-19344,50000-50100'
set $cfgname.config.NFQWS_OPT=" set $cfgname.config.NFQWS_OPT="
# Strategy $strat --comment=Strategy__$strat
--filter-tcp=443 --filter-tcp=443
--hostlist=/opt/zapret/ipset/zapret-hosts-google.txt --hostlist=/opt/zapret/ipset/zapret-hosts-google.txt
@@ -297,7 +297,7 @@ function set_cfg_nfqws_strat
set $cfgname.config.NFQWS_PORTS_TCP='80,443,2053,2083,2087,2096,8443' set $cfgname.config.NFQWS_PORTS_TCP='80,443,2053,2083,2087,2096,8443'
set $cfgname.config.NFQWS_PORTS_UDP='443,19294-19344,50000-50100' set $cfgname.config.NFQWS_PORTS_UDP='443,19294-19344,50000-50100'
set $cfgname.config.NFQWS_OPT=" set $cfgname.config.NFQWS_OPT="
# Strategy $strat --comment=Strategy__$strat
--filter-tcp=443 --filter-tcp=443
--hostlist=/opt/zapret/ipset/zapret-hosts-google.txt --hostlist=/opt/zapret/ipset/zapret-hosts-google.txt
@@ -348,7 +348,7 @@ function set_cfg_nfqws_strat
set $cfgname.config.NFQWS_PORTS_TCP='80,443' set $cfgname.config.NFQWS_PORTS_TCP='80,443'
set $cfgname.config.NFQWS_PORTS_UDP='443' set $cfgname.config.NFQWS_PORTS_UDP='443'
set $cfgname.config.NFQWS_OPT=" set $cfgname.config.NFQWS_OPT="
# Strategy $strat --comment=Strategy__$strat
--filter-tcp=443 --filter-tcp=443
--hostlist=/opt/zapret/ipset/zapret-hosts-google.txt --hostlist=/opt/zapret/ipset/zapret-hosts-google.txt
@@ -384,7 +384,7 @@ function set_cfg_nfqws_strat
set $cfgname.config.NFQWS_PORTS_TCP='80,443' set $cfgname.config.NFQWS_PORTS_TCP='80,443'
set $cfgname.config.NFQWS_PORTS_UDP='443' set $cfgname.config.NFQWS_PORTS_UDP='443'
set $cfgname.config.NFQWS_OPT=" set $cfgname.config.NFQWS_OPT="
# Strategy $strat --comment=Strategy__$strat
--filter-tcp=443 --filter-tcp=443
--hostlist=/opt/zapret/ipset/zapret-hosts-google.txt --hostlist=/opt/zapret/ipset/zapret-hosts-google.txt

View File

@@ -204,9 +204,15 @@ printf '%s\n' "$ZAP_TMP_DIR"/*.log | sort | while IFS= read -r file; do
res=100 res=100
fi fi
fi fi
if [ $res -lt 100 ] && [ -f "$FNAME.hdr" ] && [ $BODY_SIZE -eq 0 ]; then
if grep -q 'x-amzn-waf-action: challenge' "$FNAME.hdr"; then
status="WARN: tested site required JS-challenge"
res=999
fi
fi
printf '%12s / %-15s / %-13s: %s \n' "$TAG" "$IPADDR" "$PROVIDER" "$status" printf '%12s / %-15s / %-13s: %s \n' "$TAG" "$IPADDR" "$PROVIDER" "$status"
echo "$BODY_SIZE" > "$FNAME.size" echo "$BODY_SIZE" > "$FNAME.size"
if [ $res != 100 ]; then if [ $res -lt 100 ]; then
URL=$( cat "$FNAME.url" ) URL=$( cat "$FNAME.url" )
echo "$FILENAME : $URL" >> "$FAIL_URL_LIST" echo "$FILENAME : $URL" >> "$FAIL_URL_LIST"
fi fi