添加动图支持,优化图片和视频上传逻辑,调整超时设置,增强评论时间格式化

This commit is contained in:
2025-10-23 00:58:56 +08:00
parent fe9bc8fd6c
commit 77bc2c5775
15 changed files with 82 additions and 31 deletions
+10 -2
View File
@@ -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