fix: include ALTCHA signature in verify payload; case-insensitive variant filter
- squid.js: add top-level signature from challenge response to verify payload (server added signature validation, causing HTTP 400 without it) - ytdlp.js: switch variant filter from !*= to !~= (?i) so Remix/REMIX/remix are all rejected, not just lowercase Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
598c108214
commit
b9692e6f08
2 files changed
+14
-13
No files matched your search
@@ -106,8 +106,8 @@ async function getAltchaCookie() {
|
|||||||
// 2. Solve PoW
|
// 2. Solve PoW
|
||||||
const solution = await solveAltcha(challenge);
|
const solution = await solveAltcha(challenge);
|
||||||
|
|
||||||
// 3. Verify — payload contains the unwrapped challenge params + our solution
|
// 3. Verify — include the top-level signature so the server can authenticate the challenge
|
||||||
const payload = Buffer.from(JSON.stringify({ challenge, solution })).toString('base64');
|
const payload = Buffer.from(JSON.stringify({ challenge, solution, signature: chBody.signature })).toString('base64');
|
||||||
const vRes = await httpsPost(`${SQUID_BASE}/api/altcha/verify`, { payload });
|
const vRes = await httpsPost(`${SQUID_BASE}/api/altcha/verify`, { payload });
|
||||||
if (vRes.status !== 200) throw new Error(`ALTCHA verify HTTP ${vRes.status}`);
|
if (vRes.status !== 200) throw new Error(`ALTCHA verify HTTP ${vRes.status}`);
|
||||||
|
|
||||||
|
|||||||
+12
-11
@@ -28,18 +28,19 @@ function buildTitleKeywords(title) {
|
|||||||
|
|
||||||
function buildVariantFilter(title) {
|
function buildVariantFilter(title) {
|
||||||
const t = (title || '').toLowerCase();
|
const t = (title || '').toLowerCase();
|
||||||
|
// !~= (?i) is yt-dlp's case-insensitive "does not match regex" — catches Remix/REMIX/remix etc.
|
||||||
const RULES = [
|
const RULES = [
|
||||||
{ key: 'sped', expr: 'title !*= sped' },
|
{ key: 'sped', expr: 'title !~= (?i)sped up' },
|
||||||
{ key: 'speedup', expr: 'title !*= speedup' },
|
{ key: 'speedup', expr: 'title !~= (?i)speed\\s*up' },
|
||||||
{ key: 'slowed', expr: 'title !*= slowed' },
|
{ key: 'slowed', expr: 'title !~= (?i)slowed' },
|
||||||
{ key: 'reverb', expr: 'title !*= reverb' },
|
{ key: 'reverb', expr: 'title !~= (?i)reverb' },
|
||||||
{ key: 'nightcore', expr: 'title !*= nightcore' },
|
{ key: 'nightcore', expr: 'title !~= (?i)nightcore' },
|
||||||
{ key: 'karaoke', expr: 'title !*= karaoke' },
|
{ key: 'karaoke', expr: 'title !~= (?i)karaoke' },
|
||||||
{ key: 'parody', expr: 'title !*= parody' },
|
{ key: 'parody', expr: 'title !~= (?i)parody' },
|
||||||
{ key: 'remix', expr: 'title !*= remix' },
|
{ key: 'remix', expr: 'title !~= (?i)remix' },
|
||||||
{ key: 'cover', expr: 'title !*= cover' },
|
{ key: 'cover', expr: 'title !~= (?i)cover' },
|
||||||
{ key: 'acoustic', expr: 'title !*= acoustic' },
|
{ key: 'acoustic', expr: 'title !~= (?i)acoustic' },
|
||||||
{ key: 'instrumental', expr: 'title !*= instrumental' },
|
{ key: 'instrumental', expr: 'title !~= (?i)instrumental' },
|
||||||
];
|
];
|
||||||
const parts = RULES.filter(r => !t.includes(r.key)).map(r => r.expr);
|
const parts = RULES.filter(r => !t.includes(r.key)).map(r => r.expr);
|
||||||
return parts.length ? parts.join(' & ') : '';
|
return parts.length ? parts.join(' & ') : '';
|
||||||
|
|||||||
Reference in new issue
Block a user