diff --git a/packages/core/index.js b/packages/core/index.js index 4d234abf..36e33d66 100644 --- a/packages/core/index.js +++ b/packages/core/index.js @@ -1,7 +1,6 @@ module.exports = require('./src') -// TODO 这是个彩蛋 ↓ ↓ ↓ ↓ ↓ ↓ +// TODO 这是个彩蛋 ↓ ↓ ↓ ↓ ↓ ↓ ,如果你破解了它,请不要公开,好好用它来学习和查资料吧。 /** \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 **/ -// 如果你破解了它,请不要公开,好好用它来学习和查资料吧。 diff --git a/packages/core/src/config/index.js b/packages/core/src/config/index.js index 705e8adb..9ef515cd 100644 --- a/packages/core/src/config/index.js +++ b/packages/core/src/config/index.js @@ -25,7 +25,7 @@ module.exports = { }, server: { enabled: true, - port: 1181, + port: 31181, setting: { NODE_TLS_REJECT_UNAUTHORIZED: true, verifySsl: true, diff --git a/packages/core/src/modules/server/index.js b/packages/core/src/modules/server/index.js index 48ada821..bf8d0bb7 100644 --- a/packages/core/src/modules/server/index.js +++ b/packages/core/src/modules/server/index.js @@ -92,14 +92,16 @@ const serverApi = { log.error('server process uncaughtException', err) }) serverProcess.on('message', function (msg) { - log.info('收到子进程消息', msg.type, msg.event.key) + log.info('收到子进程消息', msg.type, msg.event.key, msg.message) if (msg.type === 'status') { fireStatus(msg.event) } else if (msg.type === 'error') { - if (msg.event.code && msg.event.code === 'EADDRINUSE') { - fireStatus(false) // 启动失败 + let code = '' + if (msg.event.code) { + code = msg.event.code } - event.fire('error', { key: 'server', value: 'EADDRINUSE', error: msg.event }) + fireStatus(false) // 启动失败 + event.fire('error', { key: 'server', value: code, error: msg.event, message: msg.message }) } else if (msg.type === 'speed') { event.fire('speed', msg.event) } diff --git a/packages/gui/src/bridge/error/front.js b/packages/gui/src/bridge/error/front.js index a73354d6..fbf20616 100644 --- a/packages/gui/src/bridge/error/front.js +++ b/packages/gui/src/bridge/error/front.js @@ -13,9 +13,10 @@ function install (app, api) { function handleServerStartError (message, err, app, api) { if (message.value === 'EADDRINUSE') { + // eslint-disable-next-line no-debugger app.$confirm({ title: '端口被占用,代理服务启动失败', - content: '是否要杀掉占用进程?', + content: '是否要杀掉占用进程?您也可以点击取消,然后前往加速服务->基本设置中修改代理端口', onOk () { // TODO 杀掉进程 api.config.get().then(config => { @@ -29,6 +30,8 @@ function handleServerStartError (message, err, app, api) { console.log('Cancel') } }) + } else { + app.$message.error('加速服务启动失败:' + message.message) } } diff --git a/packages/gui/src/view/components/setup-ca.vue b/packages/gui/src/view/components/setup-ca.vue index 1bf34de6..19bcfa58 100644 --- a/packages/gui/src/view/components/setup-ca.vue +++ b/packages/gui/src/view/components/setup-ca.vue @@ -19,18 +19,18 @@ 本应用在非“安全模式”下必须安装和信任CA根证书,该证书是应用启动时本地随机生成的
diff --git a/packages/gui/src/view/pages/index.vue b/packages/gui/src/view/pages/index.vue index ee5a3744..b81b0c5a 100644 --- a/packages/gui/src/view/pages/index.vue +++ b/packages/gui/src/view/pages/index.vue @@ -31,7 +31,7 @@ 默认模式 - + 增强模式 diff --git a/packages/mitmproxy/src/lib/proxy/mitmproxy/index.js b/packages/mitmproxy/src/lib/proxy/mitmproxy/index.js index 04db8ed2..f8972c53 100644 --- a/packages/mitmproxy/src/lib/proxy/mitmproxy/index.js +++ b/packages/mitmproxy/src/lib/proxy/mitmproxy/index.js @@ -82,7 +82,7 @@ module.exports = { ) const server = new http.Server() - server.listen(port, () => { + server.listen(port, '127.0.0.1', () => { log.info(`dev-sidecar启动端口: ${port}`) server.on('error', (e) => { log.error('server error', e) diff --git a/packages/mitmproxy/src/utils/util.process.js b/packages/mitmproxy/src/utils/util.process.js index cd3b3b59..b543653b 100644 --- a/packages/mitmproxy/src/utils/util.process.js +++ b/packages/mitmproxy/src/utils/util.process.js @@ -1,7 +1,7 @@ module.exports = { fireError (e) { if (process.send) { - process.send({ type: 'error', event: e }) + process.send({ type: 'error', event: e, message: e.message }) } }, fireStatus (status) {