mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-01 19:42:03 +00:00
fix(cli): narrow blocked page titles
This commit is contained in:
@@ -70,6 +70,26 @@ describe("detectBlockedPage", () => {
|
||||
hasChallengeElement: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "a minimal photography page named Forbidden Fruit Photography",
|
||||
evidence: {
|
||||
httpStatus: 200,
|
||||
title: "Forbidden Fruit Photography",
|
||||
textLength: 40,
|
||||
bodyChildCount: 4,
|
||||
hasChallengeElement: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "a minimal photo essay named Attention Required",
|
||||
evidence: {
|
||||
httpStatus: 200,
|
||||
title: "Attention Required: A Photo Essay",
|
||||
textLength: 60,
|
||||
bodyChildCount: 5,
|
||||
hasChallengeElement: false,
|
||||
},
|
||||
},
|
||||
])("allows $label", ({ evidence }) => {
|
||||
expect(detectBlockedPage(evidence)).toBeUndefined();
|
||||
});
|
||||
|
||||
@@ -16,8 +16,8 @@ export function detectBlockedPage(evidence: PageLoadEvidence): string | undefine
|
||||
const hasBlockedStatus =
|
||||
evidence.httpStatus === 401 || evidence.httpStatus === 403 || evidence.httpStatus === 429;
|
||||
const hasBlockedTitle =
|
||||
/^(?:error\s*)?(?:401|403|429)(?:\s*[-:—]\s*|\s+)|forbidden|access denied|attention required|just a moment/i.test(
|
||||
evidence.title,
|
||||
/^(?:(?:error\s*)?(?:401|403|429)(?:\s*(?:[-:—]\s*)?(?:forbidden|unauthorized|access denied|too many requests))?|forbidden|access denied|attention required|just a moment(?:\.{3})?)(?:\s*[|—-]\s*(?:cloudflare|sucuri website firewall))?$/i.test(
|
||||
evidence.title.trim(),
|
||||
);
|
||||
|
||||
if (!isMinimalDom || (!evidence.hasChallengeElement && !hasBlockedStatus && !hasBlockedTitle)) {
|
||||
|
||||
Reference in New Issue
Block a user