Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] 缓存自动加载的图片 #34

Closed
Pil0tXia opened this issue Feb 4, 2024 · 5 comments
Closed

[Enhancement] 缓存自动加载的图片 #34

Pil0tXia opened this issue Feb 4, 2024 · 5 comments

Comments

@Pil0tXia
Copy link

Pil0tXia commented Feb 4, 2024

为什么需要增强

在默认设置下,在作品页面,点击📖图标后,将自动开始缓存作品的所有图片。

但是,如果浏览器标签页被“复制”或“刷新”,并且再次点击新的标签页中的📖图标,则所有图片将重新从头开始加载。

对于页数较多的单行本作品,这种行为将消耗大量配额。

如何增强

请将自动加载的图片缓存到浏览器本地,以便于在多个标签页或刷新后的标签页中复用加载过的图片。

可选:设置一个Browser TTL(例如:4 小时)

感谢!

@MapoMagpie
Copy link
Owner

9b92915
尝试做了点修改,图片地址不改变的话,基本都会被缓存。(当然还受浏览器的缓存设置影响)
但是图片地址改变的话,就不好办了。
比如e-hentai,一张原图,服务器有概率返回不同的最终地址,不过概率不算高。
比如nhentai,每次页面重新加载后,大图的地址有概率指向到其他服务器,如i[编号].nhentai.net,目测更换地址的概率有一半左右。
hitmio的图片地址倒是比较稳定。

暂存图片的最终地址这个办法应该能继续提高缓存利用率,后面再考虑考虑。

@Pil0tXia
Copy link
Author

Pil0tXia commented Feb 5, 2024

@MapoMagpie

我这边使用 9b92915 的脚本测试了一下,已经可以利用缓存了。图片会经历fetching阶段,然后很快变成fetched状态,没有了图片下方加载的进度条。

浏览器本身也无法适应图片地址改变的情况,一旦url改变就会重新加载。我觉得这个情况很正常,可以接受~

@Pil0tXia
Copy link
Author

Pil0tXia commented Feb 7, 2024

使用GreasyFork发布的v4.3.1脚本时,图片下方的加载进度条再次出现并加载了,与exhentai.org域名的TCP连接的下行速度为1.5kb/s,请问是缓存失效了还是在验证缓存呢?

@MapoMagpie
Copy link
Owner

MapoMagpie commented Feb 8, 2024

缓存失效了吧,图片的连接一般都是hath.network,一个类似区块链的内容分发网络,图片地址变动很正常。

与exhentai.org域名的TCP连接的下行速度为1.5kb/s

这个速度应该比较正常,因为要从图片的单页解析大图地址,而一个图片的单页一般也就2kb左右。

@Pil0tXia
Copy link
Author

Pil0tXia commented Feb 8, 2024

Completed in 9b92915

@Pil0tXia Pil0tXia closed this as completed Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants