From 79f161389e46ecfcd738038b948f64c20b71aca9 Mon Sep 17 00:00:00 2001 From: kenzok8 Date: Sat, 10 May 2025 20:38:54 +0800 Subject: [PATCH] update 2025-05-10 20:38:54 --- .../resources/view/fchomo/client.js | 18 ------ .../luci-static/resources/view/fchomo/node.js | 59 +++++++++++-------- .../resources/view/fchomo/server.js | 28 +++++++++ luci-app-fchomo/po/templates/fchomo.pot | 4 ++ luci-app-fchomo/po/zh_Hans/fchomo.po | 4 ++ luci-app-fchomo/po/zh_Hant/fchomo.po | 4 ++ luci-app-fchomo/root/etc/init.d/fchomo | 1 + .../root/usr/share/fchomo/generate_client.uc | 2 +- .../root/usr/share/fchomo/generate_server.uc | 20 +++++++ mihomo/Makefile | 4 +- 10 files changed, 99 insertions(+), 45 deletions(-) diff --git a/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/client.js b/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/client.js index ef077ca02..4f8916618 100644 --- a/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/client.js +++ b/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/client.js @@ -968,24 +968,6 @@ return view.extend({ so.default = so.disabled; so.modalonly = true; - // Deprecated - so = ss.taboption('field_override', widgets.DeviceSelect, 'interface_name', _('Bind interface'), - _('Bind outbound interface.
') + - _('Priority: Proxy Node > Global.') + '
' + - _('Option is deprecated, please use the same option in proxy node.')); - so.multiple = false; - so.noaliases = true; - so.readonly = true; - so.modalonly = true; - - // Deprecated - so = ss.taboption('field_override', form.Value, 'routing_mark', _('Routing mark'), - _('Priority: Proxy Node > Global.') + '
' + - _('Option is deprecated, please use the same option in proxy node.')); - so.datatype = 'uinteger'; - so.readonly = true; - so.modalonly = true; - /* Health fields */ /* Url-test/Fallback/Load-balance */ so = ss.taboption('field_health', form.Value, 'url', _('Health check URL')); diff --git a/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/node.js b/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/node.js index cd49e809b..e3624f4eb 100644 --- a/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/node.js +++ b/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/node.js @@ -490,6 +490,7 @@ return view.extend({ so.modalonly = true; so = ss.taboption('field_general', form.Value, 'plugin_opts_host', _('Plugin: ') + _('Host that supports TLS 1.3')); + so.datatype = 'hostname'; so.placeholder = 'cloud.tencent.com'; so.rmempty = false; so.depends({plugin: /^(obfs|v2ray-plugin|shadow-tls|restls)$/}); @@ -547,7 +548,6 @@ return view.extend({ so.validate = function(section_id, value) { const type = this.section.getOption('type').formvalue(section_id); let tls = this.section.getUIElement(section_id, 'tls').node.querySelector('input'); - let tls_alpn = this.section.getUIElement(section_id, 'tls_alpn'); // Force enabled if (['trojan', 'anytls', 'hysteria', 'hysteria2', 'tuic'].includes(type)) { @@ -557,29 +557,6 @@ return view.extend({ tls.disabled = null; } - // Default alpn - if (!`${tls_alpn.getValue()}`) { - let def_alpn; - - switch (type) { - case 'hysteria': - case 'hysteria2': - case 'tuic': - def_alpn = ['h3']; - break; - case 'vmess': - case 'vless': - case 'trojan': - case 'anytls': - def_alpn = ['h2', 'http/1.1']; - break; - default: - def_alpn = []; - } - - tls_alpn.setValue(def_alpn); - } - return true; } so.depends({type: /^(http|socks5|vmess|vless|trojan|anytls|hysteria|hysteria2|tuic)$/}); @@ -599,7 +576,41 @@ return view.extend({ so = ss.taboption('field_tls', form.DynamicList, 'tls_alpn', _('TLS ALPN'), _('List of supported application level protocols, in order of preference.')); + so.validate = function(section_id, value) { + const type = this.section.getOption('type').formvalue(section_id); + //const plugin = this.section.getOption('plugin').formvalue(section_id); + let tls_alpn = this.section.getUIElement(section_id, 'tls_alpn'); + + // Default alpn + if (!`${tls_alpn.getValue()}`) { + let def_alpn; + + switch (type) { + case 'ss': + def_alpn = ['h2', 'http/1.1']; // when plugin === 'shadow-tls' + break; + case 'hysteria': + case 'hysteria2': + case 'tuic': + def_alpn = ['h3']; + break; + case 'vmess': + case 'vless': + case 'trojan': + case 'anytls': + def_alpn = ['h2', 'http/1.1']; + break; + default: + def_alpn = []; + } + + tls_alpn.setValue(def_alpn); + } + + return true; + } so.depends({tls: '1', type: /^(vmess|vless|trojan|anytls|hysteria|hysteria2|tuic)$/}); + so.depends({type: 'ss', plugin: 'shadow-tls'}); so.modalonly = true; so = ss.taboption('field_tls', form.Value, 'tls_fingerprint', _('Cert fingerprint'), diff --git a/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/server.js b/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/server.js index d3a131ece..5cb36b56a 100644 --- a/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/server.js +++ b/luci-app-fchomo/htdocs/luci-static/resources/view/fchomo/server.js @@ -259,6 +259,34 @@ return view.extend({ o.depends('type', 'vmess'); o.modalonly = true; + /* Plugin fields */ + o = s.taboption('field_general', form.ListValue, 'plugin', _('Plugin')); + o.value('', _('none')); + o.value('shadow-tls', _('shadow-tls')); + o.depends('type', 'shadowsocks'); + o.modalonly = true; + + o = s.taboption('field_general', form.Value, 'plugin_opts_handshake_dest', _('Plugin: ') + _('Handshake target that supports TLS 1.3')); + o.datatype = 'hostport'; + o.placeholder = 'cloud.tencent.com:443'; + o.rmempty = false; + o.depends({plugin: 'shadow-tls'}); + o.modalonly = true; + + o = s.taboption('field_general', form.Value, 'plugin_opts_thetlspassword', _('Plugin: ') + _('Password')); + o.password = true; + o.rmempty = false; + o.depends({plugin: 'shadow-tls'}); + o.modalonly = true; + + o = s.taboption('field_general', form.ListValue, 'plugin_opts_shadowtls_version', _('Plugin: ') + _('Version')); + o.value('1', _('v1')); + o.value('2', _('v2')); + o.value('3', _('v3')); + o.default = '3'; + o.depends({plugin: 'shadow-tls'}); + o.modalonly = true; + /* Extra fields */ o = s.taboption('field_general', form.Flag, 'udp', _('UDP')); o.default = o.disabled; diff --git a/luci-app-fchomo/po/templates/fchomo.pot b/luci-app-fchomo/po/templates/fchomo.pot index 4b0540700..636af0977 100644 --- a/luci-app-fchomo/po/templates/fchomo.pot +++ b/luci-app-fchomo/po/templates/fchomo.pot @@ -993,6 +993,10 @@ msgstr "" msgid "Handle domain" msgstr "" +#: htdocs/luci-static/resources/view/fchomo/server.js:269 +msgid "Handshake target that supports TLS 1.3" +msgstr "" + #: htdocs/luci-static/resources/view/fchomo/client.js:723 #: htdocs/luci-static/resources/view/fchomo/node.js:1018 msgid "Health check URL" diff --git a/luci-app-fchomo/po/zh_Hans/fchomo.po b/luci-app-fchomo/po/zh_Hans/fchomo.po index ccb97fedd..2ca78153f 100644 --- a/luci-app-fchomo/po/zh_Hans/fchomo.po +++ b/luci-app-fchomo/po/zh_Hans/fchomo.po @@ -1013,6 +1013,10 @@ msgstr "" msgid "Handle domain" msgstr "处理域名" +#: htdocs/luci-static/resources/view/fchomo/server.js:269 +msgid "Handshake target that supports TLS 1.3" +msgstr "握手目标 (支援 TLS 1.3)" + #: htdocs/luci-static/resources/view/fchomo/client.js:723 #: htdocs/luci-static/resources/view/fchomo/node.js:1018 msgid "Health check URL" diff --git a/luci-app-fchomo/po/zh_Hant/fchomo.po b/luci-app-fchomo/po/zh_Hant/fchomo.po index 5ddc2c8ae..d9b8f3215 100644 --- a/luci-app-fchomo/po/zh_Hant/fchomo.po +++ b/luci-app-fchomo/po/zh_Hant/fchomo.po @@ -1013,6 +1013,10 @@ msgstr "" msgid "Handle domain" msgstr "處理網域" +#: htdocs/luci-static/resources/view/fchomo/server.js:269 +msgid "Handshake target that supports TLS 1.3" +msgstr "握手目標 (支援 TLS 1.3)" + #: htdocs/luci-static/resources/view/fchomo/client.js:723 #: htdocs/luci-static/resources/view/fchomo/node.js:1018 msgid "Health check URL" diff --git a/luci-app-fchomo/root/etc/init.d/fchomo b/luci-app-fchomo/root/etc/init.d/fchomo index dfb4eb623..9e0fabda6 100755 --- a/luci-app-fchomo/root/etc/init.d/fchomo +++ b/luci-app-fchomo/root/etc/init.d/fchomo @@ -248,6 +248,7 @@ start_service() { procd_set_param command /bin/sh procd_append_param command -c "'$PROG' -d '$HM_DIR' -f '$RUN_DIR/mihomo-c.yaml' >> '$RUN_DIR/mihomo-c.log' 2>&1" + procd_set_param env SAFE_PATHS="$RUN_DIR/" # The syntax of this environment variable is the same as the PATH environment variable parsing rules of this operating system (i.e., semicolon-separated under Windows and colon-separated under other systems) # Only supports `Global`` and does not support `Proxy Group` and `Proxy Node` local bind_ifname diff --git a/luci-app-fchomo/root/usr/share/fchomo/generate_client.uc b/luci-app-fchomo/root/usr/share/fchomo/generate_client.uc index 48fad94f9..032c44f96 100644 --- a/luci-app-fchomo/root/usr/share/fchomo/generate_client.uc +++ b/luci-app-fchomo/root/usr/share/fchomo/generate_client.uc @@ -566,7 +566,7 @@ uci.foreach(uciconf, ucinode, (cfg) => { mode: cfg.plugin_opts_obfsmode, host: cfg.plugin_opts_host, password: cfg.plugin_opts_thetlspassword, - version: cfg.plugin_opts_shadowtls_version, + version: strToInt(cfg.plugin_opts_shadowtls_version), "version-hint": cfg.plugin_opts_restls_versionhint, "restls-script": cfg.plugin_opts_restls_script } : null, diff --git a/luci-app-fchomo/root/usr/share/fchomo/generate_server.uc b/luci-app-fchomo/root/usr/share/fchomo/generate_server.uc index 951aed359..dcebf1a91 100644 --- a/luci-app-fchomo/root/usr/share/fchomo/generate_server.uc +++ b/luci-app-fchomo/root/usr/share/fchomo/generate_server.uc @@ -102,6 +102,26 @@ uci.foreach(uciconf, uciserver, (cfg) => { /* AnyTLS */ "padding-scheme": cfg.anytls_padding_scheme, + /* Plugin fields */ + ...(cfg.plugin ? { + // shadow-tls + "shadow-tls": cfg.plugin === 'shadow-tls' ? { + enable: true, + version: strToInt(cfg.plugin_opts_shadowtls_version), + ...(strToInt(cfg.plugin_opts_shadowtls_version) >= 3 ? { + users: [ + { + name: 1, + password: cfg.plugin_opts_thetlspassword + } + ], + } : { password: cfg.plugin_opts_thetlspassword }), + handshake: { + dest: cfg.plugin_opts_handshake_dest + }, + } : null + } : {}), + /* Extra fields */ udp: strToBool(cfg.udp), diff --git a/mihomo/Makefile b/mihomo/Makefile index 675f6bbe4..8735ee3b8 100644 --- a/mihomo/Makefile +++ b/mihomo/Makefile @@ -5,12 +5,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mihomo -PKG_VERSION:=1.19.5 +PKG_VERSION:=1.19.6 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://codeload.github.com/metacubex/mihomo/tar.gz/v$(PKG_VERSION)? -PKG_HASH:=2c40a5b53cc500b846cf966f21eeacea070a4377833e7dff07b63a53f7213db8 +PKG_HASH:=dec17f340decaa7971117ba908e39e4a9e311e8012dad9200bd517bdd405f1cf PKG_MAINTAINER:=Anya Lin PKG_LICENSE:=GPL-2.0