diff --git a/backend/package.json b/backend/package.json index f769fde3..5fd64afe 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "sub-store", - "version": "2.44.28", + "version": "2.44.29", "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/producers/loon.js b/backend/src/core/proxy-utils/producers/loon.js index 72249233..ec1e01eb 100644 --- a/backend/src/core/proxy-utils/producers/loon.js +++ b/backend/src/core/proxy-utils/producers/loon.js @@ -762,9 +762,7 @@ function appendVlessEncryption(result, encryption) { const publicKeys = settings.slice(keyIndex).join('.'); result.append(`,encryption-mode=${mode},encryption-rtt=${rtt}`); - result.append( - `,encryption-public-keys=${formatLoonValue(publicKeys, true)}`, - ); + result.append(`,encryption-public-keys=${formatLoonValue(publicKeys)}`); if (padding.length) { result.append( `,encryption-padding=${formatLoonValue(padding.join('.'))}`, diff --git a/backend/src/test/proxy-producers/text.spec.js b/backend/src/test/proxy-producers/text.spec.js index 065e6817..c1562e9a 100644 --- a/backend/src/test/proxy-producers/text.spec.js +++ b/backend/src/test/proxy-producers/text.spec.js @@ -1355,7 +1355,9 @@ describe('Proxy text producers', function () { const output = produceExternal('Loon', ProxyUtils.parse(uri)); expect(output).to.include(`,encryption-mode=${mode}`); expect(output).to.include(`,encryption-rtt=${expectedRtt}`); - expect(output).to.include(`,encryption-public-keys="${keys}"`); + expect(output.split(',')).to.include( + `encryption-public-keys=${keys}`, + ); expect(output).to.include(`,encryption-padding=${padding}`); expect(ProxyUtils.parse(output)[0]).to.include({ network, @@ -1365,6 +1367,27 @@ describe('Proxy text producers', function () { } }); + it('exports unquoted Loon VLESS Encryption public keys with independent XHTTP download', function () { + const key = 'A'.repeat(43); + const extra = encodeURIComponent( + JSON.stringify({ + downloadSettings: { + address: 'download.example.com', + port: 8443, + security: 'tls', + }, + }), + ); + const proxies = ProxyUtils.parse( + `vless://${UUID}@upload.example.com:443?type=xhttp&mode=stream-up&security=tls&encryption=mlkem768x25519plus.native.0rtt.${key}&extra=${extra}#Split`, + ); + const output = produceExternal('Loon', proxies); + expect(output).to.include( + ',xhttp-download-server=download.example.com,xhttp-download-port=8443,', + ); + expect(output.split(',')).to.include(`encryption-public-keys=${key}`); + }); + it('validates Loon VLESS Encryption padding probabilities and ranges', function () { const key = 'A'.repeat(43); const input = `Encrypted=vless,example.com,443,"${UUID}",transport=tcp,encryption-mode=native,encryption-public-keys="${key}"`; @@ -1588,7 +1611,7 @@ describe('Proxy text producers', function () { }); expect(output).to.equal( - `Loon Reality=vless,vless.example.com,443,"${UUID}",transport=ws,path=/ws,host=cdn.example.com,over-tls=true,skip-cert-verify=true,encryption-mode=native,encryption-rtt=1rtt,encryption-public-keys="${publicKey}",flow=xtls-rprx-vision,sni=sni.example.com,public-key="pubkey",short-id=08`, + `Loon Reality=vless,vless.example.com,443,"${UUID}",transport=ws,path=/ws,host=cdn.example.com,over-tls=true,skip-cert-verify=true,encryption-mode=native,encryption-rtt=1rtt,encryption-public-keys=${publicKey},flow=xtls-rprx-vision,sni=sni.example.com,public-key="pubkey",short-id=08`, ); });