luci: Add examples for custom.d scripts

This commit is contained in:
remittor
2025-09-23 12:09:18 +03:00
parent 7941f12c63
commit 1b2057f00f
2 changed files with 15 additions and 2 deletions

View File

@@ -363,7 +363,16 @@ return view.extend({
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) : '';
let desc = '';
if (num == tools.discord_num) {
desc = _('Example') + ': ';
for (let k = 0; k < tools.discord_url.length; k++) {
let url = tools.discord_url[k];
if (k > 0) desc += ' <br> ';
const filename = url.substring(url.lastIndexOf("/") + 1).split("?")[0];
desc += '<a href=' + url + '>' + filename + '</a>';
}
}
o.onclick = () => new tools.fileEditDialog(fn, name, desc, '', 15).show();
}

View File

@@ -52,7 +52,11 @@ return baseclass.extend({
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/4e8e3a9ed9dbeb1156db68dfaa7b353051c13797/init.d/custom.d.examples.linux/50-discord',
discord_url : [ 'https://github.com/bol-van/zapret/blob/4e8e3a9ed9dbeb1156db68dfaa7b353051c13797/init.d/custom.d.examples.linux/50-discord',
'https://github.com/bol-van/zapret/blob/b251ea839cc8f04c45090314ef69fce69f2c00f2/init.d/custom.d.examples.linux/50-discord-media',
'https://github.com/bol-van/zapret/blob/b251ea839cc8f04c45090314ef69fce69f2c00f2/init.d/custom.d.examples.linux/50-stun4all',
'https://github.com/bol-van/zapret/tree/master/init.d/custom.d.examples.linux'
],
nfqws_opt_url : 'https://github.com/remittor/zapret-openwrt/discussions/168',
autoHostListFN : '/opt/zapret/ipset/zapret-hosts-auto.txt',