Skip to content

Commit 651a837

Browse files
committed
feat: Shadowrocket 支持 Snell 4/5
1 parent 84bb577 commit 651a837

3 files changed

Lines changed: 12 additions & 14 deletions

File tree

backend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sub-store",
3-
"version": "2.24.2",
3+
"version": "2.24.4",
44
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and Shadowrocket.",
55
"main": "src/main.js",
66
"packageManager": "pnpm@11.0.9",

backend/src/core/proxy-utils/producers/shadowrocket.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ export default function Shadowrocket_Producer() {
2828
])
2929
) {
3030
return false;
31-
} else if (proxy.type === 'snell' && proxy.version >= 4) {
31+
} else if (
32+
proxy.type === 'snell' &&
33+
![1, 2, 3, 4, 5].includes(proxy.version)
34+
) {
3235
return false;
3336
} else if (
3437
[

backend/src/test/config/cors-module-config.spec.js

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ describe('module CORS allowlist config', function () {
1515

1616
expect(content).to.include(`cors:"${DEFAULT_ORIGIN}"`);
1717
expect(content).to.include('argument="cors={{{cors}}}"');
18-
expect(content.match(/argument="cors=\{\{\{cors\}\}\}"/g)).to.have
19-
.length(2);
18+
expect(
19+
content.match(/argument="cors=\{\{\{cors\}\}\}"/g),
20+
).to.have.length(2);
2021
}
2122
});
2223

@@ -36,15 +37,6 @@ describe('module CORS allowlist config', function () {
3637
}
3738
});
3839

39-
it('adds the default CORS argument to the Loon module', function () {
40-
const content = readConfig('Loon.plugin');
41-
42-
expect(content).to.include(
43-
`cors=input, "${DEFAULT_ORIGIN}", tag=CORS允许来源`,
44-
);
45-
expect(content.match(/argument="cors=\{cors\}"/g)).to.have.length(2);
46-
});
47-
4840
it('does not set legacy non-parameterized modules to wildcard CORS', function () {
4941
for (const filename of [
5042
'QX.snippet',
@@ -60,7 +52,10 @@ describe('module CORS allowlist config', function () {
6052
});
6153

6254
function readConfig(filename) {
63-
return fs.readFileSync(path.join(findRepoRoot(), 'config', filename), 'utf8');
55+
return fs.readFileSync(
56+
path.join(findRepoRoot(), 'config', filename),
57+
'utf8',
58+
);
6459
}
6560

6661
function findRepoRoot() {

0 commit comments

Comments
 (0)