fix: 深度重构修复 V3 ServiceWorker 崩溃异常与豆瓣最新反爬虫封锁 (0.13.0)#121
Open
ziyangxiami wants to merge 10 commits into
Open
Conversation
- Replaced global Referer overwrite in background.js with specific endpoint rules - Added credentials 'include' to fetch in service.js for cross-origin cookies - Extracted ServiceProxy to handle UI to Background ServiceWorker RPC messaging in MV3
…olation
- Modified service.js to explicitly dispatch CustomEvent('log') via overriding dispatchEvent
- Fixed Property access for 'detail' payload so it transmits over chrome.runtime.Port correctly
- Updated options.js to listen to 'service.addEventListener' instead of 'service.logger.addEventListener'
- status.js: Fixed pagination issue where inclusive max_id caused ConstraintError loop - review.js: Refactored fetchReview to use fallback DOM selectors (#link-report) and prevent crashes on missing content
- Added html_parser.js (bundled node-html-parser) to replace 'document.implementation.createHTMLDocument' since MV3 ServiceWorkers lack DOM access - Refactored 'await import()' to static module mapping in service.js because dynamic imports are disallowed on ServiceWorkerGlobalScope
- options.js: Migrated synchronous getter usage (e.g. service.status, service.currentJob) to await getProperty() for real-time MV3 proxy tracking - ServiceProxy.js: Fixed uncaught TypeErrors generated by Zepto internal reflection correctly resolving non-function EventTarget properties without attempting .apply - Task.js: Ensure local task name getter value survives JSON serialization crossing the MV3 boundary
- explorer.js: Injected Zepto `$.fn.attr` interceptor to globally rewrite obsolete `/view/subject/m/public/` thumbnail paths to the new active `/view/subject/s/public/` endpoints since old indexedDB data contains stale CDN routes.
…hotlinking - Added a declarativeNetRequest rule hitting '*.doubanio.com/*' for 'image' and 'xmlhttprequest' types to append 'Referer: https://m.douban.com/' - Resolves 418 I'm a teapot errors throwing when 'explorer.js' attempts to load backup images from Douban's servers within the Chrome extension background page origin
…ot a function - Updated 'options.js' event listeners for 'statechange' and 'progress' to explicitly pass the 'service' proxy instance rather than 'event.target'. - In MV3, 'EventTarget.dispatchEvent' natively overwrites 'event.target' to the internal object bypassing the JS Proxy.
…vent payloads - Removed the hardcoded whitelist (only forwarding 'progress' and 'statechange') which silently dropped 'log' events sent by the MV3 Service Worker. - Rewrote the proxy event forwarding to unwrap 'message.detail' properties instead of double-nesting them inside the 'CustomEvent' detail, fixing missing logs rendering inside 'options.js'.
- Bumped the package version from 0.12.2 to 0.13.0 within 'manifest.json' indicating a stable tracker repair release. - Updated 'README.md' to showcase 0.13.0's MV3 crash fixes, Douban cookie cross-origin routing resolution natively combating 1287 tracking, CDN Image bypassing rules, and removed the resolved tracking bugs. - Updated internal developer artifact notes detailing the exact solutions for the deep integration bugs between Chrome extension page Service Workers and Douban's CDN.
|
感谢!手动加载到浏览器里,备份终于跑出来了 |
|
太强了!!!!完美可用!!!! |
|
书/影/音/游戏记录能正常备份,豆列似乎备份不了 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔗 问题背景与动机
由于 Chrome 推进扩展 Manifest V3,叠加近期豆瓣严苛的 API 反爬风控与 CDN 图片防盗链机制,导致插件原有架构全线瘫痪。本次 PR 进行了深度重构与底层机制更替,清扫了大量的陈年 Bug,使得插件恢复了稳定运行和所有的核心备份能力。
🛠 核心修复与改动清单
Manifest V3 运行环境与底层隔离异常
CustomEvent事件转发event.target被浏览器原生覆盖导致的getProperty is not a function界面挂死问题。同时解除了硬编码白名单、修复了message.detail数据多层嵌套解析引发的 UI 调试面板“服务日志”全白空白 Bug。document与import()禁用墙:MV3 Background Service Worker 不再支持动态加载与 DOM 操作。移除了导致全面罢工的import is disallowed报错,并将后台 HTML 解析器替换为由 esbuild 打包注入的轻量级原生引擎node-html-parser。豆瓣全面反爬虫封锁突破
1287、1283及被强制跳转到sec.douban.com的封禁。在网络构造函数 getFetchURL 强行包裹credentials: 'include',确保插件携带本地登录账号状态(dbcl2、ck 等)发起安全的跨域鉴权访问。declarativeNetRequest安全网络拦截规则,指定*.doubanio.com图片发出的Referer头伪装成https://m.douban.com/,一举破除了备份面板或网格缩略图上 HTTP418 I'm a teapot的图片显示裂图。历史遗留功能缺陷解决
🎉 测试情况