The challenge was detected but treated as an ordinary download failure, so the message didn't say that only you can clear it. Now it stops the run, is remembered centrally, and watches skip downloads while it stands — metadata still imports, and models stay partial for "Get files". The Watched page shows a banner with a link to MakerWorld and an "I've solved it" button; a successful download clears it too. Detection also covers a challenge page returned where JSON was expected. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
34 lines
1.7 KiB
JavaScript
34 lines
1.7 KiB
JavaScript
const test = require('node:test');
|
||
const assert = require('node:assert/strict');
|
||
const block = require('../lib/downloadBlock');
|
||
const makerworld = require('../lib/importers/makerworld');
|
||
|
||
test('a blocked site stays blocked until it’s cleared', () => {
|
||
assert.equal(block.isBlocked('makerworld'), false);
|
||
block.block('makerworld', 'Prove you’re not a robot.');
|
||
assert.equal(block.isBlocked('makerworld'), true);
|
||
const state = block.state('makerworld');
|
||
assert.equal(state.blocked, true);
|
||
assert.equal(state.message, 'Prove you’re not a robot.');
|
||
assert.ok(state.since instanceof Date);
|
||
// Blocking again keeps the original message and time.
|
||
const again = block.block('makerworld', 'something else');
|
||
assert.equal(again.message, 'Prove you’re not a robot.');
|
||
block.clear('makerworld');
|
||
assert.deepEqual(block.state('makerworld'), { blocked: false });
|
||
});
|
||
|
||
test('MakerWorld’s anti-bot answers are recognised, ordinary refusals aren’t', () => {
|
||
for (const text of ['Please verify you are not a robot', 'Just a moment…', 'Select in this order',
|
||
'Security check required', 'Verification required']) {
|
||
assert.equal(makerworld.isChallengeText(text), true, text);
|
||
}
|
||
for (const text of ['Please log in to download models.', 'Model not found', '']) {
|
||
assert.equal(makerworld.isChallengeText(text), false, text);
|
||
}
|
||
// An answer carrying a link is never a challenge.
|
||
assert.equal(makerworld.isChallenge({ url: 'https://cdn/x.3mf', message: 'captcha' }), false);
|
||
const problem = makerworld.downloadProblem({ error: 'Please verify you are not a robot' });
|
||
assert.equal(problem.challenged, true);
|
||
assert.equal(makerworld.downloadProblem({ error: 'Please log in to download models.' }).tokenRejected, true);
|
||
});
|