Handle large WeebCentral catalogs and correct MangaPill checkpoint monitoring
This commit is contained in:
1 parent
0d51f214d5
commit
edbc9c6056
11 files changed
+102
-7
No files matched your search
@@ -3,7 +3,21 @@
|
||||
const test = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
const { SlowHttp, StopScrapeError } = require('../lib/http');
|
||||
const { publicAddress, validateWeebRequest, pinnedLookup } = require('../plugins/broker');
|
||||
const { publicAddress, validateWeebRequest, pinnedLookup, responseByteLimit } = require('../plugins/broker');
|
||||
|
||||
test('only explicit HTML catalogs get the larger bounded response allowance', async () => {
|
||||
const html = { headers: { accept: 'text/html' } };
|
||||
assert.equal(responseByteLimit(html), 2 * 1024 * 1024);
|
||||
assert.equal(responseByteLimit({ ...html, catalog: true }), 16 * 1024 * 1024);
|
||||
assert.equal(responseByteLimit({ headers: { accept: 'image/jpeg' }, catalog: true }), 50 * 1024 * 1024);
|
||||
const calls = [];
|
||||
const http = new SlowHttp({ minMs: 0, maxMs: 0, transport: async (_url, options) => {
|
||||
calls.push(options.catalog); return { status: 200, ok: true };
|
||||
} });
|
||||
await http.get('https://weebcentral.com/series/X', { accept: 'text/html' });
|
||||
await http.get('https://weebcentral.com/series/X/full-chapter-list', { accept: 'text/html', catalog: true });
|
||||
assert.deepEqual(calls, [false, true]);
|
||||
});
|
||||
|
||||
test('plugin broker rejects local, private, non-TLS, and cross-source URLs', () => {
|
||||
for (const address of ['127.0.0.1', '10.0.0.5', '192.168.1.1', '169.254.169.254', '::1', '::ffff:127.0.0.1']) {
|
||||
|
||||
Reference in new issue
Block a user