Fix ExHentai image reload retries - #1327
Open
DolphinZZZZZ wants to merge 1 commit into
Open
DolphinZZZZZ wants to merge 1 commit into
DolphinZZZZZ wants to merge 1 commit into
Conversation
|
@DolphinZZZZZ is attempting to deploy a commit to the machsix's projects Team on Vercel. A member of the Team first needs to authorize it. |
This branch has not been deployed
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.
提交这个 PR 的理由
这个改动主要针对 E-Hentai / ExHentai 图片页上的一个实际失败场景。
当图片加载失败时,网站本身会通过
nl(...)重试 token 请求另一个图片源。这个机制在原始页面上通常还能使用,但在 Super-preloader 插入的新页面里不太可靠:被插入的图片元素和加载失败元素可能会丢失原始的 ID / 事件处理逻辑,导致插入页里的失败图片不容易手动重试。另一个实际影响是,失败图片的原站重试 / 重新加载流程可能会干扰当前滚动位置。自动翻页后,如果前面某张失败图片触发重试,页面可能会被重新拉回前面的图片位置,造成用户明明在继续往下滑,却又被拽回去。
这个 PR 增加了 ExHentai 专用的重试处理,让当前页和 Super-preloader 插入页里的失败图片都可以通过同一套
nltoken 流程重试。实现上尽量把重试限制在失败图片元素本身:后台请求新的重试结果,解析新的图片地址和 token,然后原地替换对应图片,避免为了重试而触发整页跳转、地址变化或滚动位置跳回。这里使用
document-start,是因为重试 hook 需要尽早安装,最好在页面脚本定义或调用nl(...)之前介入。Summary
nl(...)retry tokensdocument-startso the page-level retry hook can be installed before the site defines handlersdist/Super_preloaderPlus_one_New.user.jsVerification
npx --yes pnpm@10.25.0 -C . run buildpassednpx --yes pnpm@10.25.0 -C . run checkpassed lint and typecheck;format:checkfails on pre-existing unmodified docs files:docs/.vitepress/cn.ts,config.ts,en.ts,theme/index.tsnode --check dist/Super_preloaderPlus_one_New.user.jspassedpnpm run testis blocked in this local environment by TLS certificate verification when downloading Violentmonkey; withNODE_TLS_REJECT_UNAUTHORIZED=0, download/browser launch succeeds but the local VM install flow times out before assertions