diff --git a/backend/package.json b/backend/package.json index f1418eaf..6e09b353 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "sub-store", - "version": "2.39.7", + "version": "2.39.8", "description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and Shadowrocket.", "main": "src/main.js", "packageManager": "pnpm@11.0.9", diff --git a/backend/src/core/proxy-utils/parsers/peggy/loon.js b/backend/src/core/proxy-utils/parsers/peggy/loon.js index 5b2d6112..d80ca676 100644 --- a/backend/src/core/proxy-utils/parsers/peggy/loon.js +++ b/backend/src/core/proxy-utils/parsers/peggy/loon.js @@ -63,6 +63,7 @@ const grammars = String.raw` function loonClientFingerprint(tlsProfile) { switch (String(tlsProfile || "").trim()) { case "chrome": + case "chrome147": return "chrome"; case "ios18": case "ios26": diff --git a/backend/src/core/proxy-utils/producers/loon.js b/backend/src/core/proxy-utils/producers/loon.js index b2895027..e6e3a221 100644 --- a/backend/src/core/proxy-utils/producers/loon.js +++ b/backend/src/core/proxy-utils/producers/loon.js @@ -124,13 +124,15 @@ function getLoonAlpn(proxy) { function getLoonTlsProfile(proxy) { const tlsProfile = `${proxy._loon_tls_profile || ''}`.trim(); - if (['default', 'chrome', 'ios18', 'ios26'].includes(tlsProfile)) { + if ( + ['default', 'chrome', 'chrome147', 'ios18', 'ios26'].includes(tlsProfile) + ) { return tlsProfile; } switch (`${proxy['client-fingerprint'] || ''}`.trim()) { case 'chrome': - return 'chrome'; + return 'chrome147'; case 'ios': return 'ios26'; } diff --git a/backend/src/test/proxy-parsers/v2ray-and-platforms.spec.js b/backend/src/test/proxy-parsers/v2ray-and-platforms.spec.js index 34187ac4..94f4541f 100644 --- a/backend/src/test/proxy-parsers/v2ray-and-platforms.spec.js +++ b/backend/src/test/proxy-parsers/v2ray-and-platforms.spec.js @@ -3378,6 +3378,7 @@ describe('Platform raw-format parser coverage', function () { const cases = [ ['default'], ['chrome', 'chrome'], + ['chrome147', 'chrome'], ['ios18', 'ios'], ['ios26', 'ios'], ]; diff --git a/backend/src/test/proxy-producers/structured.spec.js b/backend/src/test/proxy-producers/structured.spec.js index 7196c5ef..9afc8cfd 100644 --- a/backend/src/test/proxy-producers/structured.spec.js +++ b/backend/src/test/proxy-producers/structured.spec.js @@ -95,16 +95,27 @@ describe('Proxy structured producers', function () { }); it('normalizes Loon tls-profile before emitting Mihomo client fingerprints', function () { - const [proxy] = ProxyUtils.parse( - `Loon IOS26=vmess,loon-ios26.example.com,443,auto,"${UUID}",over-tls=true,tls-profile=ios26,alterId=0`, - ); - const output = loadProducedYaml('Mihomo', proxy); + for (const [profile, fingerprint] of [ + ['ios26', 'ios'], + ['chrome147', 'chrome'], + ]) { + const [proxy] = ProxyUtils.parse( + `Loon ${profile}=vmess,loon-${profile}.example.com,443,auto,"${UUID}",over-tls=true,tls-profile=${profile},alterId=0`, + ); + const output = loadProducedYaml('Mihomo', proxy); + const internal = produceInternal('Mihomo', proxy); - expect(proxy._loon_tls_profile).to.equal('ios26'); - expect(proxy['client-fingerprint']).to.equal('ios'); - expect(output.proxies[0]['client-fingerprint']).to.equal('ios'); - expect(output.proxies[0]['client-fingerprint']).to.not.equal('ios26'); - expect(output.proxies[0]).to.not.have.property('_loon_tls_profile'); + expect(proxy._loon_tls_profile).to.equal(profile); + expect(proxy['client-fingerprint']).to.equal(fingerprint); + expect(output.proxies[0]['client-fingerprint']).to.equal( + fingerprint, + ); + expect(output.proxies[0]).to.not.have.property('_loon_tls_profile'); + expect(internal[0]._loon_tls_profile).to.equal(profile); + expect(produceExternal('Loon', internal)).to.include( + `tls-profile=${profile}`, + ); + } }); it('defaults omitted UDP to true while preserving explicit disablement', function () { diff --git a/backend/src/test/proxy-producers/text.spec.js b/backend/src/test/proxy-producers/text.spec.js index 90944909..7de9990c 100644 --- a/backend/src/test/proxy-producers/text.spec.js +++ b/backend/src/test/proxy-producers/text.spec.js @@ -773,7 +773,7 @@ describe('Proxy text producers', function () { }, ]); - expect(output.match(/tls-profile=chrome/g)).to.have.length(9); + expect(output.match(/tls-profile=chrome147(?=,|$)/gm)).to.have.length(9); expect(output.match(/alpn="http\/1\.1,h2,h3"/g)).to.have.length(9); }); @@ -799,6 +799,10 @@ describe('Proxy text producers', function () { _loon_tls_profile: 'chrome', 'client-fingerprint': 'ios', }), + buildTrojan('Loon Source Chrome147', { + _loon_tls_profile: 'chrome147', + 'client-fingerprint': 'ios', + }), buildTrojan('Loon Fallback Chrome', { 'client-fingerprint': 'chrome', }), @@ -810,9 +814,10 @@ describe('Proxy text producers', function () { expect(output).to.include('Loon Source IOS18=trojan'); expect(output).to.include('tls-profile=ios18'); expect(output).to.include('tls-profile=default'); - expect(output).to.include('tls-profile=chrome'); + expect(output).to.match(/tls-profile=chrome(?=,|$)/m); + expect(output.match(/tls-profile=chrome147(?=,|$)/gm)).to.have.length(2); expect(output).to.include('tls-profile=ios26'); - expect(output.match(/tls-profile=/g)).to.have.length(5); + expect(output.match(/tls-profile=/g)).to.have.length(6); }); it('omits invalid Loon tls-profile fallback values', function () { diff --git a/scripts/demo.js b/scripts/demo.js index cf3d0351..7bb7eac7 100644 --- a/scripts/demo.js +++ b/scripts/demo.js @@ -52,7 +52,7 @@ function operator(proxies = [], targetPlatform, context) { // 28. sing-box 1.14.0 起才有 `control_http_client` , 暂时可使用 `control-http-client` 字段设置 sing-box 的 `control_http_client` // 若 `control-http-client` 非空, 输出 sing-box Tailscale endpoint 时会跳过旧版拨号字段映射, 避免和 `detour`/`dialer-proxy` 等 legacy dialer options 冲突. 需要给控制面设置前置代理时, 请写到 `control-http-client.detour`(1.14.0-alpha.26 又改回去了...) // 29. sing-box 支持使用 `ssh-server` 给 tailscale 设置 `ssh_server`, 直接设为 `true` 或 `{ "enabled": true, "disable-pty": true, "disable-sftp": true, "disable-forwarding": true }` - // 30. Loon 支持使用 `_loon_tls_profile` 设置 `tls-profile` 字段('default', 'chrome', 'ios18', 'ios26'), 否则则使用 client-fingerprint 自动转换部分对应的值 + // 30. Loon 支持使用 `_loon_tls_profile` 设置 `tls-profile` 字段('default', 'chrome', 'chrome147', 'ios18', 'ios26'), 优先使用该字段, 否则从 client-fingerprint 自动转换: chrome -> chrome147, ios -> ios26. Loon 输入 chrome147 时, client-fingerprint 转成 chrome, `_loon_tls_profile` 保留原始值 chrome147 // 31. `shadow-tls-password`/`shadow-tls-sni`/`shadow-tls-version` 这套旧字段已废弃. 请使用 `plugin: 'shadow-tls'` 和 `plugin-opts: { password, host, version }` // 32. mihomo 中 Snell shadow-tls 字段与 ss shadow-tls 字段不同, 使用的是 obfs-opts 而不是 plugin+plugin-opts, 不能与 obfs http/tls 共存. Sub-Store 内部有字段转换, 建议直接使用单行 Surge 格式 `1=snell,a.com,443,version=4,psk="1",obfs=http,obfs-host=a.com,shadow-tls-password="1",shadow-tls-sni=a.com,shadow-tls-version=3,alpn="http/1.1,h2",reuse=true` . 若想使用 JSON/JSON5/YAML 单行格式输入, 可使用 `{ "name": "1", "server": "a.com", "port": 443, "psk": "1", "version": 4, "reuse": true, "type": "snell", "obfs-opts": { "mode": "http", "host": "a.com" }, "plugin": "shadow-tls", "plugin-opts": { "host": "a.com", "password": "1", "version": 3, "alpn": [ "http/1.1", "h2" ] } }` // 33. sing-box Snell 出站默认允许 version 4/5/6, 其中 version 5 会按 sing-box 行为输出成 version 4. 开启“含不支持的协议”时保留 version 1/2/3/4/5/6, 并支持 version 6 通过节点字段 `quic-proxy-mode` 设置 `quic_proxy_mode`. 节点上的 `_userkey` 会输出为 sing-box 的 `userkey`