Skip to content

Commit

Permalink
新增一个拦截配置:仓库内脚本,重定向改为代理,并设置响应头Content-Type。作用:方便script拦截器直接使用,避免引起跨域问题…
Browse files Browse the repository at this point in the history
…和脚本内容限制问题。
  • Loading branch information
wangliang181230 committed Apr 16, 2024
1 parent f4e00a5 commit 5ac73a3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/core/src/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ module.exports = {
// '/.*/.*/blame/': {
// redirect: 'gh.api.99988866.xyz/https://github.com'
// },
'^(/[^/]+){2}([/?].*)?$': {
'^(/[^/.]{1,30}){2}([/?].*)?$': {
script: [
'github'
],
Expand All @@ -86,6 +86,12 @@ module.exports = {
proxy: 'https://raw.githubusercontent.com${m[1]}${m[3]}',
cacheDays: 7,
desc: '仓库内图片,重定向改为代理,并缓存7天。'
},
'^((/[^/]+){2,})/raw((/[^/]+)+\\.js)(\\?.*)?$': {
// eslint-disable-next-line no-template-curly-in-string
proxy: 'https://raw.githubusercontent.com${m[1]}${m[3]}',
responseReplace: { headers: { 'content-type': 'application/javascript; charset=utf-8' } },
desc: '仓库内脚本,重定向改为代理,并设置响应头Content-Type。作用:方便script拦截器直接使用,避免引起跨域问题和脚本内容限制问题。'
}
},
'github-releases.githubusercontent.com': {
Expand Down

0 comments on commit 5ac73a3

Please sign in to comment.