From b71c7b379d423a4e3ccea1400d723fbcf2e7e110 Mon Sep 17 00:00:00 2001 From: divocat Date: Thu, 2 Oct 2025 23:30:28 +0300 Subject: [PATCH] refactor: change Source Network Interface filter logic --- .../resources/view/podkop/additionalTab.js | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/luci-app-podkop/htdocs/luci-static/resources/view/podkop/additionalTab.js b/luci-app-podkop/htdocs/luci-static/resources/view/podkop/additionalTab.js index aa07a8a..eca4b4d 100644 --- a/luci-app-podkop/htdocs/luci-static/resources/view/podkop/additionalTab.js +++ b/luci-app-podkop/htdocs/luci-static/resources/view/podkop/additionalTab.js @@ -131,20 +131,29 @@ function createAdditionalSection(mainSection) { o.noinactive = false; o.multiple = true; o.filter = function (section_id, value) { - if (['wan', 'phy0-ap0', 'phy1-ap0', 'pppoe-wan'].indexOf(value) !== -1) { + // Block specific interface names from being selectable + const blocked = ['wan', 'phy0-ap0', 'phy1-ap0', 'pppoe-wan']; + if (blocked.includes(value)) { return false; } - var device = this.devices.filter(function (dev) { - return dev.getName() === value; - })[0]; + // Try to find the device object by its name + const device = this.devices.find(dev => dev.getName() === value); - if (device) { - var type = device.getType(); - return type !== 'wifi' && type !== 'wireless' && !type.includes('wlan'); + // If no device is found, allow the value + if (!device) { + return true; } - return true; + // Check the type of the device + const type = device.getType(); + + // Consider any Wi-Fi / wireless / wlan device as invalid + const isWireless = + type === 'wifi' || type === 'wireless' || type.includes('wlan'); + + // Allow only non-wireless devices + return !isWireless; }; o = mainSection.taboption('additional', form.Flag, 'mon_restart_ifaces', _('Interface monitoring'), _('Interface monitoring for bad WAN'));