feat: Add local subnet lists support with UI and backend integration (#156)

This commit is contained in:
Andrey Petelin
2025-09-05 21:23:55 +05:00
parent 5273935d25
commit 49836e4adc
6 changed files with 94 additions and 31 deletions

View File

@@ -370,7 +370,7 @@ function createConfigSection(section, map, network) {
o.rmempty = false;
o.ucisection = s.section;
o = s.taboption('basic', form.DynamicList, 'local_domain_lists', _('Local Domain Lists Path'), _('Enter the list file path'));
o = s.taboption('basic', form.DynamicList, 'local_domain_lists', _('Local Domain List Paths'), _('Enter the list file path'));
o.placeholder = '/path/file.lst';
o.depends('local_domain_lists_enabled', '1');
o.rmempty = false;
@@ -399,6 +399,25 @@ function createConfigSection(section, map, network) {
return validateUrl(value);
};
o = s.taboption('basic', form.Flag, 'local_subnet_lists_enabled', _('Local Subnet Lists'), _('Use the list from the router filesystem'));
o.default = '0';
o.rmempty = false;
o.ucisection = s.section;
o = s.taboption('basic', form.DynamicList, 'local_subnet_lists', _('Local Subnet List Paths'), _('Enter the list file path'));
o.placeholder = '/path/file.lst';
o.depends('local_subnet_lists_enabled', '1');
o.rmempty = false;
o.ucisection = s.section;
o.validate = function (section_id, value) {
if (!value || value.length === 0) return true;
const pathRegex = /^\/[a-zA-Z0-9_\-\/\.]+$/;
if (!pathRegex.test(value)) {
return _('Invalid path format. Path must start with "/" and contain valid characters');
}
return true;
};
o = s.taboption('basic', form.ListValue, 'user_subnet_list_type', _('User Subnet List Type'), _('Select how to add your custom subnets'));
o.value('disabled', _('Disabled'));
o.value('dynamic', _('Dynamic List'));

View File

@@ -97,8 +97,8 @@ msgstr "Локальные списки доменов"
msgid "Use the list from the router filesystem"
msgstr "Использовать список из файловой системы роутера"
msgid "Local Domain Lists Path"
msgstr "Путь к локальным спискам доменов"
msgid "Local Domain List Paths"
msgstr "Пути к локальным спискам доменов"
msgid "Enter to the list file path"
msgstr "Введите путь к файлу списка"
@@ -896,4 +896,10 @@ msgid "Delay in milliseconds before reloading podkop after interface UP"
msgstr "Задержка в миллисекундах перед перезагрузкой podkop после поднятия интерфейса"
msgid "Delay value cannot be empty"
msgstr "Значение не может быть пустым"
msgstr "Значение не может быть пустым"
msgid "Local Subnet Lists"
msgstr "Локальные списки подсетей"
msgid "Local Subnet List Paths"
msgstr "Пути к локальным спискам доменов"

View File

@@ -97,7 +97,7 @@ msgstr ""
msgid "Use the list from the router filesystem"
msgstr ""
msgid "Local Domain Lists Path"
msgid "Local Domain List Paths"
msgstr ""
msgid "Enter to the list file path"
@@ -1250,4 +1250,10 @@ msgid "Delay in milliseconds before reloading podkop after interface UP"
msgstr ""
msgid "Delay value cannot be empty"
msgstr ""
msgid "Local Subnet Lists"
msgstr ""
msgid "Local Subnet List Paths"
msgstr ""