主要变更: - 新增 Playwright 登录认证服务 (services/playwright-auth.ts) - 重构 get-activity.ts 使用 Playwright 替代 Axios 登录 - 实现自动 cookie 过期检测和重试机制 - 优化 Docker 配置支持 Playwright 浏览器运行 - 添加启动脚本自动验证和刷新 cookies - 完善错误处理:区分 4xx(认证失败) 和 5xx(服务器错误) 技术细节: - 删除旧版 login_template.txt 和 nkcs-engage.cookie.txt - 添加 startup.sh 启动时自动验证 cookies - 改进 cookie 验证逻辑,添加指数退避重试 - Dockerfile 安装 Playwright 系统依赖 - docker-compose.yaml 添加 volumes 和 health checks 测试: - 添加 auth.spec.ts 自动化测试 - 添加 get-cookies.ts 和 test-cookies-validity.ts 工具脚本 - 验证 401/500/000 等错误场景处理正确
33 lines
792 B
JSON
33 lines
792 B
JSON
{
|
|
"name": "dsas-cca-backend-bun",
|
|
"private": true,
|
|
"scripts": {
|
|
"start": "bun run index.ts",
|
|
"dev": "bun run --watch index.ts",
|
|
"playwright:install": "bunx playwright install",
|
|
"cookie:get": "bun run test/get-cookies.ts",
|
|
"test": "bun test",
|
|
"test:auth": "bun test test/auth.spec.ts",
|
|
"test:ui": "bunx playwright test --ui"
|
|
},
|
|
"devDependencies": {
|
|
"@playwright/test": "^1.49.0",
|
|
"@types/bun": "latest",
|
|
"typescript-language-server": "^5.1.3"
|
|
},
|
|
"peerDependencies": {
|
|
"typescript": "^5.9.3"
|
|
},
|
|
"dependencies": {
|
|
"axios": "^1.9.0",
|
|
"cors": "^2.8.5",
|
|
"crypto": "^1.0.1",
|
|
"dotenv": "^16.5.0",
|
|
"express": "^5.1.0",
|
|
"p-limit": "^6.2.0",
|
|
"pangu": "^4.0.7",
|
|
"sharp": "^0.34.1",
|
|
"uuid": "^11.1.0"
|
|
}
|
|
}
|