mirror of
https://github.com/sub-store-org/Sub-Store.git
synced 2026-11-27 06:43:08 +00:00
fix: AnyTLS 重复解码密码
This commit is contained in:
2 files changed
+17
-1
No files matched your search
@@ -2130,7 +2130,6 @@ function URI_AnyTLS() {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
let [__, password, server, port, addons = '', name] =
|
||||
/^(.*?)@(.*?)(?::(\d+))?\/?(?:\?(.*?))?(?:#(.*?))?$/.exec(line);
|
||||
password = decodeURIComponent(password);
|
||||
port = parseInt(`${port}`, 10);
|
||||
if (isNaN(port)) {
|
||||
port = 443;
|
||||
|
||||
@@ -5817,6 +5817,23 @@ describe('Proxy text producers', function () {
|
||||
expect(parsed.password).to.equal('p@ss:w/rd#1?');
|
||||
});
|
||||
|
||||
for (const password of ['p%40ss', 'p%ss']) {
|
||||
it(`round-trips the URI AnyTLS password ${password}`, function () {
|
||||
const output = produceExternal('URI', {
|
||||
type: 'anytls',
|
||||
name: 'URI AnyTLS Password',
|
||||
server: 'anytls.example.com',
|
||||
port: 443,
|
||||
password,
|
||||
sni: 'anytls.example.com',
|
||||
});
|
||||
|
||||
const parsed = ProxyUtils.parse(output);
|
||||
expect(parsed).to.have.length(1);
|
||||
expect(parsed[0].password).to.equal(password);
|
||||
});
|
||||
}
|
||||
|
||||
it('produces URI Trojan links with vcn from the sidecar', function () {
|
||||
const output = produceExternal('URI', {
|
||||
type: 'trojan',
|
||||
|
||||
Reference in new issue
Block a user