视觉审核完成30%

This commit is contained in:
rain
2026-07-16 18:12:59 +08:00
parent cb25317412
commit 23cfd365a1
89 changed files with 3740 additions and 403 deletions
+44 -4
View File
@@ -6,7 +6,7 @@ const renderSettleMilliseconds = 900
const chromeDebuggingPort = process.env.CHROME_DEBUGGING_PORT || '9222'
if (!url || !selector || !output) {
throw new Error('Usage: node scripts/capture-chrome-page.js <url> <selector> <output> [width] [height] [password-tab|sms-tab|g06-results|g06-empty|g06-invite|fresh-navigation]')
throw new Error('Usage: node scripts/capture-chrome-page.js <url> <selector> <output> [width] [height] [password-tab|sms-tab|invalid-login|verification-dialog|g06-results|g06-empty|g06-invite|fresh-navigation]')
}
const sleep = (milliseconds) => new Promise((resolve) => setTimeout(resolve, milliseconds))
@@ -55,8 +55,8 @@ const waitForLoadedImages = async (send) => {
}
const prepareA01LoginState = async (send, action) => {
if (action !== 'password-tab' && action !== 'sms-tab') return
const tabIndex = action === 'password-tab' ? 0 : 1
if (action !== 'password-tab' && action !== 'sms-tab' && action !== 'invalid-login' && action !== 'verification-dialog') return
const tabIndex = action === 'sms-tab' ? 1 : 0
for (let attempt = 0; attempt < 30; attempt += 1) {
const prepared = await send('Runtime.evaluate', {
@@ -78,10 +78,50 @@ const prepareA01LoginState = async (send, action) => {
expression: `document.querySelectorAll('.login-tab')[${tabIndex}]?.classList.contains('active') === true`,
returnByValue: true
})
if (active.result?.value) return
if (active.result?.value) break
if (attempt === 29) throw new Error(`A01 did not enter the requested ${action} state`)
await sleep(100)
}
if (action === 'invalid-login') {
await send('Runtime.evaluate', { expression: "document.querySelector('.login-submit').click()" })
for (let attempt = 0; attempt < 30; attempt += 1) {
const visible = await send('Runtime.evaluate', {
expression: "Boolean(document.querySelector('.feedback-toast'))",
returnByValue: true
})
if (visible.result?.value) return
if (attempt === 29) throw new Error('A01 invalid-login Toast did not render')
await sleep(100)
}
}
if (action === 'verification-dialog') {
const prepared = await send('Runtime.evaluate', {
expression: `(() => {
const inputs = document.querySelectorAll('.auth-input input')
if (inputs.length < 2) return false
inputs[0].value = '13800138000'
inputs[0].dispatchEvent(new Event('input', { bubbles: true }))
inputs[1].value = 'demo-password'
inputs[1].dispatchEvent(new Event('input', { bubbles: true }))
document.querySelector('.agreement-row').click()
document.querySelector('.login-submit').click()
return true
})()`,
returnByValue: true
})
if (!prepared.result?.value) throw new Error('Could not prepare A01 verification dialog state')
for (let attempt = 0; attempt < 30; attempt += 1) {
const visible = await send('Runtime.evaluate', {
expression: "Boolean(document.querySelector('.verification-dialog'))",
returnByValue: true
})
if (visible.result?.value) return
if (attempt === 29) throw new Error('A01 verification dialog did not render')
await sleep(100)
}
}
}
const waitForRequestedUrl = async (send, url) => {