添加动图支持,优化图片和视频上传逻辑,调整超时设置,增强评论时间格式化
This commit is contained in:
@@ -9,10 +9,18 @@ let refCount = 0
|
||||
let idleCloseTimer: NodeJS.Timeout | null = null
|
||||
|
||||
const USER_DATA_DIR = 'chrome-profile/douyin'
|
||||
const DEFAULT_OPTIONS = { headless: true } as const
|
||||
|
||||
async function launchContext(): Promise<BrowserContext> {
|
||||
const ctx = await chromium.launchPersistentContext(USER_DATA_DIR, DEFAULT_OPTIONS)
|
||||
const ctx = await chromium.launchPersistentContext(
|
||||
USER_DATA_DIR,
|
||||
{
|
||||
headless: Boolean(process.env.CHROMIUM_HEADLESS ?? 'false'),
|
||||
viewport: {
|
||||
width: Number(process.env.CHROMIUM_VIEWPORT_WIDTH ?? 1280),
|
||||
height: Number(process.env.CHROMIUM_VIEWPORT_HEIGHT ?? 1080)
|
||||
}
|
||||
}
|
||||
)
|
||||
// When the context is closed externally, reset manager state
|
||||
ctx.on('close', () => {
|
||||
context = null
|
||||
|
||||
Reference in New Issue
Block a user