Skip to content

Commit

Permalink
Add support for custom txt-configs
Browse files Browse the repository at this point in the history
Example: /opt/zapret/ipset/cust1.txt
  • Loading branch information
remittor committed Oct 16, 2024
1 parent 256c357 commit 8940c4b
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>',
Expand Down
4 changes: 4 additions & 0 deletions zapret/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Empty file added zapret/ipset/cust1.txt
Empty file.
Empty file added zapret/ipset/cust2.txt
Empty file.
Empty file added zapret/ipset/cust3.txt
Empty file.
Empty file added zapret/ipset/cust4.txt
Empty file.

0 comments on commit 8940c4b

Please sign in to comment.