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

一些小问题 #13

Closed
cxw620 opened this issue Jun 5, 2022 · 3 comments
Closed

一些小问题 #13

cxw620 opened this issue Jun 5, 2022 · 3 comments

Comments

@cxw620
Copy link

cxw620 commented Jun 5, 2022

首先是npm上传脚本似乎不能识别已经上传了的文件, 就算服务端返回404还是提示files existed.
同时建议添加npm.elemecdn.com.
再有, 我利用freecdn打包了一批静态文件, 然后把生成的js和清单文件都复制到另外一个站点使用, 我不清楚是不是有限制, 一部分由静态文件内的js发起的请求并没有被serviceworker过滤而是直接访问了实际站点. 请问有什么解决方案.
注: 假设js请求的站点是A, 我实际访问的站点是B, js请求A获取同样已经通过freecdn处理上传到npm库了的css文件等没有被过滤
又注: 我希望打包好文件后只需要复制生成的js文件和清单文件就可以复用, 因为jsdelivr众所周知挂了, 我在用live2d, 模型文件比较耗流量. 发现npm.elemecdn.com直接反向代理了unpkg.com, 如果能解决掉这个问题就好了

图示
B站点
image
A站点直接访问A站点测试live2d的页面
image

@EtherDream
Copy link
Owner

上传脚本目前是通过访问 unpkg.com 检测文件是否已上传(根据 HEAD 请求是否返回 200 检测文件存在)。可能 unpkg.com 已回源成功,其他 jsdelivr 或 elemecdn 还没同步,出现 404。我打算改进下,直接用 npm 命令检测这个版本是否已发布,这样更准确些。

如果资源被 sw 拦截到,但仍然访问原始 url 而不是备用 url,可能是原始站点的权重更高一些,可以试试权重配置

@EtherDream
Copy link
Owner

现在用 NPM 命令检测文件是否发布过,应该更稳定一些:https://github.com/EtherDream/freecdn/blob/master/examples/free-host/npm-upload.sh

elemecdn 没加,第三方 CDN 往 list 里加一行就可以:

list="$list
$hash https://unpkg.com/$dst
$hash https://cdn.jsdelivr.net/npm/$dst
$hash https://npm.elemecdn.com/$dst
"

@cxw620
Copy link
Author

cxw620 commented Jun 11, 2022

改天再试试, 先close issue了.

@cxw620 cxw620 closed this as completed Jun 11, 2022
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