mirror of
https://github.com/remittor/zapret-openwrt.git
synced 2025-12-10 21:46:50 +03:00
luci: Add support custom.d scripts
This commit is contained in:
@@ -320,6 +320,23 @@ return view.extend({
|
|||||||
o.onclick = () => new tools.fileEditDialog(fn, name, '', '', 15).show();
|
o.onclick = () => new tools.fileEditDialog(fn, name, '', '', 15).show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* custom.d files */
|
||||||
|
|
||||||
|
tabname = 'custom_d_tab';
|
||||||
|
s.tab(tabname, 'custom.d');
|
||||||
|
|
||||||
|
for (let i = 0; i < tools.customdPrefixList.length; i++) {
|
||||||
|
let num = tools.customdPrefixList[i];
|
||||||
|
let fn = tools.customdFileFormat.format(num.toString());
|
||||||
|
let name = _('custom.d script #' + num);
|
||||||
|
o = s.taboption(tabname, form.Button, '_customd_file%d_btn'.format(num), name);
|
||||||
|
o.inputtitle = _('Edit');
|
||||||
|
o.inputstyle = 'edit btn';
|
||||||
|
o.description = fn;
|
||||||
|
let desc = (num == tools.discord_num) ? _('Example') + ': <a href=%s>%s</a>'.format(tools.discord_url) : '';
|
||||||
|
o.onclick = () => new tools.fileEditDialog(fn, name, desc, '', 15).show();
|
||||||
|
}
|
||||||
|
|
||||||
let map_promise = m.render();
|
let map_promise = m.render();
|
||||||
map_promise.then(node => node.classList.add('fade-in'));
|
map_promise.then(node => node.classList.add('fade-in'));
|
||||||
return map_promise;
|
return map_promise;
|
||||||
|
|||||||
@@ -49,6 +49,10 @@ return baseclass.extend({
|
|||||||
iplstUserExcludeFN: '/opt/zapret/ipset/zapret-ip-user-exclude.txt',
|
iplstUserExcludeFN: '/opt/zapret/ipset/zapret-ip-user-exclude.txt',
|
||||||
custFileMax : 4,
|
custFileMax : 4,
|
||||||
custFileTemplate : '/opt/zapret/ipset/cust%s.txt',
|
custFileTemplate : '/opt/zapret/ipset/cust%s.txt',
|
||||||
|
customdPrefixList : [ 10, 20, 50, 60, 90 ] ,
|
||||||
|
customdFileFormat : '/opt/zapret/init.d/openwrt/custom.d/%s-script.sh',
|
||||||
|
discord_num : 50,
|
||||||
|
discord_url : 'https://github.com/bol-van/zapret/blob/master/init.d/custom.d.examples.linux/50-discord',
|
||||||
|
|
||||||
autoHostListFN : '/opt/zapret/ipset/zapret-hosts-auto.txt',
|
autoHostListFN : '/opt/zapret/ipset/zapret-hosts-auto.txt',
|
||||||
autoHostListDbgFN : '/opt/zapret/ipset/zapret-hosts-auto-debug.log',
|
autoHostListDbgFN : '/opt/zapret/ipset/zapret-hosts-auto-debug.log',
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
"/opt/zapret/ipset/*": [ "read" ],
|
"/opt/zapret/ipset/*": [ "read" ],
|
||||||
"/etc/crontabs/root": [ "read" ],
|
"/etc/crontabs/root": [ "read" ],
|
||||||
"/etc/init.d/zapret*": [ "exec" ],
|
"/etc/init.d/zapret*": [ "exec" ],
|
||||||
|
"/bin/ps*": [ "exec" ],
|
||||||
"/bin/busybox*": [ "exec" ],
|
"/bin/busybox*": [ "exec" ],
|
||||||
"/bin/opkg*": [ "exec" ],
|
"/bin/opkg*": [ "exec" ],
|
||||||
"/usr/bin/apk*": [ "exec" ],
|
"/usr/bin/apk*": [ "exec" ],
|
||||||
@@ -22,7 +23,8 @@
|
|||||||
"write": {
|
"write": {
|
||||||
"file": {
|
"file": {
|
||||||
"/opt/zapret/config": [ "write" ],
|
"/opt/zapret/config": [ "write" ],
|
||||||
"/opt/zapret/ipset/*.txt": [ "write" ],
|
"/opt/zapret/ipset/*": [ "write" ],
|
||||||
|
"/opt/zapret/init.d/openwrt/custom.d/*": [ "write" ],
|
||||||
"/etc/crontabs/root": [ "write" ]
|
"/etc/crontabs/root": [ "write" ]
|
||||||
},
|
},
|
||||||
"uci": [ "zapret" ]
|
"uci": [ "zapret" ]
|
||||||
|
|||||||
Reference in New Issue
Block a user