Merge remote-tracking branch 'upstream/master' into avoiding-anomalies
commit
e76231bb25
|
@ -419,4 +419,15 @@ module.exports = {
|
||||||
},
|
},
|
||||||
proxy: {},
|
proxy: {},
|
||||||
plugin: {},
|
plugin: {},
|
||||||
|
help: {
|
||||||
|
data: [
|
||||||
|
{
|
||||||
|
title: '查看DevSidecar的说明文档(Wiki)',
|
||||||
|
url: 'https://github.com/docmirror/dev-sidecar/wiki',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '为了展示更多帮助信息,请启用 “远程配置” 功能!!!',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -171,20 +171,28 @@ function updateHandle (app, api, win, beforeQuit, quit, log) {
|
||||||
return
|
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++) {
|
for (let i = 0; i < data.length; i++) {
|
||||||
const versionData = data[i]
|
const versionData = data[i]
|
||||||
|
|
||||||
|
// log.debug('版本数据:', versionData)
|
||||||
|
|
||||||
if (!versionData.assets || versionData.assets.length === 0) {
|
if (!versionData.assets || versionData.assets.length === 0) {
|
||||||
|
log.info('跳过空版本,即未上传过安装包:', versionData.name)
|
||||||
continue // 跳过空版本,即未上传过安装包
|
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 // 跳过预发布版本
|
continue // 跳过预发布版本
|
||||||
}
|
}
|
||||||
|
|
||||||
// log.info('最近正式版本数据:', versionData)
|
log.info('最近正式版本:', versionData.name)
|
||||||
|
|
||||||
// 获取版本号
|
// 获取版本号
|
||||||
let version = versionData.name
|
let version = versionData.name
|
||||||
|
|
|
@ -42,11 +42,11 @@ export default {
|
||||||
handleClick (e) {
|
handleClick (e) {
|
||||||
console.log('click', e)
|
console.log('click', e)
|
||||||
},
|
},
|
||||||
titleClick (e) {
|
titleClick (item) {
|
||||||
console.log('titleClick', e)
|
console.log('title click:', item)
|
||||||
},
|
},
|
||||||
menuClick (item) {
|
menuClick (item) {
|
||||||
console.log('menu click', item)
|
console.log('menu click:', item)
|
||||||
this.$router.replace(item.path)
|
this.$router.replace(item.path)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'TreeNode',
|
||||||
|
props: {
|
||||||
|
treeData: Array,
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
async openExternal (url) {
|
||||||
|
await this.$api.ipc.openExternal(url)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<ul>
|
||||||
|
<li v-for="node in treeData" :key="node.title">
|
||||||
|
<span v-if="node.url && (node.url.startsWith('http://') || node.url.startsWith('https://'))" :title="node.tip || node.title">
|
||||||
|
<a @click="openExternal(node.url)">{{ node.title }}</a>
|
||||||
|
</span>
|
||||||
|
<span v-else :title="node.tip || node.title">{{ node.title }}</span>
|
||||||
|
<tree-node v-if="node.children && node.children.length > 0" :tree-data="node.children" class="child-node" />
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</template>
|
|
@ -0,0 +1,37 @@
|
||||||
|
<script>
|
||||||
|
import Plugin from '../mixins/plugin'
|
||||||
|
import TreeNode from '../components/tree-node'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'Help',
|
||||||
|
components: {
|
||||||
|
TreeNode,
|
||||||
|
},
|
||||||
|
mixins: [Plugin],
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
key: 'help',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
async openExternal (url) {
|
||||||
|
await this.$api.ipc.openExternal(url)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<ds-container>
|
||||||
|
<template slot="header">
|
||||||
|
帮助中心
|
||||||
|
<span>
|
||||||
|
<a-button @click="openExternal('https://github.com/docmirror/dev-sidecar/issues/new/choose')">反馈问题</a-button>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<div v-if="config" class="help-list">
|
||||||
|
<TreeNode :tree-data="config.help.dataList" />
|
||||||
|
</div>
|
||||||
|
</ds-container>
|
||||||
|
</template>
|
|
@ -6,6 +6,7 @@ import Pip from '../pages/plugin/pip'
|
||||||
import Proxy from '../pages/proxy'
|
import Proxy from '../pages/proxy'
|
||||||
import Server from '../pages/server'
|
import Server from '../pages/server'
|
||||||
import Setting from '../pages/setting'
|
import Setting from '../pages/setting'
|
||||||
|
import Help from '../pages/help'
|
||||||
|
|
||||||
const routes = [
|
const routes = [
|
||||||
{ path: '/', redirect: '/index' },
|
{ path: '/', redirect: '/index' },
|
||||||
|
@ -17,6 +18,7 @@ const routes = [
|
||||||
{ path: '/plugin/git', component: Git },
|
{ path: '/plugin/git', component: Git },
|
||||||
{ path: '/plugin/pip', component: Pip },
|
{ path: '/plugin/pip', component: Pip },
|
||||||
{ path: '/plugin/overwall', component: Overwall },
|
{ path: '/plugin/overwall', component: Overwall },
|
||||||
|
{ path: '/help', component: Help },
|
||||||
]
|
]
|
||||||
|
|
||||||
export default routes
|
export default routes
|
||||||
|
|
|
@ -15,6 +15,7 @@ export default function createMenus (app) {
|
||||||
icon: 'api',
|
icon: 'api',
|
||||||
children: plugins,
|
children: plugins,
|
||||||
},
|
},
|
||||||
|
{ title: '帮助中心', path: '/help', icon: 'star' },
|
||||||
]
|
]
|
||||||
if (app.$global && app.$global.setting && app.$global.setting.overwall) {
|
if (app.$global && app.$global.setting && app.$global.setting.overwall) {
|
||||||
plugins.push({ title: '功能增强', path: '/plugin/overwall', icon: 'global' })
|
plugins.push({ title: '功能增强', path: '/plugin/overwall', icon: 'global' })
|
||||||
|
|
|
@ -138,3 +138,29 @@ hr {
|
||||||
margin: 0 5px 5px 5px;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,48 +7,6 @@ const { fireError, fireStatus } = require('./utils/util.process')
|
||||||
|
|
||||||
let servers = []
|
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 = {
|
const api = {
|
||||||
async start (config) {
|
async start (config) {
|
||||||
const proxyOptions = ProxyOptions(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 = {
|
module.exports = {
|
||||||
...api,
|
...api,
|
||||||
config: proxyConfig,
|
config: proxyConfig,
|
||||||
|
|
Loading…
Reference in New Issue