feat: 添加提取和验证ChatGPT登录代码的功能

This commit is contained in:
QLHazyCoder
2026-05-01 00:18:48 +08:00
parent 4bb734fd1d
commit 047f4e1269
2 changed files with 108 additions and 8 deletions
+30
View File
@@ -549,6 +549,10 @@ return {
test('extractVerificationCode strict mode matches the new suspicious log-in mail body', () => {
const bundle = [
extractFunction('extractStrictChatGPTVerificationCode'),
extractFunction('isLikelyCompactTimeValue'),
extractFunction('isLikelyHeaderTimestampCode'),
extractFunction('findSafeStandaloneSixDigitCode'),
extractFunction('extractVerificationCode'),
].join('\n');
@@ -562,6 +566,32 @@ return { extractVerificationCode };
assert.equal(api.extractVerificationCode(bodyText, false), '982219');
});
test('extractVerificationCode ignores compact header time before fallback code', () => {
const bundle = [
extractFunction('extractStrictChatGPTVerificationCode'),
extractFunction('isLikelyCompactTimeValue'),
extractFunction('isLikelyHeaderTimestampCode'),
extractFunction('findSafeStandaloneSixDigitCode'),
extractFunction('extractVerificationCode'),
].join('\n');
const api = new Function(`
${bundle}
return { extractVerificationCode };
`)();
const bodyText = [
'Your temporary ChatGPT login code',
'From: otp <otp@tm1.openai.com>',
'To: test@example.com',
'Time: 2026-4-22 101755',
'OpenAI',
'371138',
].join('\n');
assert.equal(api.extractVerificationCode(bodyText, false), '371138');
});
test('openMailAndGetMessageText always returns to inbox after opening a 2925 message', async () => {
const bundle = [
extractFunction('returnToInbox'),