Add support for custom txt-configs

Example: /opt/zapret/ipset/cust1.txt
This commit is contained in:
remittor
2024-10-16 16:37:00 +03:00
parent 256c357554
commit 8940c4bfa7
7 changed files with 18 additions and 0 deletions

View File

@@ -247,6 +247,18 @@ return view.extend({
15
).show();
add_delim(s);
for (let num = 1; num <= tools.custFileMax; num++) {
let fn = tools.custFileTemplate.format(num.toString());
let name = _('Custom file #' + num);
o = s.taboption(tabname, form.Button, '_cust_file%d_btn'.format(num), name);
o.inputtitle = _('Edit');
o.inputstyle = 'edit btn';
o.description = fn;
o.onclick = () => new tools.fileEditDialog(fn, name, '', '', 15).show();
}
let map_promise = m.render();
map_promise.then(node => node.classList.add('fade-in'));
return map_promise;

View File

@@ -42,6 +42,8 @@ return baseclass.extend({
iplstExcludeFN : '/opt/zapret/ipset/zapret-ip-exclude.txt',
iplstUserFN : '/opt/zapret/ipset/zapret-ip-user.txt',
iplstUserExcludeFN: '/opt/zapret/ipset/zapret-ip-user-exclude.txt',
custFileMax : 4,
custFileTemplate : '/opt/zapret/ipset/cust%s.txt',
infoLabelStarting : '<span class="label-status starting">' + _('Starting') + '</span>',
infoLabelRunning : '<span class="label-status running">' + _('Enabled') + '</span>',

View File

@@ -85,6 +85,10 @@ define Package/$(PKG_NAME)/install
$(INSTALL_CONF) ./ipset/zapret-ip-user.txt $(1)/opt/zapret/ipset/zapret-ip-user.txt
$(INSTALL_CONF) ./ipset/zapret-ip-user-exclude.txt $(1)/opt/zapret/ipset/zapret-ip-user-exclude.txt
$(INSTALL_CONF) ./ipset/zapret-ip-user-ipban.txt $(1)/opt/zapret/ipset/zapret-ip-user-ipban.txt
$(INSTALL_CONF) ./ipset/cust1.txt $(1)/opt/zapret/ipset/cust1.txt
$(INSTALL_CONF) ./ipset/cust2.txt $(1)/opt/zapret/ipset/cust2.txt
$(INSTALL_CONF) ./ipset/cust3.txt $(1)/opt/zapret/ipset/cust3.txt
$(INSTALL_CONF) ./ipset/cust4.txt $(1)/opt/zapret/ipset/cust4.txt
$(INSTALL_BIN) ./sync_config.sh $(1)/opt/zapret/sync_config.sh
endef

0
zapret/ipset/cust1.txt Normal file
View File

0
zapret/ipset/cust2.txt Normal file
View File

0
zapret/ipset/cust3.txt Normal file
View File

0
zapret/ipset/cust4.txt Normal file
View File