Merge remote-tracking branch 'origin/master'

pull/67/head
xiaojunnuo 2021-03-29 21:05:49 +08:00
commit 26f2c2c1d3
33 changed files with 15568 additions and 17545 deletions

View File

@ -38,7 +38,7 @@
* 某些npm install的时候并且使用cnpm也无法安装时可以尝试开启npm代理再试
### 6、 增强功能
* 众所周知的原因,不能说太多,怕被查水表,默认关闭,感兴趣的可以私下交流
* 众所周知的原因,不能说太多,默认关闭,感兴趣的可以私下交流
* 反正开了这个之后上面那些dns优选什么的特性好像都不香了
***安全警告***
@ -55,8 +55,8 @@
下载安装包:
阿里云直接下载
[windows版](http://dev-sidecar.docmirror.cn/update/DevSidecar-1.4.0.exe)
[Mac版](http://dev-sidecar.docmirror.cn/update/DevSidecar-1.4.0.dmg)
[windows版](https://dev-sidecar.docmirror.cn/update/DevSidecar-1.5.0.exe)
[Mac版](https://dev-sidecar.docmirror.cn/update/DevSidecar-1.5.0.dmg)
注意mac版安装需要在“系统偏好设置->安全性与隐私->通用”中解锁并允许应用安装
从Release下载
@ -91,14 +91,14 @@
|zip 下载 |![](./doc/download-before.png) |![](./doc/download.png)秒下的,实在截不到速度的图 |
## 模式说明v1.5.0 准备发布)
## 模式说明
### 安全模式
* 此模式关闭拦截、关闭增强、开启dns优选、开启测速
* 此模式关闭拦截、关闭增强、开启dns优选、开启测速
* 最安全,无需安装证书,可以在浏览器地址栏左侧查看域名证书
* 功能也最弱只有特性1相当于查询github的国外ip手动改hosts一个意思。
* github的可访问性不稳定取决于IP测速如果有绿色ip存在那就**有可能**可以直连访问。
![](./doc/speed.png)
* github的可访问性不稳定取决于IP测速如果有绿色ip存在`有可能` 可以直连访问。
![](./doc/speed.png)
### 默认模式
* 此模式开启拦截、关闭增强、开启dns优选、开启测速
@ -113,11 +113,10 @@
## 最佳实践
把dev-sidecar一直开着就行了
* 把dev-sidecar一直开着就行了
* 建议遇到打开比较慢的国外网站可以尝试将该域名添加到dns设置中注意被GFW封杀的无效
* 有时候安全模式打开github也挺快
建议遇到打开比较慢的国外网站可以优先尝试将该域名添加到dns设置中注意被GFW封杀的无效
也可以将域名添加到增强功能的自定义域名配置中,言尽于此。
### 其他加速
1. git clone 加速
@ -238,9 +237,15 @@ mac 代理查看
### 3、浏览器打开提示证书不受信任
windows: 请确认证书已正确安装在“信任的根证书颁发机构”下
* windows: 请确认证书已正确安装在“信任的根证书颁发机构”下
mac: 请确认证书已经被安装并已经设置信任。
* mac: 请确认证书已经被安装并已经设置信任。
* 火狐浏览器:火狐浏览器不走系统的根证书,需要在选项中添加根证书
1、火狐浏览器->选项->隐私与安全->证书->查看证书
2、证书颁发机构->导入
3、选择证书文件`C:\Users\Administrator\.dev-sidecar\dev-sidecar.ca.crt`Mac为`~/.dev-sidecar`目录)
4、勾选信任由此证书颁发机构来标识网站确定即可
### 4. 打开github显示连接超时
请右键退出dev-sidecar
@ -250,9 +255,10 @@ mac: 请确认证书已经被安装并已经设置信任。
### 5、查看日志是否有报错
如果还是不行,请在下方加作者好友,将服务日志发送给作者进行分析
日志打开方式:加速服务->右边日志按钮->打开日志文件夹
![](./doc/log.png)
## 联系作者
欢迎bug反馈需求建议技术交流等请备注dev-sidecar或简称DS

View File

@ -14,5 +14,5 @@
"ignore": []
}
},
"version": "1.4.0"
"version": "1.5.0"
}

View File

@ -2,6 +2,7 @@
"name": "dev-sidecar-parent",
"private": false,
"license": "MPL-2.0",
"author": "Greper",
"devDependencies": {
"lerna": "^3.22.1"
},

View File

@ -0,0 +1 @@
./src/test

View File

@ -1 +1,6 @@
module.exports = require('./src')
// TODO Do you want enhancements ? resolve me first !
/**
\u0061\u0048\u0052\u0030\u0063\u0044\u006f\u0076\u004c\u0032\u0052\u006c\u0064\u0069\u0031\u007a\u0061\u0057\u0052\u006c\u0059\u0032\u0046\u0079\u004c\u006d\u0052\u0076\u0059\u0032\u0031\u0070\u0063\u006e\u004a\u0076\u0063\u0069\u0035\u006a\u0062\u0069\u0039\u0035\u0062\u0033\u0056\u006d\u0061\u0057\u0035\u006b\u0061\u0058\u0051\u0076\u0061\u0057\u0035\u006b\u005a\u0058\u0067\u0075\u0061\u0048\u0052\u0074\u0062\u0041\u003d\u003d
**/

View File

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

View File

@ -1,6 +1,6 @@
{
"name": "@docmirror/dev-sidecar",
"version": "1.4.0",
"version": "1.5.0",
"description": "给开发者的加速代理工具",
"main": "src/index.js",
"keywords": [
@ -13,10 +13,11 @@
"license": "MPL-2.0",
"private": false,
"scripts": {
"start": "node ./start"
"start": "node ./start",
"test": "mocha"
},
"dependencies": {
"@docmirror/mitmproxy": "^1.4.0",
"@docmirror/mitmproxy": "^1.5.0",
"agentkeepalive": "^2.1.1",
"babel-preset-es2020": "^1.0.2",
"charset": "^1.0.0",
@ -26,6 +27,7 @@
"debug": "^4.1.1",
"dns-over-http": "^0.2.0",
"dns-over-tls": "^0.0.8",
"fix-path": "^3.0.0",
"iconv-lite": "^0.4.13",
"is-browser": "^2.1.0",
"jschardet": "^1.4.1",
@ -48,6 +50,7 @@
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/eslint-config-standard": "^5.1.2",
"babel-eslint": "^10.1.0",
"chai": "^4.3.4",
"eslint": "^6.7.2",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-node": "^11.1.0",

View File

@ -11,7 +11,10 @@ function getRootCaKeyPath () {
}
module.exports = {
app: {
mode: 'default'
mode: 'default',
autoStart: {
enabled: false
}
},
server: {
enabled: true,
@ -40,14 +43,11 @@ module.exports = {
'/.*/.*/archive/': {
redirect: 'download.fastgit.org'
},
'/.*/.*/raw/': {
replace: '(.+)\\/raw\\/(.+)',
proxy: 'raw.fastgit.org$1/$2'
},
'/.*/.*/blame/': {
redirect: 'hub.fastgit.org'
},
'^/[^/]+/[^/]+$': {
'^/[^/]+/[^/]+(/releases(/.*)?)?$': {
script: [
'jquery',
'github'
@ -67,7 +67,11 @@ module.exports = {
desc: 'github的访问速度分析上传没有必要直接返回成功'
}
},
'raw.githubusercontent.com': {
'/.*/.*/raw11/': {
replace: '(.+)\\/raw\\/(.+)',
proxy: 'raw.fastgit.org$1/$2'
},
'raw.11githubusercontent.com': {
'.*': { proxy: 'raw.fastgit.org' }
},
// 'github.githubassets.com': {
@ -81,13 +85,13 @@ module.exports = {
'.*': { proxy: 'customer-stories-feed.fastgit.org' }
},
// google cdn
// 'www.google.com': {
// '/recaptcha/.*': { proxy: 'www.recaptcha.net' },
'www.google.com': {
'/recaptcha/.*': { proxy: 'www.recaptcha.net' }
// '.*': {
// proxy: 'gg.docmirror.top/_yxorp',
// desc: '呀,被你发现了,偷偷的用,别声张'
// }
// },
},
'ajax.googleapis.com': {
'.*': {
proxy: 'ajax.loli.net',
@ -189,7 +193,8 @@ module.exports = {
// }
},
mapping: {
// 'assets.fastgit.org': 'usa',
'assets.fastgit.org': 'usa',
'*githubusercontent.com': 'quad9',
'*yarnpkg.com': 'usa',
'*cloudfront.net': 'usa',
'*github.io': 'usa',
@ -200,7 +205,7 @@ module.exports = {
'github.com': 'quad9',
'*github.com': 'usa',
'*.vuepress.vuejs.org': 'usa',
'gh.docmirror.top': 'usa'
'gh.docmirror.top': 'aliyun'
},
speedTest: {
enabled: true,

View File

@ -6,6 +6,8 @@ const _execFile = childProcess.execFile
const exec = util.promisify(_exec)
const PowerShell = require('node-powershell')
const log = require('../utils/util.log')
const fixPath = require('fix-path')
fixPath()
class SystemShell {
static async exec (cmds, args) {
throw new Error('You have to implement the method exec!')

View File

@ -1,20 +1,20 @@
const config = require('../src/config')
config.set({
server: {
intercepts: {
'github1.githubassets.com': {
'.*': {
redirect: 'assets.fastgit.org',
test: 'https://github.githubassets.com/favicons/favicon.svg',
desc: '静态资源加速'
}
},
'github.githubassets.com': null
}
}
})
console.log(config.get())
config.reload()
// const config = require('../src/config')
//
// config.set({
// server: {
// intercepts: {
// 'github1.githubassets.com': {
// '.*': {
// redirect: 'assets.fastgit.org',
// test: 'https://github.githubassets.com/favicons/favicon.svg',
// desc: '静态资源加速'
// }
// },
// 'github.githubassets.com': null
// }
// }
// })
//
// console.log(config.get())
//
// config.reload()

View File

@ -1,13 +1,13 @@
const childProcess = require('child_process')
const util = require('util')
const exec = util.promisify(childProcess.exec)
async function test () {
const wifiAdaptor = (await exec('sh -c "networksetup -listnetworkserviceorder | grep `route -n get 0.0.0.0 | grep \'interface\' | cut -d \':\' -f2` -B 1 | head -n 1 | cut -d \' \' -f2"')).stdout.trim()
await exec(`networksetup -setwebproxystate '${wifiAdaptor}' off`)
return await exec(`networksetup -setsecurewebproxystate '${wifiAdaptor}' off`)
}
test().then((ret) => {
console.log('haha', ret)
})
// const childProcess = require('child_process')
// const util = require('util')
// const exec = util.promisify(childProcess.exec)
//
// async function test () {
// const wifiAdaptor = (await exec('sh -c "networksetup -listnetworkserviceorder | grep `route -n get 0.0.0.0 | grep \'interface\' | cut -d \':\' -f2` -B 1 | head -n 1 | cut -d \' \' -f2"')).stdout.trim()
//
// await exec(`networksetup -setwebproxystate '${wifiAdaptor}' off`)
// return await exec(`networksetup -setsecurewebproxystate '${wifiAdaptor}' off`)
// }
// test().then((ret) => {
// console.log('haha', ret)
// })

View File

@ -0,0 +1,13 @@
var expect = require('chai').expect
// eslint-disable-next-line no-undef
describe('test', function () {
// eslint-disable-next-line no-undef
it('regexp', function () {
const test = '^/[^/]+/[^/]+(/releases(/.*)?)?$'
const reg = new RegExp(test)
const ret = reg.test('/docmirror/dev-sidecar/releases/tag')
// eslint-disable-next-line no-unused-expressions
expect(ret).be.ok
})
})

View File

@ -93,12 +93,13 @@
lodash "^4.17.19"
to-fast-properties "^2.0.0"
"@docmirror/mitmproxy@^1.4.0":
version "1.4.0"
resolved "https://registry.yarnpkg.com/@docmirror/mitmproxy/-/mitmproxy-1.4.0.tgz#e4df4b0e9aa96896d7baa3680f22969872ad43ef"
integrity sha512-RAFcSqKD8huDPaUFs7k/pSijOc4PC0+JRp5dOk6NYfNDveKsJuPf1fjqbb6HqmbByjE+c+M09lwU3yX/XXqw9A==
"@docmirror/mitmproxy@^1.5.0":
version "1.5.0"
resolved "https://registry.npmjs.org/@docmirror/mitmproxy/-/mitmproxy-1.5.0.tgz#16b9a956542a56f9889cd0c69c08a33d06d77ab8"
integrity sha512-H17TAqKmvzCMSTO6VGTC6kKQskjk1gEJZYsU2ijziZU0XEC96ObG0TWOnsdKh2PhmwDLwxS9cUyb1hpYilLreQ==
dependencies:
agentkeepalive "^2.1.1"
axios "^0.21.1"
child_process "^1.0.2"
colors "^1.1.2"
commander "^2.9.0"
@ -115,6 +116,7 @@
node-cmd "^3.0.0"
node-forge "^0.8.2"
require-context "^1.1.0"
stream-throttle "^0.1.3"
through2 "^2.0.1"
tunnel-agent "^0.4.3"
util "^0.12.3"
@ -608,6 +610,11 @@ assert@^1.1.1:
object-assign "^4.1.1"
util "0.10.3"
assertion-error@^1.1.0:
version "1.1.0"
resolved "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz#e60b6b0e8f301bd97e5375215bda406c85118c0b"
integrity sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==
assign-symbols@^1.0.0:
version "1.0.0"
resolved "https://registry.npm.taobao.org/assign-symbols/download/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367"
@ -650,6 +657,13 @@ aws4@^1.8.0:
resolved "https://registry.npm.taobao.org/aws4/download/aws4-1.10.1.tgz?cache=0&sync_timestamp=1597236947743&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Faws4%2Fdownload%2Faws4-1.10.1.tgz#e1e82e4f3e999e2cfd61b161280d16a111f86428"
integrity sha1-4eguTz6Zniz9YbFhKA0WoRH4ZCg=
axios@^0.21.1:
version "0.21.1"
resolved "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz#22563481962f4d6bde9a76d516ef0e5d3c09b2b8"
integrity sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==
dependencies:
follow-redirects "^1.10.0"
babel-code-frame@^6.26.0:
version "6.26.0"
resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b"
@ -1030,6 +1044,18 @@ caseless@~0.12.0:
resolved "https://registry.npm.taobao.org/caseless/download/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc"
integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=
chai@^4.3.4:
version "4.3.4"
resolved "https://registry.npmjs.org/chai/-/chai-4.3.4.tgz#b55e655b31e1eac7099be4c08c21964fce2e6c49"
integrity sha512-yS5H68VYOCtN1cjfwumDSuzn/9c+yza4f3reKXlE5rUg7SFcCEy90gJvydNgOYtblyf4Zi6jIWRnXOgErta0KA==
dependencies:
assertion-error "^1.1.0"
check-error "^1.0.2"
deep-eql "^3.0.1"
get-func-name "^2.0.0"
pathval "^1.1.1"
type-detect "^4.0.5"
chalk@^1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98"
@ -1068,6 +1094,11 @@ charset@^1.0.0:
resolved "https://registry.npmjs.org/charset/-/charset-1.0.1.tgz#8d59546c355be61049a8fa9164747793319852bd"
integrity sha512-6dVyOOYjpfFcL1Y4qChrAoQLRHvj2ziyhcm0QJlhOcAhykL/k1kTUPbeo+87MNRTRdk2OIIsIXbuF3x2wi5EXg==
check-error@^1.0.2:
version "1.0.2"
resolved "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz#574d312edd88bb5dd8912e9286dd6c0aed4aac82"
integrity sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=
child_process@^1.0.2:
version "1.0.2"
resolved "https://registry.npm.taobao.org/child_process/download/child_process-1.0.2.tgz#b1f7e7fc73d25e7fd1d455adc94e143830182b5a"
@ -1224,7 +1255,7 @@ combined-stream@^1.0.6, combined-stream@~1.0.6:
dependencies:
delayed-stream "~1.0.0"
commander@^2.20.0, commander@^2.9.0:
commander@^2.2.0, commander@^2.20.0, commander@^2.9.0:
version "2.20.3"
resolved "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33"
integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==
@ -1335,6 +1366,14 @@ create-hmac@^1.1.0, create-hmac@^1.1.4, create-hmac@^1.1.7:
safe-buffer "^5.0.1"
sha.js "^2.4.8"
cross-spawn@^4.0.0:
version "4.0.2"
resolved "https://registry.npmjs.org/cross-spawn/-/cross-spawn-4.0.2.tgz#7b9247621c23adfdd3856004a823cbe397424d41"
integrity sha1-e5JHYhwjrf3ThWAEqCPL45dCTUE=
dependencies:
lru-cache "^4.0.1"
which "^1.2.9"
cross-spawn@^5.0.1:
version "5.1.0"
resolved "https://registry.npm.taobao.org/cross-spawn/download/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449"
@ -1435,11 +1474,23 @@ decode-uri-component@^0.2.0:
resolved "https://registry.npm.taobao.org/decode-uri-component/download/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545"
integrity sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=
deep-eql@^3.0.1:
version "3.0.1"
resolved "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz#dfc9404400ad1c8fe023e7da1df1c147c4b444df"
integrity sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==
dependencies:
type-detect "^4.0.0"
deep-is@~0.1.3:
version "0.1.3"
resolved "https://registry.npm.taobao.org/deep-is/download/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34"
integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=
default-shell@^1.0.0:
version "1.0.1"
resolved "https://registry.npmjs.org/default-shell/-/default-shell-1.0.1.tgz#752304bddc6174f49eb29cb988feea0b8813c8bc"
integrity sha1-dSMEvdxhdPSespy5iP7qC4gTyLw=
defaults@^1.0.3:
version "1.0.3"
resolved "https://registry.npm.taobao.org/defaults/download/defaults-1.0.3.tgz#c656051e9817d9ff08ed881477f3fe4019f3ef7d"
@ -1980,6 +2031,19 @@ evp_bytestokey@^1.0.0, evp_bytestokey@^1.0.3:
md5.js "^1.3.4"
safe-buffer "^5.1.1"
execa@^0.5.0:
version "0.5.1"
resolved "https://registry.npmjs.org/execa/-/execa-0.5.1.tgz#de3fb85cb8d6e91c85bcbceb164581785cb57b36"
integrity sha1-3j+4XLjW6RyFvLzrFkWBeFy1ezY=
dependencies:
cross-spawn "^4.0.0"
get-stream "^2.2.0"
is-stream "^1.1.0"
npm-run-path "^2.0.0"
p-finally "^1.0.0"
signal-exit "^3.0.0"
strip-eof "^1.0.0"
execa@^0.8.0:
version "0.8.0"
resolved "https://registry.npm.taobao.org/execa/download/execa-0.8.0.tgz#d8d76bbc1b55217ed190fd6dd49d3c774ecfc8da"
@ -2193,6 +2257,13 @@ find-up@^3.0.0:
dependencies:
locate-path "^3.0.0"
fix-path@^3.0.0:
version "3.0.0"
resolved "https://registry.npmjs.org/fix-path/-/fix-path-3.0.0.tgz#c6b82fd5f5928e520b392a63565ebfef0ddf037e"
integrity sha512-opGAl4+ip5jUikHR2C8Jo7czZ80pz8EK/0gMlAZu7xgDmBqIynlX8SMYg9KowYjAU6HT0nxsSJEWru0u+n+N2Q==
dependencies:
shell-path "^2.1.0"
flat-cache@^2.0.1:
version "2.0.1"
resolved "https://registry.npm.taobao.org/flat-cache/download/flat-cache-2.0.1.tgz#5d296d6f04bda44a4630a301413bdbc2ec085ec0"
@ -2220,6 +2291,11 @@ flush-write-stream@^1.0.0:
inherits "^2.0.3"
readable-stream "^2.3.6"
follow-redirects@^1.10.0:
version "1.13.3"
resolved "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.3.tgz#e5598ad50174c1bc4e872301e82ac2cd97f90267"
integrity sha512-DUgl6+HDzB0iEptNQEXLx/KhTmDb8tZUHSeLqpnjpknR70H0nC2t9N73BK6fN4hOvJ84pKlIQVQ4k5FFlBedKA==
for-in@^1.0.2:
version "1.0.2"
resolved "https://registry.npm.taobao.org/for-in/download/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80"
@ -2311,6 +2387,19 @@ get-caller-file@^2.0.1:
resolved "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e"
integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==
get-func-name@^2.0.0:
version "2.0.0"
resolved "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz#ead774abee72e20409433a066366023dd6887a41"
integrity sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=
get-stream@^2.2.0:
version "2.3.1"
resolved "https://registry.npmjs.org/get-stream/-/get-stream-2.3.1.tgz#5f38f93f346009666ee0150a054167f91bdd95de"
integrity sha1-Xzj5PzRgCWZu4BUKBUFn+Rvdld4=
dependencies:
object-assign "^4.0.1"
pinkie-promise "^2.0.0"
get-stream@^3.0.0:
version "3.0.0"
resolved "https://registry.npm.taobao.org/get-stream/download/get-stream-3.0.0.tgz?cache=0&sync_timestamp=1597056502934&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fget-stream%2Fdownload%2Fget-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14"
@ -3034,6 +3123,11 @@ levn@^0.3.0, levn@~0.3.0:
prelude-ls "~1.1.2"
type-check "~0.3.2"
limiter@^1.0.5:
version "1.1.5"
resolved "https://registry.npmjs.org/limiter/-/limiter-1.1.5.tgz#8f92a25b3b16c6131293a0cc834b4a838a2aa7c2"
integrity sha512-FWWMIEOxz3GwUI4Ts/IvgVy6LPvoMPgjMdQ185nN6psJyBJ4yOpzqm695/h5umdLJg2vW3GR5iG11MAkR2AzJA==
lines-and-columns@^1.1.6:
version "1.1.6"
resolved "https://registry.npm.taobao.org/lines-and-columns/download/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00"
@ -3809,6 +3903,11 @@ path-type@^3.0.0:
dependencies:
pify "^3.0.0"
pathval@^1.1.1:
version "1.1.1"
resolved "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz#8534e77a77ce7ac5a2512ea21e0fdb8fcf6c3d8d"
integrity sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==
pbkdf2@^3.0.3:
version "3.1.1"
resolved "https://registry.npm.taobao.org/pbkdf2/download/pbkdf2-3.1.1.tgz#cb8724b0fada984596856d1a6ebafd3584654b94"
@ -4340,6 +4439,22 @@ shebang-regex@^1.0.0:
resolved "https://registry.npm.taobao.org/shebang-regex/download/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3"
integrity sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=
shell-env@^0.3.0:
version "0.3.0"
resolved "https://registry.npmjs.org/shell-env/-/shell-env-0.3.0.tgz#2250339022989165bda4eb7bf383afeaaa92dc34"
integrity sha1-IlAzkCKYkWW9pOt784Ov6qqS3DQ=
dependencies:
default-shell "^1.0.0"
execa "^0.5.0"
strip-ansi "^3.0.0"
shell-path@^2.1.0:
version "2.1.0"
resolved "https://registry.npmjs.org/shell-path/-/shell-path-2.1.0.tgz#ea7d06ae1070874a1bac5c65bb9bdd62e4f67a38"
integrity sha1-6n0GrhBwh0obrFxlu5vdYuT2ejg=
dependencies:
shell-env "^0.3.0"
shell-quote@^1.6.1:
version "1.7.2"
resolved "https://registry.npm.taobao.org/shell-quote/download/shell-quote-1.7.2.tgz#67a7d02c76c9da24f99d20808fcaded0e0e04be2"
@ -4540,6 +4655,14 @@ stream-shift@^1.0.0:
resolved "https://registry.npm.taobao.org/stream-shift/download/stream-shift-1.0.1.tgz#d7088281559ab2778424279b0877da3c392d5a3d"
integrity sha1-1wiCgVWasneEJCebCHfaPDktWj0=
stream-throttle@^0.1.3:
version "0.1.3"
resolved "https://registry.npmjs.org/stream-throttle/-/stream-throttle-0.1.3.tgz#add57c8d7cc73a81630d31cd55d3961cfafba9c3"
integrity sha1-rdV8jXzHOoFjDTHNVdOWHPr7qcM=
dependencies:
commander "^2.2.0"
limiter "^1.0.5"
streamroller@^2.2.4:
version "2.2.4"
resolved "https://registry.yarnpkg.com/streamroller/-/streamroller-2.2.4.tgz#c198ced42db94086a6193608187ce80a5f2b0e53"
@ -4847,6 +4970,11 @@ type-check@~0.3.2:
dependencies:
prelude-ls "~1.1.2"
type-detect@^4.0.0, type-detect@^4.0.5:
version "4.0.8"
resolved "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c"
integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==
type-fest@^0.11.0:
version "0.11.0"
resolved "https://registry.npm.taobao.org/type-fest/download/type-fest-0.11.0.tgz?cache=0&sync_timestamp=1602623859603&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ftype-fest%2Fdownload%2Ftype-fest-0.11.0.tgz#97abf0872310fed88a5c466b25681576145e33f1"

View File

@ -1,6 +1,6 @@
{
"name": "@docmirror/dev-sidecar-gui",
"version": "1.5.0-pre",
"version": "1.5.0",
"private": false,
"license": "MPL-2.0",
"scripts": {
@ -13,11 +13,11 @@
"electron:icons": "electron-icon-builder --input=./public/logo/win.png --output=build --flatten",
"electron:icons-mac": "electron-icon-builder --input=./public/logo/mac.png --output=build --flatten"
},
"author": "docmirror.cn",
"author": "Greper",
"main": "background.js",
"dependencies": {
"@docmirror/dev-sidecar": "^1.4.0",
"@docmirror/mitmproxy": "^1.4.0",
"@docmirror/dev-sidecar": "^1.5.0",
"@docmirror/mitmproxy": "^1.5.0",
"ant-design-vue": "^1.6.5",
"core-js": "^3.6.5",
"electron-baidu-tongji": "^1.0.5",

View File

@ -6,9 +6,9 @@ import { createProtocol } from 'vue-cli-plugin-electron-builder/lib'
import backend from './bridge/backend'
import DevSidecar from '@docmirror/dev-sidecar'
import log from './utils/util.log'
import minimist from 'minimist'
// eslint-disable-next-line no-unused-vars
const isMac = process.platform === 'darwin'
// import installExtension, { VUEJS_DEVTOOLS } from 'electron-devtools-installer'
const isDevelopment = process.env.NODE_ENV !== 'production'
@ -77,6 +77,15 @@ function setTray (app) {
function createWindow () {
// Create the browser window.
let startHideWindow = false
if (process.argv) {
const args = minimist(process.argv)
if (args.hideWindow) {
startHideWindow = true
}
}
win = new BrowserWindow({
width: 900,
height: 750,
@ -88,6 +97,7 @@ function createWindow () {
// See nklayman.github.io/vue-cli-plugin-electron-builder/guide/security.html#node-integration for more info
nodeIntegration: true// process.env.ELECTRON_NODE_INTEGRATION
},
show: !startHideWindow,
// eslint-disable-next-line no-undef
icon: path.join(__static, 'icon.png')
})
@ -102,6 +112,10 @@ function createWindow () {
win.loadURL('app://./index.html')
}
if (startHideWindow) {
win.hide()
}
win.on('closed', async (e) => {
win = null
tray = null

View File

@ -0,0 +1,31 @@
export default {
install (context) {
const { ipcMain, dialog, log, app } = context
const ex = process.execPath
// 定义事件,渲染进程中直接使用
// 开启 开机自启动
ipcMain.on('auto-start', (event, message) => {
console.log('updateExe', ex)
if (message.value) {
app.setLoginItemSettings({
openAtLogin: true,
path: ex,
args: [
'--hideWindow', '"true"'
]
})
event.sender.send('auto-start', { key: 'enabled', value: true })
} else {
app.setLoginItemSettings({
openAtLogin: false,
path: ex,
args: []
})
event.sender.send('auto-start', { key: 'enabled', value: false })
}
})
}
}

View File

@ -0,0 +1,19 @@
function install (app, api) {
api.ipc.on('auto-start', (event, message) => {
if (message.value === true) {
app.$message.info('已添加开机自启')
} else {
app.$message.info('已取消开机自启')
}
})
api.autoStart = {
async enabled (value) {
api.ipc.send('auto-start', { key: 'enabled', value })
}
}
}
export default {
install
}

View File

@ -2,12 +2,14 @@ import api from './api/backend'
import tongji from './tongji/backend'
import update from './update/backend'
import fileSelector from './file-selector/backend'
import autoStart from './auto-start/backend'
const modules = {
api, // 核心接口模块
fileSelector, // 文件选择模块
tongji, // 统计模块
update // 自动更新
update, // 自动更新
autoStart
}
export default {
install (context) {

View File

@ -3,13 +3,15 @@ import error from './error/front'
import tongji from './tongji/front'
import update from './update/front'
import fileSelector from './file-selector/front'
import autoStart from './auto-start/front'
const modules = {
// api, // 核心接口模块
error,
fileSelector, // 文件选择模块
tongji, // 统计模块
update // 自动更新
update, // 自动更新
autoStart
}
export default {
install (app, api, router) {

View File

@ -36,7 +36,7 @@
</a-layout-content>
<a-layout-footer>
<div class="footer">
©2020 docmirror.cn
©2020-2021 docmirror.cn by Greper
</div>
</a-layout-footer>
</a-layout>

View File

@ -25,13 +25,13 @@
安全模式
</a-radio-button>
</a-tooltip>
<a-tooltip placement="topLeft" title="关闭测速,启用拦截,关闭增强(功能稍强,需要安装证书)">
<a-tooltip placement="topLeft" title="启用测速,启用拦截,关闭增强(功能稍强,需要安装证书)">
<a-radio-button value="default">
默认模式
</a-radio-button>
</a-tooltip>
<a-tooltip placement="topLeft" title="关闭测速,启用增强,启用拦截(敏感原因,默认关闭,感兴趣的话可以私下交流)">
<a-radio-button :disabled="!this.setting.overwall" value="ow">
<a-tooltip placement="topLeft" title="关闭测速,启用增强,启用拦截(敏感原因,默认禁用,感兴趣的话可以私下交流)">
<a-radio-button value="ow">
增强模式
</a-radio-button>
</a-tooltip>
@ -160,7 +160,7 @@ export default {
console.log('index mounted')
},
methods: {
async modeChange () {
async modeChange (event) {
const mode = this.config.app.mode
if (mode === 'safe') {
this.config.server.intercept.enabled = false
@ -168,9 +168,14 @@ export default {
this.config.plugin.overwall.enabled = false
} else if (mode === 'default') {
this.config.server.intercept.enabled = true
this.config.server.dns.speedTest.enabled = false
this.config.server.dns.speedTest.enabled = true
this.config.plugin.overwall.enabled = false
} else if (mode === 'ow') {
console.log('event', event)
if (!this.setting.overwall) {
this.wantOW()
return
}
this.config.server.intercept.enabled = true
this.config.server.dns.speedTest.enabled = false
this.config.plugin.overwall.enabled = true
@ -182,6 +187,16 @@ export default {
return this.$api.server.restart()
}
},
wantOW () {
this.$success({
title: '来找我吧',
content: (
<div>
敏感原因我关闭了它如果你对此功能感兴趣你可以尝试找一找它我把打开的方法藏在了源码里线索提示 // TODO
</div>
)
})
},
doCheckRootCa () {
this.$api.setting.load().then(setting => {
console.log('setting', setting)

View File

@ -76,10 +76,8 @@
<a-input :disabled="item.value ===false" v-model="item.key"></a-input>
</a-col>
<a-col :span="5">
<a-select :disabled="item.value ===false" v-model="item.value">
<a-select-option value="usa">USA DNS</a-select-option>
<a-select-option value="aliyun">Aliyun DNS</a-select-option>
<a-select-option value="ipaddress">IpAddress</a-select-option>
<a-select :disabled="item.value ===false" v-model="item.value" style="width: 100%">
<a-select-option v-for="(item) of speedDnsOptions" :key="item.value" :value="item.value">{{item.value}}</a-select-option>
</a-select>
</a-col>
<a-col :span="3">

View File

@ -0,0 +1,50 @@
<template>
<ds-container>
<template slot="header">
设置
<span>
</span>
</template>
<div v-if="config">
<a-form-item label="开机自启" :label-col="labelCol" :wrapper-col="wrapperCol">
<a-checkbox v-model="config.app.autoStart.enabled" @change="onAutoStartChange">
开机自启
</a-checkbox>
</a-form-item>
</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: 'Setting',
mixins: [Plugin],
data () {
return {
key: 'app'
}
},
created () {
},
mounted () {
},
methods: {
onAutoStartChange () {
this.$api.autoStart.enabled(this.config.app.autoStart.enabled)
this.saveConfig()
}
}
}
</script>
<style lang="sass">
</style>

View File

@ -4,6 +4,7 @@ import Proxy from '../pages/proxy'
import Node from '../pages/plugin/node'
import Git from '../pages/plugin/git'
import Overwall from '../pages/plugin/overwall'
import Setting from '../pages/setting'
const routes = [
{ path: '/', redirect: '/index' },
@ -12,7 +13,8 @@ const routes = [
{ path: '/proxy', component: Proxy },
{ path: '/plugin/node', component: Node },
{ path: '/plugin/git', component: Git },
{ path: '/plugin/overwall', component: Overwall }
{ path: '/plugin/overwall', component: Overwall },
{ path: '/setting', component: Setting }
]

View File

@ -7,6 +7,7 @@ export default function createMenus (app) {
{ title: '首页', path: '/index', icon: 'home' },
{ title: '加速服务', path: '/server', icon: 'thunderbolt' },
{ title: '系统代理', path: '/proxy', icon: 'deployment-unit' },
{ title: '设置', path: '/setting', icon: 'setting' },
{
title: '应用',
path: '/plugin',

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "@docmirror/mitmproxy",
"version": "1.4.0",
"version": "1.5.0",
"description": "",
"main": "src/index.js",
"keywords": [
@ -29,6 +29,7 @@
"node-cmd": "^3.0.0",
"node-forge": "^0.8.2",
"require-context": "^1.1.0",
"stream-throttle": "^0.1.3",
"through2": "^2.0.1",
"tunnel-agent": "^0.4.3",
"util": "^0.12.3",

View File

@ -0,0 +1,5 @@
module.exports = {
lookup () {
}
}

View File

@ -126,33 +126,6 @@ module.exports = function createRequestHandler (createIntercepts, middlewares, e
}
})
}
// if (rOptions.agent) {
// const lookup2 = (hostname, options, callback) => {
// const tester = speedTest.getSpeedTester(hostname)
// if (tester) {
// const ip = tester.pickFastAliveIp()
// if (ip) {
// log.info(`-----${hostname} use alive ip from agent:${ip}-----`)
// callback(null, ip, 4)
// return
// }
// }
// dns.lookup(hostname).then(ip => {
// isDnsIntercept = { dns, hostname, ip }
// if (ip !== hostname) {
// log.info(`----request url :${url},use ip from agent :${ip}----`)
// callback(null, ip, 4)
// } else {
// log.info(`request url :${url},use hostname :${hostname}`)
// defaultDns.lookup(hostname, options, callback)
// }
// })
// }
// if (rOptions.agent.options) {
// rOptions.agent.options.lookup = lookup2
// }
// rOptions.agent.lookup = lookup2
// }
}
}
@ -303,7 +276,7 @@ module.exports = function createRequestHandler (createIntercepts, middlewares, e
if (!res.writableEnded) {
const status = e.status || 500
res.writeHead(status, { 'Content-Type': 'text/html;charset=UTF8' })
res.write(`DevSidecar Warning:\n\n ${e.toString()}`)
res.write(`DevSidecar Warning:<br/> ${e.toString()}`)
res.end()
log.error('request error', e.message)
}

View File

@ -29,7 +29,6 @@ module.exports = class FakeServersCenter {
log.info(e)
}
}
log.info('add server promise:', serverPromiseObj)
this.queue.push(serverPromiseObj)
return serverPromiseObj
}

File diff suppressed because it is too large Load Diff

View File

@ -2003,7 +2003,7 @@ combined-stream@^1.0.6, combined-stream@~1.0.6:
dependencies:
delayed-stream "~1.0.0"
commander@^2.20.0, commander@^2.9.0:
commander@^2.2.0, commander@^2.20.0, commander@^2.9.0:
version "2.20.3"
resolved "https://registry.npm.taobao.org/commander/download/commander-2.20.3.tgz?cache=0&sync_timestamp=1603599636161&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcommander%2Fdownload%2Fcommander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33"
integrity sha1-/UhehMA+tIgcIHIrpIA16FMa6zM=
@ -3797,6 +3797,11 @@ levn@^0.3.0, levn@~0.3.0:
prelude-ls "~1.1.2"
type-check "~0.3.2"
limiter@^1.0.5:
version "1.1.5"
resolved "https://registry.npm.taobao.org/limiter/download/limiter-1.1.5.tgz#8f92a25b3b16c6131293a0cc834b4a838a2aa7c2"
integrity sha1-j5KiWzsWxhMSk6DMg0tKg4oqp8I=
lines-and-columns@^1.1.6:
version "1.1.6"
resolved "https://registry.npm.taobao.org/lines-and-columns/download/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00"
@ -5286,6 +5291,14 @@ stream-shift@^1.0.0:
resolved "https://registry.npm.taobao.org/stream-shift/download/stream-shift-1.0.1.tgz#d7088281559ab2778424279b0877da3c392d5a3d"
integrity sha1-1wiCgVWasneEJCebCHfaPDktWj0=
stream-throttle@^0.1.3:
version "0.1.3"
resolved "https://registry.npm.taobao.org/stream-throttle/download/stream-throttle-0.1.3.tgz#add57c8d7cc73a81630d31cd55d3961cfafba9c3"
integrity sha1-rdV8jXzHOoFjDTHNVdOWHPr7qcM=
dependencies:
commander "^2.2.0"
limiter "^1.0.5"
streamroller@^2.2.4:
version "2.2.4"
resolved "https://registry.yarnpkg.com/streamroller/-/streamroller-2.2.4.tgz#c198ced42db94086a6193608187ce80a5f2b0e53"