diff --git a/packages/gui/package.json b/packages/gui/package.json index 9845ed57..444b7a0f 100644 --- a/packages/gui/package.json +++ b/packages/gui/package.json @@ -56,7 +56,7 @@ "@vue/cli-plugin-eslint": "~4.5.0", "@vue/cli-service": "~4.5.0", "babel-eslint": "^10.1.0", - "electron": "^13.0.0", + "electron": "13.1.9", "electron-devtools-installer": "^3.1.0", "eslint": "^6.7.2", "eslint-plugin-vue": "^6.2.2", diff --git a/packages/gui/pkg/after-all-artifact-build.js b/packages/gui/pkg/after-all-artifact-build.js index 61c911ba..51ad904b 100644 --- a/packages/gui/pkg/after-all-artifact-build.js +++ b/packages/gui/pkg/after-all-artifact-build.js @@ -15,7 +15,7 @@ function appendIntro (context, systemType, latest) { }) } exports.default = async function (context) { - // console.log('context222', context) appendIntro(context, 'mac', 'latest-mac.yml') appendIntro(context, 'win', 'latest.yml') + appendIntro(context, 'linux', 'latest-linux.yml') } diff --git a/packages/gui/src/bridge/auto-start/backend.js b/packages/gui/src/bridge/auto-start/backend.js index e04cbb14..6d4e3620 100644 --- a/packages/gui/src/bridge/auto-start/backend.js +++ b/packages/gui/src/bridge/auto-start/backend.js @@ -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 < { - log.info('auto-start', app.getPath('exe')) + ipcMain.on('auto-start', async (event, message) => { + console.log('auto start', message) + const isLinux = DevSidecar.api.shell.getSystemPlatform() === 'linux' if (message.value) { - app.setLoginItemSettings({ - openAtLogin: true, - path: ex, - args: [ - '--hideWindow', '"true"' - ] - }) + if (isLinux) { + await setAutoStartForLinux(app, true) + } else { + app.setLoginItemSettings({ + openAtLogin: true, + path: ex, + args: [ + '--process-start-args', '"--hidden"' + ] + }) + } + event.sender.send('auto-start', { key: 'enabled', value: true }) } else { - app.setLoginItemSettings({ - openAtLogin: false, - path: ex, - args: [] - }) + if (isLinux) { + await setAutoStartForLinux(app, false) + } else { + app.setLoginItemSettings({ + openAtLogin: false, + path: ex, + args: [] + }) + } + event.sender.send('auto-start', { key: 'enabled', value: false }) } }) diff --git a/packages/gui/src/bridge/update/backend.js b/packages/gui/src/bridge/update/backend.js index 669eda45..46df5d4d 100644 --- a/packages/gui/src/bridge/update/backend.js +++ b/packages/gui/src/bridge/update/backend.js @@ -51,7 +51,8 @@ function updateHandle (app, api, win, beforeQuit, quit, log) { if (process.env.NODE_ENV === 'development' && !isMac) { autoUpdater.setFeedURL({ provider: 'generic', - url: 'http://localhost/dev-sidecar/' + // url: 'http://localhost/dev-sidecar/' + url: 'http://dev-sidecar.docmirror.cn/update/preview/' }) if (isMac) { autoUpdater.updateConfigPath = path.join(__dirname, 'mac/DevSidecar.app/Contents/Resources/app-update.yml') diff --git a/packages/gui/src/bridge/update/front.js b/packages/gui/src/bridge/update/front.js index 8f7f3191..051759ba 100644 --- a/packages/gui/src/bridge/update/front.js +++ b/packages/gui/src/bridge/update/front.js @@ -61,10 +61,10 @@ function install (app, api) { api.update.downloadPart(value) } else { api.shell.getSystemPlatform().then((platform) => { - if (platform === 'mac') { + if (platform === 'mac' || platform === 'linux') { app.$notification.open({ duration: 15, - message: 'Mac暂不支持全量自动升级', + message: '暂不支持自动升级', description: '请前往github或gitee项目release页面下载新版本手动安装', onClick: () => { diff --git a/packages/gui/vue.config.js b/packages/gui/vue.config.js index 17b35da2..3fde517c 100644 --- a/packages/gui/vue.config.js +++ b/packages/gui/vue.config.js @@ -66,7 +66,7 @@ module.exports = { linux: { icon: 'build/mac/', target: [ - // 'deb' + 'deb', 'AppImage' ] },