Merge remote-tracking branch 'origin/master'
# Conflicts: # packages/gui/package.jsonpull/88/head
commit
51acf25105
|
@ -56,7 +56,7 @@
|
||||||
"@vue/cli-plugin-eslint": "~4.5.0",
|
"@vue/cli-plugin-eslint": "~4.5.0",
|
||||||
"@vue/cli-service": "~4.5.0",
|
"@vue/cli-service": "~4.5.0",
|
||||||
"babel-eslint": "^10.1.0",
|
"babel-eslint": "^10.1.0",
|
||||||
"electron": "^13.0.0",
|
"electron": "13.1.9",
|
||||||
"electron-devtools-installer": "^3.1.0",
|
"electron-devtools-installer": "^3.1.0",
|
||||||
"eslint": "^6.7.2",
|
"eslint": "^6.7.2",
|
||||||
"eslint-plugin-vue": "^6.2.2",
|
"eslint-plugin-vue": "^6.2.2",
|
||||||
|
|
|
@ -15,7 +15,7 @@ function appendIntro (context, systemType, latest) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
exports.default = async function (context) {
|
exports.default = async function (context) {
|
||||||
// console.log('context222', context)
|
|
||||||
appendIntro(context, 'mac', 'latest-mac.yml')
|
appendIntro(context, 'mac', 'latest-mac.yml')
|
||||||
appendIntro(context, 'win', 'latest.yml')
|
appendIntro(context, 'win', 'latest.yml')
|
||||||
|
appendIntro(context, 'linux', 'latest-linux.yml')
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,29 @@
|
||||||
|
import DevSidecar from '@docmirror/dev-sidecar'
|
||||||
|
|
||||||
|
async function setAutoStartForLinux (app, enable = true) {
|
||||||
|
const path = app.getPath('exe')
|
||||||
|
if (enable) {
|
||||||
|
const cmd = `
|
||||||
|
mkdir -p ~/.config/autostart/
|
||||||
|
cat >> ~/.config/autostart/dev-sidecar.desktop <<EOF
|
||||||
|
[Desktop Entry]
|
||||||
|
Type=Application
|
||||||
|
Exec=${path}
|
||||||
|
Hidden=false
|
||||||
|
NoDisplay=false
|
||||||
|
X-GNOME-Autostart-enabled=true
|
||||||
|
Name[en_US]=DevSidecar
|
||||||
|
Name=DevSidecar
|
||||||
|
Comment[en_US]=
|
||||||
|
Comment=
|
||||||
|
EOF
|
||||||
|
`
|
||||||
|
await DevSidecar.api.shell.exec(cmd)
|
||||||
|
} else {
|
||||||
|
const removeStart = 'sudo rm ~/.config/autostart/dev-sidecar.desktop -rf'
|
||||||
|
await DevSidecar.api.shell.exec(removeStart)
|
||||||
|
}
|
||||||
|
}
|
||||||
export default {
|
export default {
|
||||||
install (context) {
|
install (context) {
|
||||||
const { ipcMain, dialog, log, app } = context
|
const { ipcMain, dialog, log, app } = context
|
||||||
|
@ -7,23 +33,34 @@ export default {
|
||||||
// 定义事件,渲染进程中直接使用
|
// 定义事件,渲染进程中直接使用
|
||||||
|
|
||||||
// 开启 开机自启动
|
// 开启 开机自启动
|
||||||
ipcMain.on('auto-start', (event, message) => {
|
ipcMain.on('auto-start', async (event, message) => {
|
||||||
log.info('auto-start', app.getPath('exe'))
|
console.log('auto start', message)
|
||||||
|
const isLinux = DevSidecar.api.shell.getSystemPlatform() === 'linux'
|
||||||
if (message.value) {
|
if (message.value) {
|
||||||
|
if (isLinux) {
|
||||||
|
await setAutoStartForLinux(app, true)
|
||||||
|
} else {
|
||||||
app.setLoginItemSettings({
|
app.setLoginItemSettings({
|
||||||
openAtLogin: true,
|
openAtLogin: true,
|
||||||
path: ex,
|
path: ex,
|
||||||
args: [
|
args: [
|
||||||
'--hideWindow', '"true"'
|
'--process-start-args', '"--hidden"'
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
event.sender.send('auto-start', { key: 'enabled', value: true })
|
event.sender.send('auto-start', { key: 'enabled', value: true })
|
||||||
|
} else {
|
||||||
|
if (isLinux) {
|
||||||
|
await setAutoStartForLinux(app, false)
|
||||||
} else {
|
} else {
|
||||||
app.setLoginItemSettings({
|
app.setLoginItemSettings({
|
||||||
openAtLogin: false,
|
openAtLogin: false,
|
||||||
path: ex,
|
path: ex,
|
||||||
args: []
|
args: []
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
event.sender.send('auto-start', { key: 'enabled', value: false })
|
event.sender.send('auto-start', { key: 'enabled', value: false })
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -51,7 +51,8 @@ function updateHandle (app, api, win, beforeQuit, quit, log) {
|
||||||
if (process.env.NODE_ENV === 'development' && !isMac) {
|
if (process.env.NODE_ENV === 'development' && !isMac) {
|
||||||
autoUpdater.setFeedURL({
|
autoUpdater.setFeedURL({
|
||||||
provider: 'generic',
|
provider: 'generic',
|
||||||
url: 'http://localhost/dev-sidecar/'
|
// url: 'http://localhost/dev-sidecar/'
|
||||||
|
url: 'http://dev-sidecar.docmirror.cn/update/preview/'
|
||||||
})
|
})
|
||||||
if (isMac) {
|
if (isMac) {
|
||||||
autoUpdater.updateConfigPath = path.join(__dirname, 'mac/DevSidecar.app/Contents/Resources/app-update.yml')
|
autoUpdater.updateConfigPath = path.join(__dirname, 'mac/DevSidecar.app/Contents/Resources/app-update.yml')
|
||||||
|
|
|
@ -61,10 +61,10 @@ function install (app, api) {
|
||||||
api.update.downloadPart(value)
|
api.update.downloadPart(value)
|
||||||
} else {
|
} else {
|
||||||
api.shell.getSystemPlatform().then((platform) => {
|
api.shell.getSystemPlatform().then((platform) => {
|
||||||
if (platform === 'mac') {
|
if (platform === 'mac' || platform === 'linux') {
|
||||||
app.$notification.open({
|
app.$notification.open({
|
||||||
duration: 15,
|
duration: 15,
|
||||||
message: 'Mac暂不支持全量自动升级',
|
message: '暂不支持自动升级',
|
||||||
description:
|
description:
|
||||||
'请前往github或gitee项目release页面下载新版本手动安装',
|
'请前往github或gitee项目release页面下载新版本手动安装',
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
|
|
|
@ -66,7 +66,7 @@ module.exports = {
|
||||||
linux: {
|
linux: {
|
||||||
icon: 'build/mac/',
|
icon: 'build/mac/',
|
||||||
target: [
|
target: [
|
||||||
// 'deb'
|
'deb',
|
||||||
'AppImage'
|
'AppImage'
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue