Merge remote-tracking branch 'origin/master'

pull/67/head
xiaojunnuo 2020-12-09 16:41:17 +08:00
commit 816d55a938
18 changed files with 177 additions and 34 deletions

View File

@ -39,8 +39,8 @@
* 官方与淘宝npm registry一键切换,
* 某些npm install的时候并且使用cnpm也无法安装时可以尝试开启npm代理再试
### 6、 更多加速配置
等你来提issue
### 6、 增强功能
* 等你来探索
## 快速开始
目前仅支持windows
@ -50,7 +50,7 @@
#### 1 下载安装包
下载安装包:
[阿里云](https://dev-sidecar.docmirror.cn/update/DevSidecar-1.2.2.exe)
[阿里云](http://dev-sidecar.docmirror.cn/update/DevSidecar-1.3.2.exe)
[Gitee Release](https://gitee.com/docmirror/dev-sidecar/releases)
[Github Release](https://github.com/docmirror/dev-sidecar/releases)
@ -160,8 +160,7 @@ const intercepts = {
## 问题排查
如果没有加速效果,请根据以下步骤进行排查
#### 1、请确认windows的代理设置处于勾选状态
如果已经是勾选状态,那么先取消勾选确定,然后再勾选确定,再尝试查看是否有加速效果。
#### 1. 请确认windows的代理设置处于勾选状态
如何打开查看windows代理设置
* win10: 开始->设置->网络和Internet->最下方代理
* win7: 开始->控制面板->网络和Internet->网络和共享中心->左下角Internet选项->连接选项卡->局域网设置
@ -170,6 +169,7 @@ const intercepts = {
#### 2. 尝试将代理设置关闭再重新打开
按上图中先关闭代理,保存,再打开代理,再保存
#### 3. 如果还是不行,请在下方加作者好友,将服务日志发送给作者进行分析
日志打开方式:加速服务->右边日志按钮->打开日志文件夹

View File

@ -14,5 +14,5 @@
"ignore": []
}
},
"version": "1.2.2"
"version": "1.3.2"
}

View File

@ -1,6 +1,6 @@
{
"name": "@docmirror/dev-sidecar",
"version": "1.2.2",
"version": "1.3.2",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "@docmirror/dev-sidecar",
"version": "1.2.2",
"version": "1.3.2",
"description": "给开发者的加速代理工具",
"main": "src/index.js",
"keywords": [
@ -16,7 +16,7 @@
"start": "node ./start"
},
"dependencies": {
"@docmirror/mitmproxy": "^1.2.2",
"@docmirror/mitmproxy": "^1.3.2",
"agentkeepalive": "^2.1.1",
"babel-preset-es2020": "^1.0.2",
"charset": "^1.0.0",
@ -73,5 +73,6 @@
"> 1%",
"last 2 versions",
"not dead"
]
],
"gitHead": "50b256b12aa1e03fe565c3f7fda9ca9b862064c0"
}

View File

@ -161,6 +161,9 @@ module.exports = {
}
},
mapping: {
'assets.fastgit.org': 'usa',
'*yarnpkg.com': 'usa',
'*cloudfront.net': 'usa',
'*github.io': 'usa',
'img.shields.io': 'usa',
'*.github.com': 'usa',
@ -169,7 +172,6 @@ module.exports = {
// "解决push的时候需要输入密码的问题",
'github.com': 'usa',
'*.vuepress.vuejs.org': 'usa',
'github.docmirror.cn': 'usa',
'gh.docmirror.top': 'usa'
}
}

View File

@ -0,0 +1,7 @@
module.exports = {
name: 'Git代理',
enabled: false,
setting: {
sslVerify: false
}
}

View File

@ -0,0 +1,65 @@
const pluginConfig = require('./config')
const Plugin = function (context) {
const { config, shell, event, log } = context
const pluginApi = {
async start () {
const ip = '127.0.0.1'
const port = config.get().server.port
await pluginApi.setProxy(ip, port)
return { ip, port }
},
async close () {
return pluginApi.unsetProxy()
},
async restart () {
await pluginApi.close()
await pluginApi.start()
},
async save (newConfig) {
},
async setProxy (ip, port) {
const cmds = [
`git config --global http.proxy http://${ip}:${port} `,
`git config --global https.proxy http://${ip}:${port} `
]
if (pluginConfig.setting.sslVerify === true) {
cmds.push('git config --global http.sslVerify false ')
}
const ret = await shell.exec(cmds, { type: 'cmd' })
event.fire('status', { key: 'plugin.git.enabled', value: true })
log.info('开启【Git】代理成功')
return ret
},
async unsetProxy () {
const cmds = [
'git config --global --unset https.proxy ',
'git config --global --unset http.proxy '
]
if (pluginConfig.setting.sslVerify === true) {
cmds.push('git config --global http.sslVerify true ')
}
const ret = await shell.exec(cmds, { type: 'cmd' })
event.fire('status', { key: 'plugin.git.enabled', value: false })
log.info('关闭【Git】代理成功')
return ret
}
}
return pluginApi
}
module.exports = {
key: 'git',
config: pluginConfig,
status: {
enabled: false
},
plugin: Plugin
}

View File

@ -1,5 +1,7 @@
const node = require('./node')
const git = require('./git')
const overwall = require('./overwall')
module.exports = {
node, overwall
node, git, overwall
}

View File

@ -1,6 +1,6 @@
{
"name": "@docmirror/dev-sidecar-gui",
"version": "1.2.2",
"version": "1.3.2",
"private": false,
"license": "MPL-2.0",
"scripts": {
@ -15,8 +15,8 @@
"author": "docmirror.cn",
"main": "background.js",
"dependencies": {
"@docmirror/dev-sidecar": "^1.2.2",
"@docmirror/mitmproxy": "^1.2.2",
"@docmirror/dev-sidecar": "^1.3.2",
"@docmirror/mitmproxy": "^1.3.2",
"ant-design-vue": "^1.6.5",
"core-js": "^3.6.5",
"electron-baidu-tongji": "^1.0.5",
@ -70,5 +70,6 @@
"last 2 versions",
"not dead"
],
"__npminstall_done": false
"__npminstall_done": false,
"gitHead": "50b256b12aa1e03fe565c3f7fda9ca9b862064c0"
}

View File

@ -95,14 +95,14 @@ function updateHandle (app, win, beforeQuit, updateUrl, log) {
export default {
install (context) {
const { app, win, beforeQuit, log } = context
let updateUrl = 'https://dev-sidecar.docmirror.cn/update/'
let updateUrl = 'http://dev-sidecar.docmirror.cn/update/'
if (process.env.NODE_ENV === 'development') {
Object.defineProperty(app, 'isPackaged', {
get () {
return true
}
})
// updateUrl = 'https://dev-sidecar.docmirror.cn/update/'
// updateUrl = 'http://dev-sidecar.docmirror.cn/update/'
updateUrl = 'http://localhost/dev-sidecar/'
}
updateHandle(app, win, beforeQuit, updateUrl, log)

View File

@ -0,0 +1,61 @@
<template>
<ds-container>
<template slot="header">
Git代理设置
<span>
</span>
</template>
<div v-if="config">
<a-form layout="horizontal">
<a-form-item label="启用Git代理" :label-col="labelCol" :wrapper-col="wrapperCol">
<a-checkbox v-model="config.plugin.git.enabled">
随应用启动
</a-checkbox>
<a-tag v-if="status.plugin.git.enabled" color="green">
当前已启动
</a-tag>
<a-tag v-else color="red">
当前未启动
</a-tag>
</a-form-item>
<a-form-item label="SSL校验" :label-col="labelCol" :wrapper-col="wrapperCol">
<a-checkbox v-model="config.plugin.git.setting.sslVerify">
关闭sslVerify
</a-checkbox>
安装Git时未选择使用系统证书管理服务时必须关闭
</a-form-item>
</a-form>
</div>
<template slot="footer">
<div class="footer-bar">
<a-button class="md-mr-10" icon="sync" @click="resetDefault()"></a-button>
<a-button :loading="applyLoading" icon="check" type="primary" @click="apply()"></a-button>
</div>
</template>
</ds-container>
</template>
<script>
import Plugin from '../../mixins/plugin'
export default {
name: 'Git',
mixins: [Plugin],
data () {
return {
key: 'plugin.git'
}
},
created () {
console.log('status:', this.status)
},
mounted () {
},
methods: {
ready () {
}
}
}
</script>

View File

@ -19,7 +19,7 @@
当前未启动
</a-tag>
</a-form-item>
<a-form-item label="SSL相关" :label-col="labelCol" :wrapper-col="wrapperCol">
<a-form-item label="SSL校验" :label-col="labelCol" :wrapper-col="wrapperCol">
<a-checkbox v-model="config.plugin.node.setting['strict-ssl']">
关闭strict-ssl
</a-checkbox>

View File

@ -2,6 +2,7 @@ import Index from '../pages/index'
import Server from '../pages/server'
import Proxy from '../pages/proxy'
import Node from '../pages/plugin/node'
import Git from '../pages/plugin/git'
import Overwall from '../pages/plugin/overwall'
const routes = [
@ -10,6 +11,7 @@ const routes = [
{ path: '/server', component: Server },
{ path: '/proxy', component: Proxy },
{ path: '/plugin/node', component: Node },
{ path: '/plugin/git', component: Git },
{ path: '/plugin/overwall', component: Overwall }
]

View File

@ -1,6 +1,7 @@
export default function createMenus (app) {
const plugins = [
{ title: 'NPM加速', path: '/plugin/node', icon: 'like' }
{ title: 'NPM加速', path: '/plugin/node', icon: 'like' },
{ title: 'Git代理', path: '/plugin/git', icon: 'github' }
]
const menus = [
{ title: '首页', path: '/index', icon: 'home' },

View File

@ -901,12 +901,12 @@
ajv "^6.12.0"
ajv-keywords "^3.4.1"
"@docmirror/dev-sidecar@^1.2.0":
version "1.2.0"
resolved "https://registry.yarnpkg.com/@docmirror/dev-sidecar/-/dev-sidecar-1.2.0.tgz#2320c31f786afd495b8e12557bea396cb96e0985"
integrity sha512-i96YlPjQtrrAgDW52YOpuVFmQDl1A0Nx3x6/riv2yKVN4nGqAugdJvcAuhNi7BDrJfdLyls2jI35uzN5+bpYfQ==
"@docmirror/dev-sidecar@^1.2.2":
version "1.2.2"
resolved "https://registry.yarnpkg.com/@docmirror/dev-sidecar/-/dev-sidecar-1.2.2.tgz#4963a9dd9f3f46e614e1c1479887b8680f0f6650"
integrity sha512-gWD5WPuyijIuFrpinMR0QSLdqdhLEfZVi9lnRSor9TnnaoBpeY6QlufHACpDDo6hME8f62adXGFmL3UoFJS49Q==
dependencies:
"@docmirror/mitmproxy" "^1.2.0"
"@docmirror/mitmproxy" "^1.2.2"
agentkeepalive "^2.1.1"
charset "^1.0.0"
child_process "^1.0.2"
@ -933,10 +933,10 @@
validator "^13.1.17"
winreg "^1.2.4"
"@docmirror/mitmproxy@^1.2.0":
version "1.2.0"
resolved "https://registry.yarnpkg.com/@docmirror/mitmproxy/-/mitmproxy-1.2.0.tgz#ab9910031272d8e16fe0e38d434f7b42971bc74e"
integrity sha512-DlzquSNVZOC/p5GwAdDwSiI4KCb3HlUY4A44pGGOBehsNThBoRU8ESKJjbyay9ah4RPSAWTSVYgMEiPZctR+wg==
"@docmirror/mitmproxy@^1.2.2":
version "1.2.2"
resolved "https://registry.yarnpkg.com/@docmirror/mitmproxy/-/mitmproxy-1.2.2.tgz#a4d0020e073eaa68adb7902b5634ab2a1a3bc058"
integrity sha512-xW1xyqUfpGAZZTzqSjoQM0Mmq8VVEyvS8AiTUBvgpxUAYG2sqNCacLETwYfNBP1MStUBtGXKklcISpIY6+R+DA==
dependencies:
agentkeepalive "^2.1.1"
child_process "^1.0.2"

View File

@ -1,6 +1,6 @@
{
"name": "@docmirror/mitmproxy",
"version": "1.2.2",
"version": "1.3.2",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "@docmirror/mitmproxy",
"version": "1.2.2",
"version": "1.3.2",
"description": "",
"main": "src/index.js",
"keywords": [
@ -63,5 +63,6 @@
"> 1%",
"last 2 versions",
"not dead"
]
],
"gitHead": "50b256b12aa1e03fe565c3f7fda9ca9b862064c0"
}

View File

@ -27,7 +27,7 @@ module.exports = function createOverWallIntercept (overWallConfig) {
if (keys.length === 0) {
return null
}
const regexpMap = matchUtil.domainMapRegexply(overWallConfig.intercepts)
const regexpMap = matchUtil.domainMapRegexply(overWallConfig.targets)
return {
sslConnectInterceptor: (req, cltSocket, head) => {
const hostname = req.url.split(':')[0]