diff --git a/packages/core/src/config/index.js b/packages/core/src/config/index.js index 8417d3a..5020f34 100644 --- a/packages/core/src/config/index.js +++ b/packages/core/src/config/index.js @@ -419,4 +419,15 @@ module.exports = { }, proxy: {}, plugin: {}, + help: { + data: [ + { + title: '查看DevSidecar的说明文档(Wiki)', + url: 'https://github.com/docmirror/dev-sidecar/wiki', + }, + { + title: '为了展示更多帮助信息,请启用 “远程配置” 功能!!!', + }, + ], + }, } diff --git a/packages/gui/src/bridge/update/backend.js b/packages/gui/src/bridge/update/backend.js index 3b8eda1..5365717 100644 --- a/packages/gui/src/bridge/update/backend.js +++ b/packages/gui/src/bridge/update/backend.js @@ -171,20 +171,28 @@ function updateHandle (app, api, win, beforeQuit, quit, log) { return } - // log.info('github api返回的release数据:', JSON.stringify(data, null, '\t')) + log.debug('github api返回的release数据:', JSON.stringify(data, null, '\t')) // 检查更新 for (let i = 0; i < data.length; i++) { const versionData = data[i] + // log.debug('版本数据:', versionData) + if (!versionData.assets || versionData.assets.length === 0) { + log.info('跳过空版本,即未上传过安装包:', versionData.name) continue // 跳过空版本,即未上传过安装包 } - if (!isPreRelease && DevSidecar.api.config.get().app.skipPreRelease && versionData.name.includes('-')) { + if (!versionData.name.match(/^v?\d+(\.\d+)*(-.+)?$/g)) { + log.info('跳过即 “不是正式,又不是预发布” 的版本:', versionData.name) + continue // 跳过即 “不是正式,又不是预发布” 的版本 + } + if (!isPreRelease && DevSidecar.api.config.get().app.skipPreRelease && (versionData.name.includes('-') || versionData.prerelease)) { + log.info('跳过预发布版本:', versionData.name) continue // 跳过预发布版本 } - // log.info('最近正式版本数据:', versionData) + log.info('最近正式版本:', versionData.name) // 获取版本号 let version = versionData.name diff --git a/packages/gui/src/view/App.vue b/packages/gui/src/view/App.vue index bf54a31..45744f7 100644 --- a/packages/gui/src/view/App.vue +++ b/packages/gui/src/view/App.vue @@ -42,11 +42,11 @@ export default { handleClick (e) { console.log('click', e) }, - titleClick (e) { - console.log('titleClick', e) + titleClick (item) { + console.log('title click:', item) }, menuClick (item) { - console.log('menu click', item) + console.log('menu click:', item) this.$router.replace(item.path) }, }, diff --git a/packages/gui/src/view/components/tree-node.vue b/packages/gui/src/view/components/tree-node.vue new file mode 100644 index 0000000..7f25d0f --- /dev/null +++ b/packages/gui/src/view/components/tree-node.vue @@ -0,0 +1,25 @@ + + + diff --git a/packages/gui/src/view/pages/help.vue b/packages/gui/src/view/pages/help.vue new file mode 100644 index 0000000..295c3b7 --- /dev/null +++ b/packages/gui/src/view/pages/help.vue @@ -0,0 +1,37 @@ + + + diff --git a/packages/gui/src/view/router/index.js b/packages/gui/src/view/router/index.js index d237950..3ba09b9 100644 --- a/packages/gui/src/view/router/index.js +++ b/packages/gui/src/view/router/index.js @@ -6,6 +6,7 @@ import Pip from '../pages/plugin/pip' import Proxy from '../pages/proxy' import Server from '../pages/server' import Setting from '../pages/setting' +import Help from '../pages/help' const routes = [ { path: '/', redirect: '/index' }, @@ -17,6 +18,7 @@ const routes = [ { path: '/plugin/git', component: Git }, { path: '/plugin/pip', component: Pip }, { path: '/plugin/overwall', component: Overwall }, + { path: '/help', component: Help }, ] export default routes diff --git a/packages/gui/src/view/router/menu.js b/packages/gui/src/view/router/menu.js index f03e97c..5b06b4b 100644 --- a/packages/gui/src/view/router/menu.js +++ b/packages/gui/src/view/router/menu.js @@ -15,6 +15,7 @@ export default function createMenus (app) { icon: 'api', children: plugins, }, + { title: '帮助中心', path: '/help', icon: 'star' }, ] if (app.$global && app.$global.setting && app.$global.setting.overwall) { plugins.push({ title: '功能增强', path: '/plugin/overwall', icon: 'global' }) diff --git a/packages/gui/src/view/style/index.scss b/packages/gui/src/view/style/index.scss index cae2839..06c0ebd 100644 --- a/packages/gui/src/view/style/index.scss +++ b/packages/gui/src/view/style/index.scss @@ -138,3 +138,29 @@ hr { margin: 0 5px 5px 5px; } } + +.help-list { + ul { + padding-left: 10px; + li { + list-style: none; + line-height: 30px; + + span { + display: block; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } + + a:hover { + text-decoration: underline; + } + } + + // 嵌套列表 + ul { + padding-left: 20px; + } + } +} \ No newline at end of file diff --git a/packages/mitmproxy/src/index.js b/packages/mitmproxy/src/index.js index 4e0dba6..e46bd79 100644 --- a/packages/mitmproxy/src/index.js +++ b/packages/mitmproxy/src/index.js @@ -7,48 +7,6 @@ const { fireError, fireStatus } = require('./utils/util.process') let servers = [] -function registerProcessListener () { - process.on('message', (msg) => { - log.info('child get msg:', JSON.stringify(msg)) - if (msg.type === 'action') { - api[msg.event.key](msg.event.params) - } else if (msg.type === 'speed') { - speedTest.action(msg.event) - } - }) - - process.on('SIGINT', () => { - log.info('on sigint : closed ') - process.exit(0) - }) - - // 避免异常崩溃 - process.on('uncaughtException', (err) => { - if (err.code === 'ECONNABORTED') { - // log.error(err.errno) - return - } - log.error('Process uncaughtException:', err) - }) - - process.on('unhandledRejection', (err, p) => { - log.info('Process unhandledRejection at: Promise', p, 'err:', err) - // application specific logging, throwing an error, or other logic here - }) - process.on('uncaughtExceptionMonitor', (err, origin) => { - log.info('Process uncaughtExceptionMonitor:', err, origin) - }) - process.on('exit', (code, signal) => { - log.info('代理服务进程被关闭:', code, signal) - }) - process.on('beforeExit', (code, signal) => { - console.log('Process beforeExit event with code: ', code, signal) - }) - process.on('SIGPIPE', (code, signal) => { - log.warn('sub Process SIGPIPE', code, signal) - }) -} - const api = { async start (config) { const proxyOptions = ProxyOptions(config) @@ -119,6 +77,48 @@ const api = { }, } +function registerProcessListener () { + process.on('message', (msg) => { + log.info('child get msg:', JSON.stringify(msg)) + if (msg.type === 'action') { + api[msg.event.key](msg.event.params) + } else if (msg.type === 'speed') { + speedTest.action(msg.event) + } + }) + + process.on('SIGINT', () => { + log.info('on sigint : closed ') + process.exit(0) + }) + + // 避免异常崩溃 + process.on('uncaughtException', (err) => { + if (err.code === 'ECONNABORTED') { + // log.error(err.errno) + return + } + log.error('Process uncaughtException:', err) + }) + + process.on('unhandledRejection', (err, p) => { + log.info('Process unhandledRejection at: Promise', p, 'err:', err) + // application specific logging, throwing an error, or other logic here + }) + process.on('uncaughtExceptionMonitor', (err, origin) => { + log.info('Process uncaughtExceptionMonitor:', err, origin) + }) + process.on('exit', (code, signal) => { + log.info('代理服务进程被关闭:', code, signal) + }) + process.on('beforeExit', (code, signal) => { + console.log('Process beforeExit event with code: ', code, signal) + }) + process.on('SIGPIPE', (code, signal) => { + log.warn('sub Process SIGPIPE', code, signal) + }) +} + module.exports = { ...api, config: proxyConfig,