201 Commits

Author SHA1 Message Date
RachelOS bb29a7a45e 1.5.2-增加读书渠道 2026-08-13 15:15:56 +08:00
RachelOS 08e63ebf24 1.5.2-Fix 2026-08-12 17:46:12 +08:00
longw e9d65a42c8 refactor(driver): switch_account accepts progress callback and stops 60s sleep
Make Wx.switch_account emit granular progress events through an
optional callback, so the caller (apis.auth.switch_wechat_account)
can fan them out to SSE / polling endpoints.

Behaviour changes:
- Replace the 60-second asyncio.sleep on token-expired path with an
  immediate return + explicit 'failed' stage, so the front-end can
  surface 'please re-scan QR' instead of waiting a minute.
- The 120-second queue drain is now configurable via SWITCH_MAX_WAIT
  env var (default unchanged).
- Each phase (stopping_queues / checking_token / starting_browser /
  clicking / done / failed) emits (stage, message, progress).
- finally clause no longer unconditionally calls self.cleanup_resources
  + self.Close; it only restores queues. Resource cleanup is the
  caller's responsibility if needed.
- Stage messages map to UI-friendly Chinese (e.g. '打开账号面板…',
  '找到 N 个可切换账号,正在选择…', '切换成功:<name>').

No breaking signature change: the existing sync callers that pass only
'username' still work because progress_callback defaults to None.
2026-07-27 08:38:57 +08:00
longw 072e0ee67e feat(driver): support BROWSER_TYPE env var to override Chrome auto-detection
When WeChat public platform is reached via a locally detected Chrome
binary on Windows, the platform's anti-bot triggers and the QR code
fails to load (二维码加载超时). Allow users to force a specific
Playwright browser (webkit/chromium/firefox/msedge) via the
BROWSER_TYPE environment variable, bypassing the heuristic that
overrides the default browser_type with the local Chrome path.

Example:
    BROWSER_TYPE=webkit python main.py

This restores cross-platform portability: explicit user preference
takes precedence over auto-detection, while the existing default
(Playwright webkit when no Chrome is detected) is unchanged.
2026-07-27 00:15:33 +08:00
Rachel 6ca61c19a2 Merge pull request #426 from zhangweildlh/pr-a/chrome-env-support
feat: 支持通过环境变量使用本地 Chrome,并新增反爬注入开关
2026-07-24 02:27:17 +08:00
二毛 6b253d11e4 fix: 修复扫码授权二维码无法显示的问题
二维码无法显示由三个问题叠加导致:

1. anti_crawler_config 通过 extra_http_headers 给所有请求(包括页面XHR)
   强加 Cache-Control 和 Upgrade-Insecure-Requests 头,而真实浏览器只在
   导航请求上发送这两个头。mp.weixin.qq.com 登录页检测到后初始化中止,
   #app 保持 visibility:hidden,二维码 src 永远为空(实测100%复现,
   移除后100%恢复)。

2. wxLogin 用 wait_for_event("framenavigated") 判断登录成功,但新版登录
   页内嵌的"微信快捷登录"iframe(open.weixin.qq.com/mpqrconnect)加载时
   也会触发该事件,导致未扫码就误判登录成功、写入空Token,并在 finally
   中删除刚生成的二维码图片,前端持续404。改为 wait_for_url 等待主页面
   真正跳转到 cgi-bin/home。

3. 新版登录页有持续轮询请求,wxLogin 中无超时保护的
   wait_for_load_state("networkidle") 会抛出超时异常直接中断登录流程;
   另外截图前不校验二维码是否可见、是否加载完成,会截出空白图片。
   新增 _wait_qrcode_ready:等待二维码图片可见且真正加载完成,若页面
   默认展示"微信快捷登录"则自动点击"扫码登录"切换回二维码模式。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-22 18:32:36 +08:00
zhangweildlh a132a6c6ba feat: 支持通过环境变量使用本地 Chrome,并新增反爬注入开关
- 新增 driver/chrome_path.py:按「CHROME_EXECUTABLE_PATH 环境变量 > 系统标准安装位 > None」解析本地 Chromium,跨平台、不写死任何机器专属路径;为 None 时回退 Playwright 自带浏览器,Docker/Linux 默认行为不变
- driver/playwright_driver.py / tools/mdtools/pdf.py 改用该 helper,避免离线/受限网络下强制 playwright install 下载浏览器
- 新增 apply_anti_crawler 开关(默认 True,向后兼容):关闭后可避免反爬注入的非 CORS 安全头触发跨域预检、导致部分站点(如微信公众平台登录页)JS 资源加载失败
2026-07-17 14:29:25 +08:00
RachelOS 5a727960a1 1.5.2-Fix 2026-04-29 17:52:50 +08:00
RachelOS cbfea4679d 1.5.2-Fix 2026-04-29 16:32:52 +08:00
RachelOS 1b706a1cd5 1.5.2-Fix 2026-04-23 21:47:34 +08:00
RachelOS 9ff29aa736 1.5.2-Fix 2026-04-22 17:30:37 +08:00
RachelOS 42d030448b 1.5.2-Fix 2026-04-18 13:10:02 +08:00
RachelOS 7874c243c0 1.5.1-Fix 2026-04-15 14:03:15 +08:00
RachelOS 58ec3dbf0b 1.5.1-Fix 2026-04-15 14:01:23 +08:00
RachelOS 7bcb554b2d 1.5.1-Fix 2026-04-14 23:07:05 +08:00
RachelOS 9340f562a6 1.5.1-Fix 2026-04-14 23:01:55 +08:00
RachelOS e72f81f0fc 1.5.1-Fix 2026-04-14 22:23:34 +08:00
RachelOS 80545f9550 1.5.1-Fix 2026-04-14 20:15:09 +08:00
RachelOS 80c23a0030 1.5.0-Fix 2026-04-14 10:23:40 +08:00
RachelOS f25cc32a33 1.5.0-Fix 2026-04-14 10:08:29 +08:00
RachelOS 60b20357a6 1.5.0-Fix 2026-04-14 00:14:43 +08:00
RachelOS b53be1c3cf 1.5.0-Fix 2026-04-13 23:49:08 +08:00
RachelOS bd33bdce38 1.5.0-Fix 2026-04-13 23:29:45 +08:00
RachelOS 0230c03dc9 1.5.0-Fix 2026-04-13 23:25:55 +08:00
RachelOS 2ab2d41306 1.5.0-Fix 2026-04-13 16:56:05 +08:00
RachelOS 0b79bf76a8 1.5.0-Fix 2026-04-13 15:50:33 +08:00
RachelOS 86db4e3a0a 1.5.0-Fix 2026-04-12 01:19:40 +08:00
RachelOS 19ecccf5d1 1.5.0-Fix 2026-04-10 22:28:23 +08:00
RachelOS 08780772b2 1.5.0-Fix 2026-04-10 22:06:04 +08:00
RachelOS 7ce59b041c 1.5.0-Fix 2026-04-10 21:53:55 +08:00
RachelOS 7a1c5079ee 1.5.0-Fix 2026-04-10 19:55:26 +08:00
RachelOS 4476e538ac 1.5.0-Fix 2026-04-10 17:28:17 +08:00
RachelOS ae915eed85 1.5.0-Fix 2026-04-10 17:22:51 +08:00
RachelOS 6cc931235d 1.5.0-Fix 2026-04-10 16:46:38 +08:00
RachelOS 75d4f10fb0 1.5.0-Fix 2026-04-10 15:59:18 +08:00
RachelOS 7c349c22c3 1.5.0-Fix 2026-04-10 15:05:17 +08:00
RachelOS 6dabd84667 1.5.0-Fix 2026-04-10 14:24:21 +08:00
RachelOS 2a8bfdf6a8 1.5.0-Fix 2026-04-10 11:26:37 +08:00
RachelOS 7ce09dd601 1.5.0-Fix 2026-04-10 11:13:20 +08:00
RachelOS fada8ec4cc 1.5.0-Fix 2026-04-10 10:56:01 +08:00
RachelOS 73045887bb 1.5.0-Fix 2026-04-10 09:25:35 +08:00
RachelOS 594a35b955 1.5.0-Fix 2026-04-09 14:58:20 +08:00
RachelOS de10fc2aee 1.5.0-Fix 2026-04-08 17:26:05 +08:00
RachelOS 53645a0e14 1.5.0-Fix 2026-04-08 16:40:38 +08:00
RachelOS 146d47e801 1.5.0-Fix 2026-04-08 15:15:28 +08:00
Rachel e08bb39cac Merge pull request #351 from 973440710/fix/wechat-selector-issue-348
fix: 增强公众号信息获取容错性,修复选择器超时问题 (Issue #348)
2026-04-08 09:45:15 +08:00
973440710 1df2f69295 fix: 增强公众号信息获取容错性 (Issue #348) 2026-04-07 19:42:18 +08:00
RachelOS 9223e236b4 1.5.0-Fix 2026-04-03 15:11:51 +08:00
RachelOS 1553a204ca 1.5.0-Fix 2026-04-03 13:41:20 +08:00
RachelOS bbdab4bce5 1.5.0-Fix 2026-04-03 13:13:04 +08:00