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

境内使用Cloudflare CDN加载pdf.worker.js速度很慢 #156

Open
arkylin opened this issue May 13, 2023 · 3 comments
Open

境内使用Cloudflare CDN加载pdf.worker.js速度很慢 #156

arkylin opened this issue May 13, 2023 · 3 comments

Comments

@arkylin
Copy link
Contributor

arkylin commented May 13, 2023

使用Cloudflare CDN加载pdf.worker.js速度很慢,导致加载pdf很慢,建议更换其他在国内外加载速度都很快的CDN或者文件本地化

pdfjs.GlobalWorkerOptions.workerSrc = //cdnjs.cloudflare.com/ajax/libs/pdf.js/${pdfjs.version}/pdf.worker.js;

@hessonsu
Copy link

哦了?yarn start 要等二十多分钟才能启动起来。是因为这个吧?有无更换的步骤介绍下。后端初涉前端开发。

@arkylin
Copy link
Contributor Author

arkylin commented May 25, 2023

不清楚,我是在访问页面-打开PDF文件的时候发现打开很慢,然后一查发现是cloudflare的cdn加载的文件速度很慢

@YUDONGLING
Copy link

YUDONGLING commented Nov 28, 2023

For users in mainland, you can easily change this setting without self-build the frontend:

  1. use ./cloudreve -eject to extract the built-in static resources into statics directory;
  2. in file ./statics/static/js/pdf.________.chunk.js, replace i.pdfjs.GlobalWorkerOptions.workerSrc="//cdnjs.cloudflare.com/ajax/libs/pdf.js/".concat(i.pdfjs.version,"/pdf.worker.js"); to i.pdfjs.GlobalWorkerOptions.workerSrc="//lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/pdf.js/".concat(i.pdfjs.version,"/pdf.worker.js");;
  3. clear cache.

Hint: Here use the pdf.worker.js provided by ByteDance Public CDN, from cdn.bytedance.com, use other source is also okay.

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

3 participants