chore: remove comments support for proxy url

This commit is contained in:
divocat
2025-10-21 11:32:29 +03:00
parent e8a5d3d5cc
commit b78682919a
3 changed files with 874 additions and 791 deletions

View File

@@ -42,39 +42,20 @@ function createSectionContent(section) {
o.textarea = true;
o.rmempty = false;
o.sectionDescriptions = new Map();
o.placeholder =
"vless://uuid@server:port?type=tcp&security=tls#main\n// backup ss://method:pass@server:port\n// backup2 vless://uuid@server:port?type=grpc&security=reality#alt\n// backup3 trojan://04agAQapcl@127.0.0.1:33641?type=tcp&security=none#trojan-tcp-none \n// socks5://127.0.0.1:1080";
o.placeholder = "vless://uuid@server:port?type=tcp&security=tls#main";
o.validate = function (section_id, value) {
// Optional
if (!value || value.length === 0) {
return true;
}
try {
const activeConfigs = main.splitProxyString(value);
const validation = main.validateProxyUrl(value);
if (!activeConfigs.length) {
return _(
"No active configuration found. One configuration is required.",
);
}
if (activeConfigs.length > 1) {
return _(
"Multiply active configurations found. Please leave one configuration.",
);
}
const validation = main.validateProxyUrl(activeConfigs[0]);
if (validation.valid) {
return true;
}
return validation.message;
} catch (e) {
return `${_("Invalid URL format:")} ${e?.message}`;
if (validation.valid) {
return true;
}
return validation.message;
};
o = section.option(

View File

@@ -83,6 +83,43 @@ function createSettingsContent(section) {
return true;
};
o = section.option(
widgets.DeviceSelect,
"source_network_interfaces",
_("Source Network Interface"),
_("Select the network interface from which the traffic will originate"),
);
o.default = "br-lan";
o.noaliases = true;
o.nobridges = false;
o.noinactive = false;
o.multiple = true;
o.filter = function (section_id, value) {
// Block specific interface names from being selectable
const blocked = ["wan", "phy0-ap0", "phy1-ap0", "pppoe-wan"];
if (blocked.includes(value)) {
return false;
}
// Try to find the device object by its name
const device = this.devices.find((dev) => dev.getName() === value);
// If no device is found, allow the value
if (!device) {
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 = section.option(
form.Flag,
"enable_output_network_interface",
@@ -139,43 +176,6 @@ function createSettingsContent(section) {
return !isWireless;
};
o = section.option(
widgets.DeviceSelect,
"source_network_interfaces",
_("Source Network Interface"),
_("Select the network interface from which the traffic will originate"),
);
o.default = "br-lan";
o.noaliases = true;
o.nobridges = false;
o.noinactive = false;
o.multiple = true;
o.filter = function (section_id, value) {
// Block specific interface names from being selectable
const blocked = ["wan", "phy0-ap0", "phy1-ap0", "pppoe-wan"];
if (blocked.includes(value)) {
return false;
}
// Try to find the device object by its name
const device = this.devices.find((dev) => dev.getName() === value);
// If no device is found, allow the value
if (!device) {
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 = section.option(
form.Flag,
"enable_badwan_interface_monitoring",