optimize: github拦截配置中,`*.fastgit.org` 更换为 `gh.api.99988866.xyz/https://github.com`,因为 `*.fastgit.org` 已经无法使用。
parent
09857d4153
commit
5a96635844
|
@ -17,12 +17,12 @@ function get () {
|
|||
const getDefaultConfigBasePath = function () {
|
||||
return get().server.setting.userBasePath
|
||||
}
|
||||
function _getRemoteSavePath (prefix = '', version = '') {
|
||||
function _getRemoteSavePath (prefix = '') {
|
||||
const dir = getDefaultConfigBasePath()
|
||||
if (!fs.existsSync(dir)) {
|
||||
fs.mkdirSync(dir)
|
||||
}
|
||||
return path.join(dir, prefix + 'remote_config.json' + version)
|
||||
return path.join(dir, prefix + 'remote_config.json5')
|
||||
}
|
||||
function _getConfigPath () {
|
||||
const dir = getDefaultConfigBasePath()
|
||||
|
@ -64,7 +64,7 @@ const configApi = {
|
|||
return
|
||||
}
|
||||
if (response && response.statusCode === 200) {
|
||||
const originalRemoteSavePath = _getRemoteSavePath('original_', '5')
|
||||
const originalRemoteSavePath = _getRemoteSavePath('original_')
|
||||
fs.writeFileSync(originalRemoteSavePath, body)
|
||||
log.info('保存原来的远程配置文件成功:', originalRemoteSavePath)
|
||||
|
||||
|
|
|
@ -52,14 +52,14 @@ module.exports = {
|
|||
intercepts: {
|
||||
'github.com': {
|
||||
'/.*/.*/releases/download/': {
|
||||
redirect: 'download.fastgit.org',
|
||||
redirect: 'gh.api.99988866.xyz/https://github.com',
|
||||
desc: 'release文件加速下载跳转地址'
|
||||
},
|
||||
'/.*/.*/archive/': {
|
||||
redirect: 'download.fastgit.org'
|
||||
redirect: 'gh.api.99988866.xyz/https://github.com'
|
||||
},
|
||||
'/.*/.*/blame/': {
|
||||
redirect: 'hub.fastgit.org'
|
||||
redirect: 'gh.api.99988866.xyz/https://github.com'
|
||||
},
|
||||
'^/[^/]+/[^/]+(/releases(/.*)?)?$': {
|
||||
script: [
|
||||
|
@ -69,15 +69,9 @@ module.exports = {
|
|||
},
|
||||
'/.*': {
|
||||
proxy: 'github.com',
|
||||
// proxy: 'gh.docmirror.top/_proxy',
|
||||
desc: '目前禁掉sni就可以直接访问,如果后续github.com的ip被封锁,只能再走proxy模式',
|
||||
sni: 'baidu.com'
|
||||
}
|
||||
// '/.*/.*/raw11/': {
|
||||
// replace: '(.+)\\/raw\\/(.+)',
|
||||
// proxy: 'raw.fastgit.org$1/$2',
|
||||
// sni: 'baidu.com'
|
||||
// }
|
||||
},
|
||||
'github-releases.githubusercontent.com': {
|
||||
'.*': {
|
||||
|
|
|
@ -67,6 +67,11 @@ const serverApi = {
|
|||
}
|
||||
}
|
||||
serverConfig.plugin = allConfig.plugin
|
||||
|
||||
if (allConfig.proxy && allConfig.proxy.enabled) {
|
||||
serverConfig.proxy = allConfig.proxy
|
||||
}
|
||||
|
||||
// fireStatus('ing') // 启动中
|
||||
const basePath = serverConfig.setting.userBasePath
|
||||
const runningConfigPath = path.join(basePath, '/running.json')
|
||||
|
@ -125,13 +130,13 @@ const serverApi = {
|
|||
// fireStatus('ing')// 关闭中
|
||||
server.close((err) => {
|
||||
if (err) {
|
||||
log.info('close error', err, ',', err.code, ',', err.message, ',', err.errno)
|
||||
log.warn('close error', err, ',', err.code, ',', err.message, ',', err.errno)
|
||||
if (err.code === 'ERR_SERVER_NOT_RUNNING') {
|
||||
log.info('代理服务关闭成功')
|
||||
resolve()
|
||||
return
|
||||
}
|
||||
log.info('代理服务关闭失败', err)
|
||||
log.warn('代理服务关闭失败', err)
|
||||
reject(err)
|
||||
} else {
|
||||
log.info('代理服务关闭成功')
|
||||
|
|
Loading…
Reference in New Issue