优化兑换流程, 优化浏览器分辨率
This commit is contained in:
@@ -299,7 +299,11 @@ export function classifyTencentRedeemResult(result) {
|
||||
return buildTencentRedeemClassification('code_used', retCode, message || '兑换码已使用')
|
||||
}
|
||||
|
||||
if (/兑换码错误|cdk错误|cdkey错误|请确认兑换码信息是否准确|兑换码信息是否准确/.test(normalized)) {
|
||||
if (
|
||||
retCode === -165 ||
|
||||
retCode === -183 ||
|
||||
/兑换码错误|cdk错误|cdkey错误|请确认兑换码信息是否准确|兑换码信息是否准确|兑换码不存在|cdk不存在|cdkey不存在|不存在请您确认后输入/.test(normalized)
|
||||
) {
|
||||
return buildTencentRedeemClassification('code_invalid', retCode, message || '兑换码错误,请确认兑换码信息是否准确')
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,17 @@ test('classifyTencentRedeemResult marks invalid codes as replacement retries', (
|
||||
assert.equal(result.retryWithReplacementCode, true)
|
||||
})
|
||||
|
||||
test('classifyTencentRedeemResult treats missing CDKEY responses as invalid replacement retries', () => {
|
||||
const result = classifyTencentRedeemResult({
|
||||
iRet: -183,
|
||||
sMsg: '该CDKEY不存在,请您确认后输入!',
|
||||
})
|
||||
|
||||
assert.equal(result.outcome, 'code_invalid')
|
||||
assert.equal(result.success, false)
|
||||
assert.equal(result.retryWithReplacementCode, true)
|
||||
})
|
||||
|
||||
test('classifyTencentRedeemResult recognizes successful gift popup', () => {
|
||||
const result = classifyTencentRedeemResult({
|
||||
popup: {
|
||||
|
||||
@@ -41,7 +41,7 @@ const ACTIVITY_URL = 'https://df.qq.com/cp/a20240812cdk/index.html'
|
||||
const CHROME_PATH = String(runtimeConfig.browser.chromePath || '').trim()
|
||||
const DEFAULT_LOGIN_TYPE = 'qq'
|
||||
const SESSION_TTL_MS = 30 * 60 * 1000
|
||||
const DEFAULT_VIEWPORT = { width: 1440, height: 1280 }
|
||||
const DEFAULT_VIEWPORT = resolveDefaultViewport()
|
||||
const SESSION_DEBUG_ENABLED = Boolean(runtimeConfig.session.debug)
|
||||
|
||||
const sessions = new Map()
|
||||
@@ -429,6 +429,37 @@ function buildChromiumLaunchOptions(launchOptions) {
|
||||
return options
|
||||
}
|
||||
|
||||
function resolveDefaultViewport() {
|
||||
const fromVncResolution = parseViewportSpec(process.env.TENCENT_BROWSER_VNC_RESOLUTION)
|
||||
if (fromVncResolution) {
|
||||
return fromVncResolution
|
||||
}
|
||||
|
||||
return { width: 1600, height: 900 }
|
||||
}
|
||||
|
||||
function parseViewportSpec(rawValue) {
|
||||
const text = String(rawValue || '').trim()
|
||||
|
||||
if (!text) {
|
||||
return null
|
||||
}
|
||||
|
||||
const match = text.match(/^(\d+)x(\d+)(?:x\d+)?$/i)
|
||||
if (!match) {
|
||||
return null
|
||||
}
|
||||
|
||||
const width = Number(match[1])
|
||||
const height = Number(match[2])
|
||||
|
||||
if (!Number.isFinite(width) || !Number.isFinite(height) || width < 800 || height < 600) {
|
||||
return null
|
||||
}
|
||||
|
||||
return { width, height }
|
||||
}
|
||||
|
||||
function createSessionId() {
|
||||
let sessionId = ''
|
||||
|
||||
|
||||
Reference in New Issue
Block a user