mirror of
https://github.com/itdoginfo/podkop.git
synced 2025-12-08 12:36:50 +03:00
chore: remove comments support for proxy url
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -42,39 +42,20 @@ function createSectionContent(section) {
|
|||||||
o.textarea = true;
|
o.textarea = true;
|
||||||
o.rmempty = false;
|
o.rmempty = false;
|
||||||
o.sectionDescriptions = new Map();
|
o.sectionDescriptions = new Map();
|
||||||
o.placeholder =
|
o.placeholder = "vless://uuid@server:port?type=tcp&security=tls#main";
|
||||||
"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.validate = function (section_id, value) {
|
o.validate = function (section_id, value) {
|
||||||
// Optional
|
// Optional
|
||||||
if (!value || value.length === 0) {
|
if (!value || value.length === 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
const validation = main.validateProxyUrl(value);
|
||||||
const activeConfigs = main.splitProxyString(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) {
|
if (validation.valid) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return validation.message;
|
return validation.message;
|
||||||
} catch (e) {
|
|
||||||
return `${_("Invalid URL format:")} ${e?.message}`;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
o = section.option(
|
o = section.option(
|
||||||
|
|||||||
@@ -83,6 +83,43 @@ function createSettingsContent(section) {
|
|||||||
return true;
|
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(
|
o = section.option(
|
||||||
form.Flag,
|
form.Flag,
|
||||||
"enable_output_network_interface",
|
"enable_output_network_interface",
|
||||||
@@ -139,43 +176,6 @@ function createSettingsContent(section) {
|
|||||||
return !isWireless;
|
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(
|
o = section.option(
|
||||||
form.Flag,
|
form.Flag,
|
||||||
"enable_badwan_interface_monitoring",
|
"enable_badwan_interface_monitoring",
|
||||||
|
|||||||
Reference in New Issue
Block a user