From f04c5c1c8f17b21e0deb8268eba1619fe147a520 Mon Sep 17 00:00:00 2001 From: yuyx <237899745@qq.com> Date: Wed, 14 Jan 2026 12:31:22 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=80=82=E9=85=8D=E7=BD=91=E7=AB=99?= =?UTF-8?q?=E7=BB=93=E6=9E=84=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 标记已读改用预览通道 (download2.ashx) 2. 截图优先直接访问目标页面,避免 iframe 加载问题 Co-Authored-By: Claude Opus 4.5 --- api_browser.py | 4 ++-- services/screenshots.py | 13 +++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/api_browser.py b/api_browser.py index e88cd34..ddf3c4c 100755 --- a/api_browser.py +++ b/api_browser.py @@ -386,8 +386,8 @@ class APIBrowser: return attachments def mark_read(self, attach_id: str, channel_id: str = '1') -> bool: - """通过访问下载链接标记已读""" - download_url = f"{BASE_URL}/tools/download.ashx?site=main&id={attach_id}&channel_id={channel_id}" + """通过访问预览通道标记已读""" + download_url = f"{BASE_URL}/tools/download2.ashx?site=main&id={attach_id}&channel_id={channel_id}" try: resp = self._request_with_retry("get", download_url, stream=True) diff --git a/services/screenshots.py b/services/screenshots.py index 8be6afb..79b3996 100644 --- a/services/screenshots.py +++ b/services/screenshots.py @@ -311,7 +311,14 @@ def take_screenshot_for_account( screenshot_path = os.path.join(SCREENSHOTS_DIR, screenshot_filename) cookies_for_shot = cookie_path if is_cookie_jar_fresh(cookie_path) else None + # 优先直接截取目标页面(center.aspx?bz=X),避免 iframe 加载问题 if take_screenshot_wkhtmltoimage( + target_url, + screenshot_path, + cookies_path=cookies_for_shot, + proxy_server=proxy_server, + log_callback=custom_log, + ) or take_screenshot_wkhtmltoimage( index_url, screenshot_path, cookies_path=cookies_for_shot, @@ -319,12 +326,6 @@ def take_screenshot_for_account( run_script=run_script, window_status="ready", log_callback=custom_log, - ) or take_screenshot_wkhtmltoimage( - target_url, - screenshot_path, - cookies_path=cookies_for_shot, - proxy_server=proxy_server, - log_callback=custom_log, ): if os.path.exists(screenshot_path) and os.path.getsize(screenshot_path) > 1000: log_to_client(f"✓ 截图成功: {screenshot_filename}", user_id, account_id)