mirror of
https://github.com/sub-store-org/Sub-Store.git
synced 2026-12-04 10:16:38 +00:00
feat: 支持单条订阅和组合订阅配置 "不查询订阅流量信息"; 支持订阅链接参数传入 noFlow 强制指定 "不查询订阅流量信息"
This commit is contained in:
10 files changed
+529
-39
No files matched your search
@@ -208,6 +208,50 @@ describe('download github proxy regex', function () {
|
||||
expect(maxActiveRequests).to.equal(1);
|
||||
});
|
||||
|
||||
it('keeps noFlow during custom cache refreshes', async function () {
|
||||
for (const awaitCustomCache of [true, false]) {
|
||||
const cacheKey = `refresh-${awaitCustomCache}`;
|
||||
const sourceUrl = `https://example.com/${cacheKey}`;
|
||||
const requests = [];
|
||||
state[`#sub-store-cached-custom-${cacheKey}`] = 'cached-body';
|
||||
openApi.HTTP = () => ({
|
||||
get: async ({ url }) => {
|
||||
requests.push(['GET', url]);
|
||||
return {
|
||||
body: 'fresh-body',
|
||||
headers: {},
|
||||
statusCode: 200,
|
||||
};
|
||||
},
|
||||
head: async ({ url }) => {
|
||||
requests.push(['HEAD', url]);
|
||||
return {
|
||||
headers: {
|
||||
'subscription-userinfo':
|
||||
'upload=1; download=2; total=3; expire=4102444800',
|
||||
},
|
||||
statusCode: 200,
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
await download(
|
||||
`${sourceUrl}#validCheck&cacheKey=${cacheKey}`,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
awaitCustomCache,
|
||||
true,
|
||||
undefined,
|
||||
{ noFlow: 'false' },
|
||||
);
|
||||
if (!awaitCustomCache) await sleep(10);
|
||||
|
||||
expect(requests).to.deep.equal([['GET', sourceUrl]]);
|
||||
}
|
||||
});
|
||||
|
||||
it('logs download failures before rejecting', async function () {
|
||||
openApi.HTTP = () => ({
|
||||
get: async () => {
|
||||
|
||||
Reference in new issue
Block a user