优化兑换流程, 优化浏览器分辨率
This commit is contained in:
@@ -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