mirror of
https://github.com/remittor/zapret-openwrt.git
synced 2025-12-06 03:26:49 +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();
|
||||
}
|
||||
|
||||
/* 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();
|
||||
map_promise.then(node => node.classList.add('fade-in'));
|
||||
return map_promise;
|
||||
|
||||
@@ -49,6 +49,10 @@ return baseclass.extend({
|
||||
iplstUserExcludeFN: '/opt/zapret/ipset/zapret-ip-user-exclude.txt',
|
||||
custFileMax : 4,
|
||||
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',
|
||||
autoHostListDbgFN : '/opt/zapret/ipset/zapret-hosts-auto-debug.log',
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"/opt/zapret/ipset/*": [ "read" ],
|
||||
"/etc/crontabs/root": [ "read" ],
|
||||
"/etc/init.d/zapret*": [ "exec" ],
|
||||
"/bin/ps*": [ "exec" ],
|
||||
"/bin/busybox*": [ "exec" ],
|
||||
"/bin/opkg*": [ "exec" ],
|
||||
"/usr/bin/apk*": [ "exec" ],
|
||||
@@ -22,7 +23,8 @@
|
||||
"write": {
|
||||
"file": {
|
||||
"/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" ]
|
||||
},
|
||||
"uci": [ "zapret" ]
|
||||
|
||||
Reference in New Issue
Block a user