feat: add selector proxy type support

This commit is contained in:
Andrey Petelin
2026-01-09 23:32:58 +05:00
parent a73def1f9a
commit d2fbff17bf
2 changed files with 62 additions and 9 deletions

View File

@@ -23,8 +23,9 @@ function createSectionContent(section) {
_("Select how to configure the proxy"),
);
o.value("url", _("Connection URL"));
o.value("outbound", _("Outbound Config"));
o.value("selector", _("Selector"));
o.value("urltest", _("URLTest"));
o.value("outbound", _("Outbound Config"));
o.default = "url";
o.depends("connection_type", "proxy");
@@ -32,7 +33,7 @@ function createSectionContent(section) {
form.TextValue,
"proxy_string",
_("Proxy Configuration URL"),
"",
_("vless://, ss://, trojan://, socks4/5://, hy2/hysteria2:// links")
);
o.depends("proxy_config_type", "url");
o.rows = 5;
@@ -42,7 +43,6 @@ function createSectionContent(section) {
o.textarea = true;
o.rmempty = false;
o.sectionDescriptions = new Map();
o.placeholder = "vless://uuid@server:port?type=tcp&security=tls#main";
o.validate = function (section_id, value) {
// Optional
if (!value || value.length === 0) {
@@ -81,13 +81,36 @@ function createSectionContent(section) {
return validation.message;
};
o = section.option(
form.DynamicList,
"selector_proxy_links",
_("Selector Proxy Links"),
_("vless://, ss://, trojan://, socks4/5://, hy2/hysteria2:// links")
);
o.depends("proxy_config_type", "selector");
o.rmempty = false;
o.validate = function (section_id, value) {
// Optional
if (!value || value.length === 0) {
return true;
}
const validation = main.validateProxyUrl(value);
if (validation.valid) {
return true;
}
return validation.message;
};
o = section.option(
form.DynamicList,
"urltest_proxy_links",
_("URLTest Proxy Links"),
_("vless://, ss://, trojan://, socks4/5://, hy2/hysteria2:// links")
);
o.depends("proxy_config_type", "urltest");
o.placeholder = "vless://, ss://, trojan://, socks4/5://, hy2/hysteria2:// links";
o.rmempty = false;
o.validate = function (section_id, value) {
// Optional