From 5ac73a381c39430d2c8c55aa4fb18b87d4a31039 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E8=89=AF?= <841369634@qq.com> Date: Tue, 16 Apr 2024 13:03:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=B8=80=E4=B8=AA=E6=8B=A6?= =?UTF-8?q?=E6=88=AA=E9=85=8D=E7=BD=AE=EF=BC=9A=E4=BB=93=E5=BA=93=E5=86=85?= =?UTF-8?q?=E8=84=9A=E6=9C=AC=EF=BC=8C=E9=87=8D=E5=AE=9A=E5=90=91=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E4=BB=A3=E7=90=86=EF=BC=8C=E5=B9=B6=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E5=93=8D=E5=BA=94=E5=A4=B4Content-Type=E3=80=82=E4=BD=9C?= =?UTF-8?q?=E7=94=A8=EF=BC=9A=E6=96=B9=E4=BE=BFscript=E6=8B=A6=E6=88=AA?= =?UTF-8?q?=E5=99=A8=E7=9B=B4=E6=8E=A5=E4=BD=BF=E7=94=A8=EF=BC=8C=E9=81=BF?= =?UTF-8?q?=E5=85=8D=E5=BC=95=E8=B5=B7=E8=B7=A8=E5=9F=9F=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E5=92=8C=E8=84=9A=E6=9C=AC=E5=86=85=E5=AE=B9=E9=99=90=E5=88=B6?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/src/config/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/core/src/config/index.js b/packages/core/src/config/index.js index 1394e3db..6fa1650f 100644 --- a/packages/core/src/config/index.js +++ b/packages/core/src/config/index.js @@ -63,7 +63,7 @@ module.exports = { // '/.*/.*/blame/': { // redirect: 'gh.api.99988866.xyz/https://github.com' // }, - '^(/[^/]+){2}([/?].*)?$': { + '^(/[^/.]{1,30}){2}([/?].*)?$': { script: [ 'github' ], @@ -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': {