feat: 更新依赖

This commit is contained in:
xream committed 2026-10-25 10:05:52 +08:00
1 parent 3bf80da944
commit f29733362f
4 files changed
+1278 -1877

No files matched your search

+13 -18
View File
@@ -1,6 +1,6 @@
{
"name": "sub-store",
"version": "2.44.0",
"version": "2.44.1",
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and Shadowrocket.",
"main": "src/main.js",
"packageManager": "pnpm@11.0.9",
@@ -17,49 +17,44 @@
},
"author": "Peng-YM",
"license": "AGPL-3.0",
"pnpm": {
"patchedDependencies": {
"http-proxy@2.18.1": "patches/http-proxy@1.18.1.patch"
}
},
"dependencies": {
"@maxmind/geoip2-node": "^5.0.0",
"age-encryption": "^0.3.0",
"body-parser": "^1.19.0",
"body-parser": "^1.20.9",
"buffer": "^6.0.3",
"connect-history-api-fallback": "^2.0.0",
"core-js": "^3.49.0",
"cron": "^3.1.6",
"dns-packet": "^5.6.1",
"dotenv": "^16.4.7",
"express": "^4.17.1",
"express": "^4.22.3",
"fastestsmallesttextencoderdecoder": "^1.0.22",
"fetch-socks": "^1.3.3",
"http-proxy-middleware": "^3.0.3",
"ip-address": "^10.3.1",
"http-proxy-middleware": "^3.0.10",
"ip-address": "^10.7.5",
"js-base64": "^3.7.2",
"json5": "^2.2.3",
"jsrsasign": "^11.1.0",
"lodash": "^4.17.21",
"mime-types": "^2.1.35",
"ms": "^2.1.3",
"nanoid": "^3.3.3",
"semver": "^7.6.3",
"nanoid": "^3.3.20",
"semver": "^7.8.5",
"shoutrrr-ts": "https://github.com/Delusions6515/shoutrrr-ts/releases/download/v0.2.0/shoutrrr-ts-0.2.0.tgz",
"undici": "^8.12.3",
"yaml": "^2.9.0"
},
"devDependencies": {
"@babel/core": "^7.18.0",
"@babel/core": "^7.29.7",
"@babel/node": "^7.17.10",
"@babel/preset-env": "^7.18.0",
"@babel/preset-env": "^7.29.7",
"@babel/register": "^7.17.7",
"babel-plugin-relative-path-import": "^2.0.1",
"chai": "^4.3.6",
"esbuild": "^0.19.8",
"eslint": "^8.16.0",
"mocha": "^11.7.5",
"nodemon": "^2.0.16",
"esbuild": "^0.25.12",
"eslint": "^8.57.1",
"mocha": "^12.0.3",
"nodemon": "^3.1.14",
"peggy": "^2.0.1",
"prettier": "2.6.2"
}
+1161 -1859
View File
File diff suppressed because it is too large. Load diff
+4
View File
@@ -5,3 +5,7 @@ allowBuilds:
patchedDependencies:
http-proxy@1.18.1: patches/http-proxy@1.18.1.patch
overrides:
brace-expansion@1: ^1.1.21
js-yaml@4: ^4.3.2
+100
View File
@@ -0,0 +1,100 @@
import { expect } from 'chai';
import { after, before, describe, it } from 'mocha';
import { deflateSync, gzipSync } from 'zlib';
import express from '@/vendor/express';
describe('express request body compatibility', function () {
let server;
let baseUrl;
let originalLimit;
before(async function () {
originalLimit = process.env.SUB_STORE_BODY_JSON_LIMIT;
process.env.SUB_STORE_BODY_JSON_LIMIT = '128b';
const app = express({ substore: { info() {} } });
app.post('/probe', (req, res) => {
res.json({ body: req.body, rawBody: req.rawBody });
});
// eslint-disable-next-line no-unused-vars -- Express detects error middleware by arity.
app.use((error, req, res, next) => {
res.status(error.status || 500).json({ type: error.type });
});
server = await new Promise((resolve) => {
const listener = app.listen(0, '127.0.0.1', () =>
resolve(listener),
);
});
baseUrl = `http://127.0.0.1:${server.address().port}/probe`;
});
after(async function () {
if (originalLimit == null) {
delete process.env.SUB_STORE_BODY_JSON_LIMIT;
} else {
process.env.SUB_STORE_BODY_JSON_LIMIT = originalLimit;
}
if (server) await new Promise((resolve) => server.close(resolve));
});
it('parses plain, gzip and deflate JSON and preserves UTF-8 raw bodies', async function () {
const data = { name: '测试订阅', url: 'https://example.com/sub' };
const rawBody = JSON.stringify(data);
for (const [encoding, body] of [
['identity', rawBody],
['gzip', gzipSync(rawBody)],
['deflate', deflateSync(rawBody)],
]) {
const response = await fetch(baseUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Content-Encoding': encoding,
},
body,
});
expect(response.status, encoding).to.equal(200);
expect(await response.json()).to.deep.equal({
body: data,
rawBody,
});
}
});
it('preserves nested form fields and arrays', async function () {
const rawBody = 'options[udp]=true&tags[]=a&tags[]=b';
const response = await fetch(baseUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: rawBody,
});
expect(response.status).to.equal(200);
expect(await response.json()).to.deep.equal({
body: { options: { udp: 'true' }, tags: ['a', 'b'] },
rawBody,
});
});
it('rejects invalid JSON and enforces limits after decompression', async function () {
const oversized = JSON.stringify({ name: 'x'.repeat(256) });
for (const [encoding, body, status, type] of [
['identity', '{', 400, 'entity.parse.failed'],
['identity', oversized, 413, 'entity.too.large'],
['gzip', gzipSync(oversized), 413, 'entity.too.large'],
]) {
const response = await fetch(baseUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Content-Encoding': encoding,
},
body,
});
expect(response.status, encoding).to.equal(status);
expect(await response.json()).to.deep.equal({ type });
}
});
});