refactor: switch UCI lookups from 'main' to 'settings', add routing_excluded_ips and relocate update_interval in UI

This commit is contained in:
Andrey Petelin
2025-10-10 13:22:30 +05:00
committed by divocat
parent 8a80df9dc0
commit ba91c180e8
3 changed files with 71 additions and 48 deletions

View File

@@ -167,18 +167,6 @@ function createSettingsContent(section) {
return true;
};
o = section.option(
form.ListValue,
'update_interval',
_('List Update Frequency'),
_('Select how often the lists will be updated'),
);
Object.entries(main.UPDATE_INTERVAL_OPTIONS).forEach(([key, label]) => {
o.value(key, _(label));
});
o.default = '1d';
o.rmempty = false;
o = section.option(
form.Flag,
'yacd',
@@ -197,6 +185,18 @@ function createSettingsContent(section) {
o.default = '0';
o.rmempty = false;
o = section.option(
form.ListValue,
'update_interval',
_('List Update Frequency'),
_('Select how often the lists will be updated'),
);
Object.entries(main.UPDATE_INTERVAL_OPTIONS).forEach(([key, label]) => {
o.value(key, _(label));
});
o.default = '1d';
o.rmempty = false;
o = section.option(
form.Flag,
'detour',
@@ -272,6 +272,29 @@ function createSettingsContent(section) {
);
o.default = '0';
o.rmempty = false;
o = section.option(
form.DynamicList,
'routing_excluded_ips',
_('Routing Excluded IPs'),
_('Specify a local IP address to be excluded from routing'),
);
o.placeholder = 'IP';
o.rmempty = true;
o.validate = function (section_id, value) {
// Optional
if (!value || value.length === 0) {
return true;
}
const validation = main.validateIPV4(value);
if (validation.valid) {
return true;
}
return validation.message;
};
}
const EntryPoint = {