optimize: script配置为字符串时,也会自动生成辅助拦截配置。

pull/303/head
王良 2024-04-19 17:18:17 +08:00
parent 6d015d8cc0
commit a6e3d57e35
2 changed files with 7 additions and 6 deletions

View File

@ -56,13 +56,10 @@ module.exports = {
sni: 'baidu.com'
},
'^(/[\\w-.]+){2,}/?(\\?.*)?$': {
// 自定义篡改猴插件地址配置
// 篡改猴插件地址,以下是高速镜像地址
tampermonkeyScript: 'https://mirror.ghproxy.com/https://raw.githubusercontent.com/docmirror/dev-sidecar/scripts/tampermonkey.js',
// 脚本地址配置
script: [
// Github油猴脚本
'https://mirror.ghproxy.com/https://raw.githubusercontent.com/docmirror/dev-sidecar/scripts/github/monkey.js'
],
// Github油猴脚本地址以下是高速镜像地址
script: 'https://mirror.ghproxy.com/https://raw.githubusercontent.com/docmirror/dev-sidecar/scripts/github/monkey.js',
remark: '注:上面所使用的脚本地址,为高速镜像地址。',
desc: '油猴脚本:高速下载 Git Clone/SSH、Release、Raw、Code(ZIP) 等文件 (公益加速)、项目列表单文件快捷下载、添加 git clone 命令'
},

View File

@ -116,6 +116,10 @@ module.exports = {
pathConfig.script[i] = scriptKey
})
}
} else if (typeof pathConfig.script === 'string') {
handleScriptUrl(pathConfig.script, 'script', (scriptKey) => {
pathConfig.script = scriptKey
})
}
// 处理 tampermonkeyScript 配置