mirror of
https://github.com/itdoginfo/podkop.git
synced 2025-12-12 22:46:58 +03:00
refactor: change Network Interface filter logic
This commit is contained in:
@@ -213,20 +213,39 @@ function createConfigSection(section, map, network) {
|
|||||||
o.nobridges = false;
|
o.nobridges = false;
|
||||||
o.noinactive = false;
|
o.noinactive = false;
|
||||||
o.filter = function (section_id, value) {
|
o.filter = function (section_id, value) {
|
||||||
if (['br-lan', 'eth0', 'eth1', 'wan', 'phy0-ap0', 'phy1-ap0', 'pppoe-wan', 'lan'].indexOf(value) !== -1) {
|
// Blocked interface names that should never be selectable
|
||||||
|
const blockedInterfaces = [
|
||||||
|
'br-lan',
|
||||||
|
'eth0',
|
||||||
|
'eth1',
|
||||||
|
'wan',
|
||||||
|
'phy0-ap0',
|
||||||
|
'phy1-ap0',
|
||||||
|
'pppoe-wan',
|
||||||
|
'lan',
|
||||||
|
];
|
||||||
|
|
||||||
|
// Reject immediately if the value matches any blocked interface
|
||||||
|
if (blockedInterfaces.includes(value)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var device = this.devices.filter(function (dev) {
|
// Try to find the device object with the given name
|
||||||
return dev.getName() === value;
|
const device = this.devices.find(dev => dev.getName() === value);
|
||||||
})[0];
|
|
||||||
|
|
||||||
if (device) {
|
// If no device is found, allow the value
|
||||||
var type = device.getType();
|
if (!device) {
|
||||||
return type !== 'wifi' && type !== 'wireless' && !type.includes('wlan');
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
// Get the device type (e.g., "wifi", "ethernet", etc.)
|
||||||
|
const type = device.getType();
|
||||||
|
|
||||||
|
// Reject wireless-related devices
|
||||||
|
const isWireless =
|
||||||
|
type === 'wifi' || type === 'wireless' || type.includes('wlan');
|
||||||
|
|
||||||
|
return !isWireless;
|
||||||
};
|
};
|
||||||
|
|
||||||
o = s.taboption('basic', form.Flag, 'domain_resolver_enabled', _('Domain Resolver'), _('Enable built-in DNS resolver for domains handled by this section'));
|
o = s.taboption('basic', form.Flag, 'domain_resolver_enabled', _('Domain Resolver'), _('Enable built-in DNS resolver for domains handled by this section'));
|
||||||
|
|||||||
Reference in New Issue
Block a user