代码格式调整:packages/gui/**/*.js
parent
bd2376a282
commit
6c227139af
|
@ -1,5 +1,5 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
presets: [
|
presets: [
|
||||||
'@vue/cli-plugin-babel/preset'
|
'@vue/cli-plugin-babel/preset',
|
||||||
]
|
],
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
const fs = require('fs')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const pkg = require('../package.json')
|
const pkg = require('../package.json')
|
||||||
const fs = require('fs')
|
|
||||||
|
|
||||||
function appendIntro (context, systemType, latest) {
|
function appendIntro (context, systemType, latest) {
|
||||||
const version = pkg.version
|
const version = pkg.version
|
||||||
|
@ -14,8 +14,7 @@ partMiniVersion: 1.7.0
|
||||||
releaseNotes:
|
releaseNotes:
|
||||||
- 升级日志
|
- 升级日志
|
||||||
- https://download.fastgit.org/docmirror/dev-sidecar/releases/download/v${version}/DevSidecar-${version}.exe
|
- https://download.fastgit.org/docmirror/dev-sidecar/releases/download/v${version}/DevSidecar-${version}.exe
|
||||||
`,
|
`, (err) => {
|
||||||
(err) => {
|
|
||||||
if (err) {
|
if (err) {
|
||||||
console.log('修改latest 失败')
|
console.log('修改latest 失败')
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
const fs = require('fs')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const AdmZip = require('adm-zip')
|
const AdmZip = require('adm-zip')
|
||||||
const pkg = require('../package.json')
|
const pkg = require('../package.json')
|
||||||
const fs = require('fs')
|
|
||||||
|
|
||||||
function writeAppUpdateYmlForLinux () {
|
function writeAppUpdateYmlForLinux () {
|
||||||
const publishUrl = process.env.VUE_APP_PUBLISH_URL
|
const publishUrl = process.env.VUE_APP_PUBLISH_URL
|
||||||
|
|
|
@ -1,17 +1,15 @@
|
||||||
'use strict'
|
'use strict'
|
||||||
/* global __static */
|
/* global __static */
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import { app, protocol, BrowserWindow, Menu, Tray, ipcMain, dialog, powerMonitor, nativeImage, nativeTheme, globalShortcut } from 'electron'
|
import DevSidecar from '@docmirror/dev-sidecar'
|
||||||
|
import { app, BrowserWindow, dialog, globalShortcut, ipcMain, Menu, nativeImage, nativeTheme, powerMonitor, protocol, Tray } from 'electron'
|
||||||
|
import minimist from 'minimist'
|
||||||
import { createProtocol } from 'vue-cli-plugin-electron-builder/lib'
|
import { createProtocol } from 'vue-cli-plugin-electron-builder/lib'
|
||||||
import backend from './bridge/backend'
|
import backend from './bridge/backend'
|
||||||
import DevSidecar from '@docmirror/dev-sidecar'
|
|
||||||
import log from './utils/util.log'
|
import log from './utils/util.log'
|
||||||
import minimist from 'minimist'
|
|
||||||
|
|
||||||
const isWindows = process.platform === 'win32'
|
const isWindows = process.platform === 'win32'
|
||||||
// eslint-disable-next-line no-unused-vars
|
|
||||||
const isMac = process.platform === 'darwin'
|
const isMac = process.platform === 'darwin'
|
||||||
// import installExtension, { VUEJS_DEVTOOLS } from 'electron-devtools-installer'
|
|
||||||
const isDevelopment = process.env.NODE_ENV !== 'production'
|
const isDevelopment = process.env.NODE_ENV !== 'production'
|
||||||
|
|
||||||
// 避免其他系统出现异常,只有 Windows 使用 './background/powerMonitor'
|
// 避免其他系统出现异常,只有 Windows 使用 './background/powerMonitor'
|
||||||
|
@ -21,14 +19,13 @@ const _powerMonitor = isWindows ? require('./background/powerMonitor').powerMoni
|
||||||
// be closed automatically when the JavaScript object is garbage collected.
|
// be closed automatically when the JavaScript object is garbage collected.
|
||||||
let win
|
let win
|
||||||
let winIsHidden = false
|
let winIsHidden = false
|
||||||
// eslint-disable-next-line no-unused-vars
|
|
||||||
let tray // 防止被内存清理
|
let tray // 防止被内存清理
|
||||||
let forceClose = false
|
let forceClose = false
|
||||||
DevSidecar.api.config.reload()
|
DevSidecar.api.config.reload()
|
||||||
let hideDockWhenWinClose = DevSidecar.api.config.get().app.dock.hideWhenWinClose || false
|
let hideDockWhenWinClose = DevSidecar.api.config.get().app.dock.hideWhenWinClose || false
|
||||||
// Scheme must be registered before the app is ready
|
// Scheme must be registered before the app is ready
|
||||||
protocol.registerSchemesAsPrivileged([
|
protocol.registerSchemesAsPrivileged([
|
||||||
{ scheme: 'app', privileges: { secure: true, standard: true } }
|
{ scheme: 'app', privileges: { secure: true, standard: true } },
|
||||||
])
|
])
|
||||||
|
|
||||||
function openDevTools () {
|
function openDevTools () {
|
||||||
|
@ -73,7 +70,7 @@ function setTray () {
|
||||||
{
|
{
|
||||||
// 系统托盘图标目录
|
// 系统托盘图标目录
|
||||||
label: 'DevTools (F12)',
|
label: 'DevTools (F12)',
|
||||||
click: switchDevTools
|
click: switchDevTools,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// 系统托盘图标目录
|
// 系统托盘图标目录
|
||||||
|
@ -82,8 +79,8 @@ function setTray () {
|
||||||
log.info('force quit')
|
log.info('force quit')
|
||||||
forceClose = true
|
forceClose = true
|
||||||
quit()
|
quit()
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
]
|
]
|
||||||
// 设置系统托盘图标
|
// 设置系统托盘图标
|
||||||
const iconRootPath = path.join(__dirname, '../extra/icons/tray')
|
const iconRootPath = path.join(__dirname, '../extra/icons/tray')
|
||||||
|
@ -123,8 +120,8 @@ function setTray () {
|
||||||
showWin()
|
showWin()
|
||||||
})
|
})
|
||||||
|
|
||||||
appTray.on('right-click', function () {
|
appTray.on('right-click', () => {
|
||||||
setTimeout(function () {
|
setTimeout(() => {
|
||||||
appTray.popUpContextMenu(contextMenu)
|
appTray.popUpContextMenu(contextMenu)
|
||||||
}, 200)
|
}, 200)
|
||||||
})
|
})
|
||||||
|
@ -181,11 +178,10 @@ function createWindow (startHideWindow) {
|
||||||
// preload: path.join(__dirname, 'preload.js'),
|
// preload: path.join(__dirname, 'preload.js'),
|
||||||
// Use pluginOptions.nodeIntegration, leave this alone
|
// Use pluginOptions.nodeIntegration, leave this alone
|
||||||
// See nklayman.github.io/vue-cli-plugin-electron-builder/guide/security.html#node-integration for more info
|
// See nklayman.github.io/vue-cli-plugin-electron-builder/guide/security.html#node-integration for more info
|
||||||
nodeIntegration: true// process.env.ELECTRON_NODE_INTEGRATION
|
nodeIntegration: true, // process.env.ELECTRON_NODE_INTEGRATION
|
||||||
},
|
},
|
||||||
show: !startHideWindow,
|
show: !startHideWindow,
|
||||||
// eslint-disable-next-line no-undef
|
icon: path.join(__static, 'icon.png'),
|
||||||
icon: path.join(__static, 'icon.png')
|
|
||||||
})
|
})
|
||||||
winIsHidden = !!startHideWindow
|
winIsHidden = !!startHideWindow
|
||||||
|
|
||||||
|
@ -263,7 +259,6 @@ function createWindow (startHideWindow) {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
// 切换开发者工具显示状态
|
// 切换开发者工具显示状态
|
||||||
switchDevTools()
|
switchDevTools()
|
||||||
// eslint-disable-next-line brace-style
|
|
||||||
}
|
}
|
||||||
// 按 F5,刷新页面
|
// 按 F5,刷新页面
|
||||||
else if (input.key === 'F5') {
|
else if (input.key === 'F5') {
|
||||||
|
@ -368,7 +363,7 @@ if (app.getLoginItemSettings().wasOpenedAsHidden) {
|
||||||
log.info('start args:', args)
|
log.info('start args:', args)
|
||||||
|
|
||||||
// 通过启动参数,判断是否隐藏窗口
|
// 通过启动参数,判断是否隐藏窗口
|
||||||
const hideWindowArg = args.hideWindow + ''
|
const hideWindowArg = `${args.hideWindow}`
|
||||||
if (hideWindowArg === 'true' || hideWindowArg === '1') {
|
if (hideWindowArg === 'true' || hideWindowArg === '1') {
|
||||||
startHideWindow = true
|
startHideWindow = true
|
||||||
} else if (hideWindowArg === 'false' || hideWindowArg === '0') {
|
} else if (hideWindowArg === 'false' || hideWindowArg === '0') {
|
||||||
|
@ -483,7 +478,7 @@ if (isDevelopment) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 系统关机和重启时的操作
|
// 系统关机和重启时的操作
|
||||||
process.on('exit', function () {
|
process.on('exit', () => {
|
||||||
log.info('进程结束,退出app')
|
log.info('进程结束,退出app')
|
||||||
quit()
|
quit()
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
import { acquireShutdownBlock, insertWndProcHook, releaseShutdownBlock, removeWndProcHook, setMainWindowHandle } from '@natmri/platform-napi'
|
||||||
import { powerMonitor as _powerMonitor } from 'electron'
|
import { powerMonitor as _powerMonitor } from 'electron'
|
||||||
import { setMainWindowHandle, insertWndProcHook, removeWndProcHook, releaseShutdownBlock, acquireShutdownBlock } from '@natmri/platform-napi'
|
|
||||||
|
|
||||||
class PowerMonitor {
|
class PowerMonitor {
|
||||||
constructor () {
|
constructor () {
|
||||||
|
@ -43,7 +43,7 @@ class PowerMonitor {
|
||||||
if (event === 'shutdown' && process.platform === 'win32') {
|
if (event === 'shutdown' && process.platform === 'win32') {
|
||||||
if (!this._shutdownCallback) {
|
if (!this._shutdownCallback) {
|
||||||
this._shutdownCallback = async () => {
|
this._shutdownCallback = async () => {
|
||||||
await Promise.all(this._listeners.map((fn) => fn()))
|
await Promise.all(this._listeners.map(fn => fn()))
|
||||||
releaseShutdownBlock()
|
releaseShutdownBlock()
|
||||||
}
|
}
|
||||||
insertWndProcHook(this._shutdownCallback)
|
insertWndProcHook(this._shutdownCallback)
|
||||||
|
@ -57,7 +57,7 @@ class PowerMonitor {
|
||||||
|
|
||||||
off (event, listener) {
|
off (event, listener) {
|
||||||
if (event === 'shutdown' && process.platform === 'win32') {
|
if (event === 'shutdown' && process.platform === 'win32') {
|
||||||
this._listeners = this._listeners.filter((fn) => fn !== listener)
|
this._listeners = this._listeners.filter(fn => fn !== listener)
|
||||||
} else {
|
} else {
|
||||||
return _powerMonitor.off(event, listener)
|
return _powerMonitor.off(event, listener)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,16 @@
|
||||||
import lodash from 'lodash'
|
|
||||||
import DevSidecar from '@docmirror/dev-sidecar'
|
|
||||||
import { ipcMain } from 'electron'
|
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
import DevSidecar from '@docmirror/dev-sidecar'
|
||||||
|
import { ipcMain } from 'electron'
|
||||||
|
import lodash from 'lodash'
|
||||||
|
|
||||||
const pk = require('../../../package.json')
|
const pk = require('../../../package.json')
|
||||||
const mitmproxyPath = path.join(__dirname, 'mitmproxy.js')
|
|
||||||
process.env.DS_EXTRA_PATH = path.join(__dirname, '../extra/')
|
|
||||||
const jsonApi = require('@docmirror/mitmproxy/src/json')
|
const jsonApi = require('@docmirror/mitmproxy/src/json')
|
||||||
const log = require('../../utils/util.log')
|
const log = require('../../utils/util.log')
|
||||||
|
|
||||||
|
const mitmproxyPath = path.join(__dirname, 'mitmproxy.js')
|
||||||
|
process.env.DS_EXTRA_PATH = path.join(__dirname, '../extra/')
|
||||||
|
|
||||||
const getDefaultConfigBasePath = function () {
|
const getDefaultConfigBasePath = function () {
|
||||||
return DevSidecar.api.config.get().server.setting.userBasePath
|
return DevSidecar.api.config.get().server.setting.userBasePath
|
||||||
}
|
}
|
||||||
|
@ -42,7 +44,7 @@ const localApi = {
|
||||||
info: {
|
info: {
|
||||||
get () {
|
get () {
|
||||||
return {
|
return {
|
||||||
version: pk.version
|
version: pk.version,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getConfigDir () {
|
getConfigDir () {
|
||||||
|
@ -50,7 +52,7 @@ const localApi = {
|
||||||
},
|
},
|
||||||
getSystemPlatform () {
|
getSystemPlatform () {
|
||||||
return DevSidecar.api.shell.getSystemPlatform()
|
return DevSidecar.api.shell.getSystemPlatform()
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 软件设置
|
* 软件设置
|
||||||
|
@ -83,7 +85,7 @@ const localApi = {
|
||||||
if (setting.rootCa == null) {
|
if (setting.rootCa == null) {
|
||||||
setting.rootCa = {
|
setting.rootCa = {
|
||||||
setuped: false,
|
setuped: false,
|
||||||
desc: '根证书未安装'
|
desc: '根证书未安装',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,7 +98,7 @@ const localApi = {
|
||||||
const settingPath = _getSettingsPath()
|
const settingPath = _getSettingsPath()
|
||||||
fs.writeFileSync(settingPath, jsonApi.stringify(setting))
|
fs.writeFileSync(settingPath, jsonApi.stringify(setting))
|
||||||
log.info('保存 setting.json 配置文件成功:', settingPath)
|
log.info('保存 setting.json 配置文件成功:', settingPath)
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 启动所有
|
* 启动所有
|
||||||
|
@ -119,8 +121,8 @@ const localApi = {
|
||||||
*/
|
*/
|
||||||
restart () {
|
restart () {
|
||||||
return DevSidecar.api.server.restart({ mitmproxyPath })
|
return DevSidecar.api.server.restart({ mitmproxyPath })
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
function _deepFindFunction (list, parent, parentKey) {
|
function _deepFindFunction (list, parent, parentKey) {
|
||||||
|
@ -129,7 +131,7 @@ function _deepFindFunction (list, parent, parentKey) {
|
||||||
if (item instanceof Function) {
|
if (item instanceof Function) {
|
||||||
list.push(parentKey + key)
|
list.push(parentKey + key)
|
||||||
} else if (item instanceof Object) {
|
} else if (item instanceof Object) {
|
||||||
_deepFindFunction(list, item, parentKey + key + '.')
|
_deepFindFunction(list, item, `${parentKey + key}.`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -184,14 +186,20 @@ export default {
|
||||||
// 注册从core里来的事件,并转发给view
|
// 注册从core里来的事件,并转发给view
|
||||||
DevSidecar.api.event.register('status', (event) => {
|
DevSidecar.api.event.register('status', (event) => {
|
||||||
log.info('bridge on status, event:', event)
|
log.info('bridge on status, event:', event)
|
||||||
if (win) win.webContents.send('status', { ...event })
|
if (win) {
|
||||||
|
win.webContents.send('status', { ...event })
|
||||||
|
}
|
||||||
})
|
})
|
||||||
DevSidecar.api.event.register('error', (event) => {
|
DevSidecar.api.event.register('error', (event) => {
|
||||||
log.error('bridge on error, event:', event)
|
log.error('bridge on error, event:', event)
|
||||||
if (win) win.webContents.send('error.core', event)
|
if (win) {
|
||||||
|
win.webContents.send('error.core', event)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
DevSidecar.api.event.register('speed', (event) => {
|
DevSidecar.api.event.register('speed', (event) => {
|
||||||
if (win) win.webContents.send('speed', event)
|
if (win) {
|
||||||
|
win.webContents.send('speed', event)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// 合并用户配置
|
// 合并用户配置
|
||||||
|
@ -200,5 +208,5 @@ export default {
|
||||||
},
|
},
|
||||||
devSidecar: DevSidecar,
|
devSidecar: DevSidecar,
|
||||||
invoke,
|
invoke,
|
||||||
getDateTimeStr
|
getDateTimeStr,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
import Sudoer from 'electron-sudo'
|
|
||||||
import DevSidecar from '@docmirror/dev-sidecar'
|
import DevSidecar from '@docmirror/dev-sidecar'
|
||||||
|
import Sudoer from 'electron-sudo'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
async open () {
|
async open () {
|
||||||
const options = { name: '设置loopback' }
|
const options = { name: '设置loopback' }
|
||||||
const sudoer = new Sudoer(options)
|
const sudoer = new Sudoer(options)
|
||||||
const exeFile = DevSidecar.api.shell.extraPath.getEnableLoopbackPath()
|
const exeFile = DevSidecar.api.shell.extraPath.getEnableLoopbackPath()
|
||||||
await sudoer.exec(
|
await sudoer.exec(
|
||||||
exeFile, { env: { PARAM: 'VALUE' } }
|
exeFile,
|
||||||
|
{ env: { PARAM: 'VALUE' } },
|
||||||
)
|
)
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,8 +44,9 @@ export default {
|
||||||
openAtLogin: true,
|
openAtLogin: true,
|
||||||
openAsHidden: true,
|
openAsHidden: true,
|
||||||
args: [
|
args: [
|
||||||
'--hideWindow', '"true"'
|
'--hideWindow',
|
||||||
]
|
'"true"',
|
||||||
|
],
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,12 +58,12 @@ export default {
|
||||||
app.setLoginItemSettings({
|
app.setLoginItemSettings({
|
||||||
openAtLogin: false,
|
openAtLogin: false,
|
||||||
openAsHidden: false,
|
openAsHidden: false,
|
||||||
args: []
|
args: [],
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
event.sender.send('auto-start', { key: 'enabled', value: false })
|
event.sender.send('auto-start', { key: 'enabled', value: false })
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
function install (app, api) {
|
function install (app, api) {
|
||||||
api.ipc.on('auto-start', (event, message) => {
|
api.ipc.on('auto-start', (event, message) => {
|
||||||
if (message.value === true) {
|
if (message.value === true) {
|
||||||
|
@ -10,10 +9,10 @@ function install (app, api) {
|
||||||
api.autoStart = {
|
api.autoStart = {
|
||||||
async enabled (value) {
|
async enabled (value) {
|
||||||
api.ipc.send('auto-start', { key: 'enabled', value })
|
api.ipc.send('auto-start', { key: 'enabled', value })
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
install
|
install,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
import api from './api/backend'
|
import api from './api/backend'
|
||||||
|
import autoStart from './auto-start/backend'
|
||||||
|
import fileSelector from './file-selector/backend'
|
||||||
import tongji from './tongji/backend'
|
import tongji from './tongji/backend'
|
||||||
import update from './update/backend'
|
import update from './update/backend'
|
||||||
import fileSelector from './file-selector/backend'
|
|
||||||
import autoStart from './auto-start/backend'
|
|
||||||
|
|
||||||
const modules = {
|
const modules = {
|
||||||
api, // 核心接口模块
|
api, // 核心接口模块
|
||||||
fileSelector, // 文件选择模块
|
fileSelector, // 文件选择模块
|
||||||
tongji, // 统计模块
|
tongji, // 统计模块
|
||||||
update, // 自动更新
|
update, // 自动更新
|
||||||
autoStart
|
autoStart,
|
||||||
}
|
}
|
||||||
export default {
|
export default {
|
||||||
install (context) {
|
install (context) {
|
||||||
|
@ -18,5 +18,5 @@ export default {
|
||||||
modules[module].install(context)
|
modules[module].install(context)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
...modules
|
...modules,
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,28 +13,27 @@ function install (app, api) {
|
||||||
|
|
||||||
function handleServerStartError (message, err, app, api) {
|
function handleServerStartError (message, err, app, api) {
|
||||||
if (message.value === 'EADDRINUSE') {
|
if (message.value === 'EADDRINUSE') {
|
||||||
// eslint-disable-next-line no-debugger
|
|
||||||
app.$confirm({
|
app.$confirm({
|
||||||
title: '端口被占用,代理服务启动失败',
|
title: '端口被占用,代理服务启动失败',
|
||||||
content: '是否要杀掉占用进程?您也可以点击取消,然后前往加速服务->基本设置中修改代理端口',
|
content: '是否要杀掉占用进程?您也可以点击取消,然后前往加速服务->基本设置中修改代理端口',
|
||||||
onOk () {
|
onOk () {
|
||||||
// TODO 杀掉进程
|
// TODO 杀掉进程
|
||||||
api.config.get().then(config => {
|
api.config.get().then((config) => {
|
||||||
console.log('config', config)
|
console.log('config', config)
|
||||||
api.shell.killByPort({ port: config.server.port }).then(ret => {
|
api.shell.killByPort({ port: config.server.port }).then((ret) => {
|
||||||
app.$message.info('杀掉进程成功,请重试开启代理服务')
|
app.$message.info('杀掉进程成功,请重试开启代理服务')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
onCancel () {
|
onCancel () {
|
||||||
console.log('Cancel')
|
console.log('Cancel')
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
app.$message.error('加速服务启动失败:' + message.message)
|
app.$message.error(`加速服务启动失败:${message.message}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
install
|
install,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
export default {
|
export default {
|
||||||
install (context) {
|
install (context) {
|
||||||
const { ipcMain, dialog, log } = context
|
const { ipcMain, dialog, log } = context
|
||||||
ipcMain.on('file-selector', function (event, message) {
|
ipcMain.on('file-selector', (event, message) => {
|
||||||
if (message.key === 'open') {
|
if (message.key === 'open') {
|
||||||
dialog.showOpenDialog({
|
dialog.showOpenDialog({
|
||||||
properties: ['openFile'],
|
properties: ['openFile'],
|
||||||
...message
|
...message,
|
||||||
}).then(result => {
|
}).then((result) => {
|
||||||
if (result.canceled) {
|
if (result.canceled) {
|
||||||
event.sender.send('file-selector', { key: 'canceled' })
|
event.sender.send('file-selector', { key: 'canceled' })
|
||||||
} else {
|
} else {
|
||||||
event.sender.send('file-selector', { key: 'selected', value: result.filePaths })
|
event.sender.send('file-selector', { key: 'selected', value: result.filePaths })
|
||||||
}
|
}
|
||||||
}).catch(err => {
|
}).catch((err) => {
|
||||||
log.error('选择文件失败:', err)
|
log.error('选择文件失败:', err)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
|
|
||||||
function install (app, api) {
|
function install (app, api) {
|
||||||
api.fileSelector = {
|
api.fileSelector = {
|
||||||
open (value, options) {
|
open (value, options) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
api.ipc.send('file-selector', { key: 'open', value: value, ...options })
|
api.ipc.send('file-selector', { key: 'open', value, ...options })
|
||||||
api.ipc.on('file-selector', (event, message) => {
|
api.ipc.on('file-selector', (event, message) => {
|
||||||
console.log('selector', message)
|
console.log('selector', message)
|
||||||
if (message.key === 'selected') {
|
if (message.key === 'selected') {
|
||||||
|
@ -14,10 +13,10 @@ function install (app, api) {
|
||||||
api.ipc.on('file-selector', () => {})
|
api.ipc.on('file-selector', () => {})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
install
|
install,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
|
import autoStart from './auto-start/front'
|
||||||
// import api from './api/front'
|
// import api from './api/front'
|
||||||
import error from './error/front'
|
import error from './error/front'
|
||||||
|
import fileSelector from './file-selector/front'
|
||||||
|
import onClose from './on-close/front'
|
||||||
import tongji from './tongji/front'
|
import tongji from './tongji/front'
|
||||||
import update from './update/front'
|
import update from './update/front'
|
||||||
import fileSelector from './file-selector/front'
|
|
||||||
import autoStart from './auto-start/front'
|
|
||||||
import onClose from './on-close/front'
|
|
||||||
const modules = {
|
const modules = {
|
||||||
// api, // 核心接口模块
|
// api, // 核心接口模块
|
||||||
error,
|
error,
|
||||||
|
@ -12,7 +13,7 @@ const modules = {
|
||||||
tongji, // 统计模块
|
tongji, // 统计模块
|
||||||
update, // 自动更新
|
update, // 自动更新
|
||||||
autoStart,
|
autoStart,
|
||||||
onClose
|
onClose,
|
||||||
}
|
}
|
||||||
export default {
|
export default {
|
||||||
install (app, api, router) {
|
install (app, api, router) {
|
||||||
|
@ -20,5 +21,5 @@ export default {
|
||||||
modules[module].install(app, api, router)
|
modules[module].install(app, api, router)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
...modules
|
...modules,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
// eslint-disable-next-line no-unused-vars
|
|
||||||
const log = require('../utils/util.log')
|
|
||||||
const server = require('@docmirror/mitmproxy')
|
|
||||||
const jsonApi = require('@docmirror/mitmproxy/src/json')
|
|
||||||
const configPath = process.argv[2]
|
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
const server = require('@docmirror/mitmproxy')
|
||||||
|
const jsonApi = require('@docmirror/mitmproxy/src/json')
|
||||||
|
const log = require('../utils/util.log')
|
||||||
|
|
||||||
|
const configPath = process.argv[2]
|
||||||
const configJson = fs.readFileSync(configPath)
|
const configJson = fs.readFileSync(configPath)
|
||||||
log.info('读取 running.json by gui bridge 成功:', configPath)
|
log.info('读取 running.json by gui bridge 成功:', configPath)
|
||||||
const config = jsonApi.parse(configJson.toString())
|
const config = jsonApi.parse(configJson.toString())
|
||||||
|
|
|
@ -12,19 +12,21 @@ function install (app, api) {
|
||||||
}
|
}
|
||||||
app.$confirm({
|
app.$confirm({
|
||||||
title: '关闭策略',
|
title: '关闭策略',
|
||||||
content: h => <div>
|
content: h => (
|
||||||
<div style={'margin-top:10px'}>
|
<div>
|
||||||
<a-radio-group vOn:change={onRadioChange} defaultValue={closeType}>
|
<div style="margin-top:10px">
|
||||||
<a-radio value={1}>直接关闭</a-radio>
|
<a-radio-group vOn:change={onRadioChange} defaultValue={closeType}>
|
||||||
<a-radio value={2}>最小化到系统托盘</a-radio>
|
<a-radio value={1}>直接关闭</a-radio>
|
||||||
</a-radio-group>
|
<a-radio value={2}>最小化到系统托盘</a-radio>
|
||||||
|
</a-radio-group>
|
||||||
|
</div>
|
||||||
|
<div style="margin-top:10px">
|
||||||
|
<a-checkbox vOn:change={onCheckChange} defaultChecked={doSave}>
|
||||||
|
记住本次选择,不再提示
|
||||||
|
</a-checkbox>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div style={'margin-top:10px'}>
|
),
|
||||||
<a-checkbox vOn:change={onCheckChange} defaultChecked={doSave}>
|
|
||||||
记住本次选择,不再提示
|
|
||||||
< /a-checkbox>
|
|
||||||
</div>
|
|
||||||
</div>,
|
|
||||||
async onOk () {
|
async onOk () {
|
||||||
console.log('OK. closeType=', closeType)
|
console.log('OK. closeType=', closeType)
|
||||||
if (doSave) {
|
if (doSave) {
|
||||||
|
@ -34,11 +36,11 @@ function install (app, api) {
|
||||||
},
|
},
|
||||||
onCancel () {
|
onCancel () {
|
||||||
console.log('Cancel. closeType=', closeType)
|
console.log('Cancel. closeType=', closeType)
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
install
|
install,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* first step
|
* first step
|
||||||
* @param {*} ipcMain
|
* @param {*} ipcMain
|
||||||
*/
|
*/
|
||||||
const ebtMain = (ipcMain) => {
|
function ebtMain (ipcMain) {
|
||||||
const isDevelopment = process.env.NODE_ENV !== 'production'
|
const isDevelopment = process.env.NODE_ENV !== 'production'
|
||||||
const request = require('request')
|
const request = require('request')
|
||||||
/* istanbul ignore else */
|
/* istanbul ignore else */
|
||||||
|
@ -19,17 +18,16 @@ const ebtMain = (ipcMain) => {
|
||||||
url: `https://hm.baidu.com/hm.js?${arg}`,
|
url: `https://hm.baidu.com/hm.js?${arg}`,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
Referer: 'https://hm.baidu.com/'
|
Referer: 'https://hm.baidu.com/',
|
||||||
}
|
},
|
||||||
},
|
}, (err, response, body) => {
|
||||||
(err, response, body) => {
|
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error('百度统计请求出错', err)
|
console.error('百度统计请求出错', err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const rource = '(h.c.b.su=h.c.b.u||document.location.href),h.c.b.u=f.protocol+"//"+document.location.host+'
|
const rource = '(h.c.b.su=h.c.b.u||document.location.href),h.c.b.u=f.protocol+"//"+document.location.host+'
|
||||||
/* istanbul ignore else */
|
/* istanbul ignore else */
|
||||||
if (body && body.indexOf(rource) >= 0) {
|
if (body && body.includes(rource)) {
|
||||||
// step 3
|
// step 3
|
||||||
let text = body
|
let text = body
|
||||||
|
|
||||||
|
@ -51,5 +49,5 @@ const ebtMain = (ipcMain) => {
|
||||||
export default {
|
export default {
|
||||||
install (context) {
|
install (context) {
|
||||||
ebtMain(context.ipcMain)
|
ebtMain(context.ipcMain)
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* second step
|
* second step
|
||||||
* @param {*} ipcRenderer
|
* @param {*} ipcRenderer
|
||||||
* @param {*} siteId
|
* @param {*} siteId
|
||||||
* @param {*} router
|
* @param {*} router
|
||||||
*/
|
*/
|
||||||
const ebtRenderer = (ipcRenderer, siteId, router) => {
|
function ebtRenderer (ipcRenderer, siteId, router) {
|
||||||
/* istanbul ignore else */
|
/* istanbul ignore else */
|
||||||
if (!(ipcRenderer && ipcRenderer.on && ipcRenderer.send)) {
|
if (!(ipcRenderer && ipcRenderer.on && ipcRenderer.send)) {
|
||||||
throw new TypeError('require ipcRenderer')
|
throw new TypeError('require ipcRenderer')
|
||||||
|
@ -38,7 +37,7 @@ const ebtRenderer = (ipcRenderer, siteId, router) => {
|
||||||
router.beforeEach((to, _, next) => {
|
router.beforeEach((to, _, next) => {
|
||||||
/* istanbul ignore else */
|
/* istanbul ignore else */
|
||||||
if (to.path) {
|
if (to.path) {
|
||||||
window._hmt.push(['_trackPageview', '/#' + to.fullPath])
|
window._hmt.push(['_trackPageview', `/#${to.fullPath}`])
|
||||||
console.log('baidu trace', to.fullPath)
|
console.log('baidu trace', to.fullPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,5 +57,5 @@ export default {
|
||||||
const { ipcRenderer } = require('electron')
|
const { ipcRenderer } = require('electron')
|
||||||
ebtRenderer(ipcRenderer, BAIDU_SITE_ID, router)
|
ebtRenderer(ipcRenderer, BAIDU_SITE_ID, router)
|
||||||
},
|
},
|
||||||
ebtRenderer
|
ebtRenderer,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,15 @@
|
||||||
|
import fs from 'fs'
|
||||||
|
import path from 'path'
|
||||||
|
import DevSidecar from '@docmirror/dev-sidecar'
|
||||||
|
import AdmZip from 'adm-zip'
|
||||||
import { ipcMain } from 'electron'
|
import { ipcMain } from 'electron'
|
||||||
import { autoUpdater } from 'electron-updater'
|
import { autoUpdater } from 'electron-updater'
|
||||||
import path from 'path'
|
|
||||||
import request from 'request'
|
import request from 'request'
|
||||||
import progress from 'request-progress'
|
import progress from 'request-progress'
|
||||||
import fs from 'fs'
|
|
||||||
import AdmZip from 'adm-zip'
|
|
||||||
import log from '../../utils/util.log'
|
|
||||||
import appPathUtil from '../../utils/util.apppath'
|
|
||||||
import pkg from '../../../package.json'
|
import pkg from '../../../package.json'
|
||||||
import DevSidecar from '@docmirror/dev-sidecar'
|
import appPathUtil from '../../utils/util.apppath'
|
||||||
|
import log from '../../utils/util.log'
|
||||||
|
|
||||||
// eslint-disable-next-line no-unused-vars
|
|
||||||
const isMac = process.platform === 'darwin'
|
const isMac = process.platform === 'darwin'
|
||||||
const isLinux = process.platform === 'linux'
|
const isLinux = process.platform === 'linux'
|
||||||
|
|
||||||
|
@ -24,16 +23,16 @@ function downloadFile (uri, filePath, onProgress, onSuccess, onError) {
|
||||||
// delay: 1000, // Only start to emit after 1000ms delay, defaults to 0ms
|
// delay: 1000, // Only start to emit after 1000ms delay, defaults to 0ms
|
||||||
// lengthHeader: 'x-transfer-length' // Length header to use, defaults to content-length
|
// lengthHeader: 'x-transfer-length' // Length header to use, defaults to content-length
|
||||||
})
|
})
|
||||||
.on('progress', function (state) {
|
.on('progress', (state) => {
|
||||||
onProgress(state.percent * 100)
|
onProgress(state.percent * 100)
|
||||||
log.log('progress', state.percent)
|
log.log('progress', state.percent)
|
||||||
})
|
})
|
||||||
.on('error', function (err) {
|
.on('error', (err) => {
|
||||||
// Do something with err
|
// Do something with err
|
||||||
log.error('下载升级包失败:', err)
|
log.error('下载升级包失败:', err)
|
||||||
onError(err)
|
onError(err)
|
||||||
})
|
})
|
||||||
.on('end', function () {
|
.on('end', () => {
|
||||||
// Do something after request finishes
|
// Do something after request finishes
|
||||||
onSuccess()
|
onSuccess()
|
||||||
})
|
})
|
||||||
|
@ -44,10 +43,10 @@ function parseVersion (version) {
|
||||||
const matched = version.match(/^v?(\d+\.\d+\.\d+)(.*)$/)
|
const matched = version.match(/^v?(\d+\.\d+\.\d+)(.*)$/)
|
||||||
const versionArr = matched[1].split('.')
|
const versionArr = matched[1].split('.')
|
||||||
return {
|
return {
|
||||||
major: parseInt(versionArr[0]),
|
major: Number.parseInt(versionArr[0]),
|
||||||
minor: parseInt(versionArr[1]),
|
minor: Number.parseInt(versionArr[1]),
|
||||||
patch: parseInt(versionArr[2]),
|
patch: Number.parseInt(versionArr[2]),
|
||||||
suffix: matched[2]
|
suffix: matched[2],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,7 +114,7 @@ function updateHandle (app, api, win, beforeQuit, quit, log) {
|
||||||
error: '更新失败',
|
error: '更新失败',
|
||||||
checking: '检查更新中',
|
checking: '检查更新中',
|
||||||
updateAva: '发现新版本',
|
updateAva: '发现新版本',
|
||||||
updateNotAva: '当前为最新版本,无需更新'
|
updateNotAva: '当前为最新版本,无需更新',
|
||||||
}
|
}
|
||||||
// 本地开发环境,改变app-update.yml地址
|
// 本地开发环境,改变app-update.yml地址
|
||||||
if (process.env.NODE_ENV === 'development') {
|
if (process.env.NODE_ENV === 'development') {
|
||||||
|
@ -141,11 +140,11 @@ function updateHandle (app, api, win, beforeQuit, quit, log) {
|
||||||
// 检查更新
|
// 检查更新
|
||||||
const releasesApiUrl = 'https://api.github.com/repos/docmirror/dev-sidecar/releases'
|
const releasesApiUrl = 'https://api.github.com/repos/docmirror/dev-sidecar/releases'
|
||||||
async function checkForUpdatesFromGitHub () {
|
async function checkForUpdatesFromGitHub () {
|
||||||
request(releasesApiUrl, { headers: { 'User-Agent': 'DS/' + curVersion, 'Server-Name': 'baidu.com' } }, (error, response, body) => {
|
request(releasesApiUrl, { headers: { 'User-Agent': `DS/${curVersion}`, 'Server-Name': 'baidu.com' } }, (error, response, body) => {
|
||||||
try {
|
try {
|
||||||
if (error) {
|
if (error) {
|
||||||
log.error('检查更新失败:', error)
|
log.error('检查更新失败:', error)
|
||||||
const errorMsg = '检查更新失败:' + error
|
const errorMsg = `检查更新失败:${error}`
|
||||||
win.webContents.send('update', { key: 'error', action: 'checkForUpdate', error: errorMsg })
|
win.webContents.send('update', { key: 'error', action: 'checkForUpdate', error: errorMsg })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -203,9 +202,9 @@ function updateHandle (app, api, win, beforeQuit, quit, log) {
|
||||||
value: {
|
value: {
|
||||||
version,
|
version,
|
||||||
releaseNotes: versionData.body
|
releaseNotes: versionData.body
|
||||||
? (versionData.body.replace(/\r\n/g, '\n').replace(/https:\/\/github.com\/docmirror\/dev-sidecar/g, '').replace(/(?<=(^|\n))[ \t]*[ #]*#\s*/g, '') || '无')
|
? (versionData.body.replace(/\r\n/g, '\n').replace(/https:\/\/github.com\/docmirror\/dev-sidecar/g, '').replace(/(?<=(^|\n))[ \t]*(?:#[ #]*)?#\s*/g, '') || '无')
|
||||||
: '无'
|
: '无',
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
log.info(`检查更新:没有新版本,最近发布的版本号为 '${version}',而当前版本号为 '${curVersion}'`)
|
log.info(`检查更新:没有新版本,最近发布的版本号为 '${version}',而当前版本号为 '${curVersion}'`)
|
||||||
|
@ -229,15 +228,15 @@ function updateHandle (app, api, win, beforeQuit, quit, log) {
|
||||||
|
|
||||||
let message
|
let message
|
||||||
if (response) {
|
if (response) {
|
||||||
message = '检查更新失败: ' + (bodyObj && bodyObj.message ? bodyObj.message : response.message) + ', code: ' + response.statusCode
|
message = `检查更新失败: ${bodyObj && bodyObj.message ? bodyObj.message : response.message}, code: ${response.statusCode}`
|
||||||
} else {
|
} else {
|
||||||
message = '检查更新失败: ' + (bodyObj && bodyObj.message ? bodyObj.message : body)
|
message = `检查更新失败: ${bodyObj && bodyObj.message ? bodyObj.message : body}`
|
||||||
}
|
}
|
||||||
win.webContents.send('update', { key: 'error', action: 'checkForUpdate', error: message })
|
win.webContents.send('update', { key: 'error', action: 'checkForUpdate', error: message })
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log.error('检查更新失败:', e)
|
log.error('检查更新失败:', e)
|
||||||
win.webContents.send('update', { key: 'error', action: 'checkForUpdate', error: '检查更新失败:' + e.message })
|
win.webContents.send('update', { key: 'error', action: 'checkForUpdate', error: `检查更新失败:${e.message}` })
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -252,10 +251,10 @@ function updateHandle (app, api, win, beforeQuit, quit, log) {
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
fs.mkdirSync(fileDir)
|
fs.mkdirSync(fileDir)
|
||||||
}
|
}
|
||||||
const filePath = path.join(fileDir, value.version + '.zip')
|
const filePath = path.join(fileDir, `${value.version}.zip`)
|
||||||
|
|
||||||
downloadFile(value.partPackage, filePath, (data) => {
|
downloadFile(value.partPackage, filePath, (data) => {
|
||||||
win.webContents.send('update', { key: 'progress', value: parseInt(data) })
|
win.webContents.send('update', { key: 'progress', value: Number.parseInt(data) })
|
||||||
}, () => {
|
}, () => {
|
||||||
// 文件下载完成
|
// 文件下载完成
|
||||||
win.webContents.send('update', { key: 'progress', value: 100 })
|
win.webContents.send('update', { key: 'progress', value: 100 })
|
||||||
|
@ -263,10 +262,10 @@ function updateHandle (app, api, win, beforeQuit, quit, log) {
|
||||||
partPackagePath = filePath
|
partPackagePath = filePath
|
||||||
win.webContents.send('update', {
|
win.webContents.send('update', {
|
||||||
key: 'downloaded',
|
key: 'downloaded',
|
||||||
value: value
|
value,
|
||||||
})
|
})
|
||||||
}, (error) => {
|
}, (error) => {
|
||||||
sendUpdateMessage({ key: 'error', value: error, error: error })
|
sendUpdateMessage({ key: 'error', value: error, error })
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -294,34 +293,34 @@ function updateHandle (app, api, win, beforeQuit, quit, log) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
autoUpdater.on('error', function (error) {
|
autoUpdater.on('error', (error) => {
|
||||||
log.warn('autoUpdater error:', error)
|
log.warn('autoUpdater error:', error)
|
||||||
sendUpdateMessage({ key: 'error', value: error, error: error })
|
sendUpdateMessage({ key: 'error', value: error, error })
|
||||||
// dialog.showErrorBox('Error: ', error == null ? 'unknown' : (error.stack || error).toString())
|
// dialog.showErrorBox('Error: ', error == null ? 'unknown' : (error.stack || error).toString())
|
||||||
})
|
})
|
||||||
autoUpdater.on('checking-for-update', function () {
|
autoUpdater.on('checking-for-update', () => {
|
||||||
log.info('autoUpdater checking-for-update')
|
log.info('autoUpdater checking-for-update')
|
||||||
sendUpdateMessage({ key: 'checking', value: message.checking })
|
sendUpdateMessage({ key: 'checking', value: message.checking })
|
||||||
})
|
})
|
||||||
autoUpdater.on('update-available', function (info) {
|
autoUpdater.on('update-available', (info) => {
|
||||||
log.info('autoUpdater update-available')
|
log.info('autoUpdater update-available')
|
||||||
sendUpdateMessage({ key: 'available', value: info })
|
sendUpdateMessage({ key: 'available', value: info })
|
||||||
})
|
})
|
||||||
autoUpdater.on('update-not-available', function () {
|
autoUpdater.on('update-not-available', () => {
|
||||||
log.info('autoUpdater update-not-available')
|
log.info('autoUpdater update-not-available')
|
||||||
sendUpdateMessage({ key: 'notAvailable', value: message.updateNotAva })
|
sendUpdateMessage({ key: 'notAvailable', value: message.updateNotAva })
|
||||||
})
|
})
|
||||||
// 更新下载进度
|
// 更新下载进度
|
||||||
autoUpdater.on('download-progress', function (progressObj) {
|
autoUpdater.on('download-progress', (progressObj) => {
|
||||||
log.info('autoUpdater download-progress')
|
log.info('autoUpdater download-progress')
|
||||||
win.webContents.send('update', { key: 'progress', value: parseInt(progressObj.percent) })
|
win.webContents.send('update', { key: 'progress', value: Number.parseInt(progressObj.percent) })
|
||||||
})
|
})
|
||||||
// 更新完成,重启应用
|
// 更新完成,重启应用
|
||||||
autoUpdater.on('update-downloaded', function (info) {
|
autoUpdater.on('update-downloaded', (info) => {
|
||||||
log.info('download complete, version:', info.version)
|
log.info('download complete, version:', info.version)
|
||||||
win.webContents.send('update', {
|
win.webContents.send('update', {
|
||||||
key: 'downloaded',
|
key: 'downloaded',
|
||||||
value: info
|
value: info,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -374,9 +373,9 @@ export default {
|
||||||
Object.defineProperty(app, 'isPackaged', {
|
Object.defineProperty(app, 'isPackaged', {
|
||||||
get () {
|
get () {
|
||||||
return true
|
return true
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
updateHandle(app, api, win, beforeQuit, quit, log)
|
updateHandle(app, api, win, beforeQuit, quit, log)
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ function install (app, api) {
|
||||||
},
|
},
|
||||||
doUpdateNow () {
|
doUpdateNow () {
|
||||||
api.ipc.send('update', { key: 'doUpdateNow' })
|
api.ipc.send('update', { key: 'doUpdateNow' })
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleUpdateMessage (message) {
|
function handleUpdateMessage (message) {
|
||||||
|
@ -80,15 +80,17 @@ function install (app, api) {
|
||||||
cancelText: '取消',
|
cancelText: '取消',
|
||||||
okText: '打开链接',
|
okText: '打开链接',
|
||||||
width: 420,
|
width: 420,
|
||||||
content: h => {
|
content: (h) => {
|
||||||
return <div>
|
return (
|
||||||
<div>请前往 <a onClick={openGithubUrl}>github项目release页面</a> 下载新版本手动安装</div>
|
<div>
|
||||||
<div><a onClick={openGithubUrl}>https://github.com/docmirror/dev-sidecar/releases</a></div>
|
<div>请前往 <a onClick={openGithubUrl}>github项目release页面</a> 下载新版本手动安装</div>
|
||||||
</div>
|
<div><a onClick={openGithubUrl}>https://github.com/docmirror/dev-sidecar/releases</a></div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
},
|
},
|
||||||
onOk () {
|
onOk () {
|
||||||
openGithubUrl()
|
openGithubUrl()
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,31 +143,35 @@ function install (app, api) {
|
||||||
}
|
}
|
||||||
console.log(value)
|
console.log(value)
|
||||||
app.$confirm({
|
app.$confirm({
|
||||||
title: '发现新版本:v' + value.version,
|
title: `发现新版本:v${value.version}`,
|
||||||
cancelText: '暂不升级',
|
cancelText: '暂不升级',
|
||||||
okText: '升级',
|
okText: '升级',
|
||||||
width: 700,
|
width: 700,
|
||||||
content: h => {
|
content: (h) => {
|
||||||
if (value.releaseNotes) {
|
if (value.releaseNotes) {
|
||||||
const notes = []
|
const notes = []
|
||||||
if (typeof value.releaseNotes === 'string') {
|
if (typeof value.releaseNotes === 'string') {
|
||||||
const releaseNotes = value.releaseNotes.replace(/\r\n/g, '\n')
|
const releaseNotes = value.releaseNotes.replace(/\r\n/g, '\n')
|
||||||
return <div>
|
return (
|
||||||
<div>发布公告:<a onClick={openGithubUrl}>https://github.com/docmirror/dev-sidecar/releases</a></div>
|
<div>
|
||||||
<hr/>
|
<div>发布公告:<a onClick={openGithubUrl}>https://github.com/docmirror/dev-sidecar/releases</a></div>
|
||||||
<pre style="max-height:350px;font-family:auto">
|
<hr/>
|
||||||
{releaseNotes}
|
<pre style="max-height:350px;font-family:auto">
|
||||||
</pre>
|
{releaseNotes}
|
||||||
</div>
|
</pre>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
for (const note of value.releaseNotes) {
|
for (const note of value.releaseNotes) {
|
||||||
notes.push(<li>{note}</li>)
|
notes.push(<li>{note}</li>)
|
||||||
}
|
}
|
||||||
return <div>
|
return (
|
||||||
<div>发布公告:<a onClick={openGithubUrl}>https://github.com/docmirror/dev-sidecar/releases</a></div>
|
<div>
|
||||||
<div>更新内容:</div>
|
<div>发布公告:<a onClick={openGithubUrl}>https://github.com/docmirror/dev-sidecar/releases</a></div>
|
||||||
<ol>{notes}</ol>
|
<div>更新内容:</div>
|
||||||
</div>
|
<ol>{notes}</ol>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -175,7 +181,7 @@ function install (app, api) {
|
||||||
},
|
},
|
||||||
onCancel () {
|
onCancel () {
|
||||||
console.log('Cancel')
|
console.log('Cancel')
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,37 +193,41 @@ function install (app, api) {
|
||||||
cancelText: '暂不升级',
|
cancelText: '暂不升级',
|
||||||
okText: '立即升级',
|
okText: '立即升级',
|
||||||
width: 700,
|
width: 700,
|
||||||
content: h => {
|
content: (h) => {
|
||||||
if (value.releaseNotes) {
|
if (value.releaseNotes) {
|
||||||
const notes = []
|
const notes = []
|
||||||
if (typeof value.releaseNotes === 'string') {
|
if (typeof value.releaseNotes === 'string') {
|
||||||
const releaseNotes = value.releaseNotes.replace(/\r\n/g, '\n')
|
const releaseNotes = value.releaseNotes.replace(/\r\n/g, '\n')
|
||||||
return <div>
|
return (
|
||||||
<div>发布公告:<a onClick={openGithubUrl}>https://github.com/docmirror/dev-sidecar/releases</a></div>
|
<div>
|
||||||
<hr/>
|
<div>发布公告:<a onClick={openGithubUrl}>https://github.com/docmirror/dev-sidecar/releases</a></div>
|
||||||
<pre style="max-height:350px;font-family:auto">
|
<hr/>
|
||||||
{releaseNotes}
|
<pre style="max-height:350px;font-family:auto">
|
||||||
</pre>
|
{releaseNotes}
|
||||||
</div>
|
</pre>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
for (const note of value.releaseNotes) {
|
for (const note of value.releaseNotes) {
|
||||||
notes.push(<li>{note}</li>)
|
notes.push(<li>{note}</li>)
|
||||||
}
|
}
|
||||||
return <div>
|
return (
|
||||||
<div>发布公告:<a onClick={openGithubUrl}>https://github.com/docmirror/dev-sidecar/releases</a></div>
|
<div>
|
||||||
<div>更新内容:</div>
|
<div>发布公告:<a onClick={openGithubUrl}>https://github.com/docmirror/dev-sidecar/releases</a></div>
|
||||||
<ol>{notes}</ol>
|
<div>更新内容:</div>
|
||||||
</div>
|
<ol>{notes}</ol>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onOk () {
|
onOk () {
|
||||||
api.update.doUpdateNow()
|
api.update.doUpdateNow()
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
install
|
install,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import Vue from 'vue'
|
|
||||||
import App from './view/App.vue'
|
|
||||||
import antd from 'ant-design-vue'
|
import antd from 'ant-design-vue'
|
||||||
import 'ant-design-vue/dist/antd.css'
|
import Vue from 'vue'
|
||||||
import view from './view'
|
|
||||||
import VueRouter from 'vue-router'
|
import VueRouter from 'vue-router'
|
||||||
import routes from './view/router'
|
import view from './view'
|
||||||
|
import App from './view/App.vue'
|
||||||
import DsContainer from './view/components/container'
|
import DsContainer from './view/components/container'
|
||||||
|
import routes from './view/router'
|
||||||
|
import 'ant-design-vue/dist/antd.css'
|
||||||
import './view/style/index.scss'
|
import './view/style/index.scss'
|
||||||
import './view/style/theme/dark.scss' // 暗色主题
|
import './view/style/theme/dark.scss' // 暗色主题
|
||||||
|
|
||||||
|
@ -16,11 +16,11 @@ Vue.component(DsContainer)
|
||||||
// 3. 创建 router 实例,然后传 `routes` 配置
|
// 3. 创建 router 实例,然后传 `routes` 配置
|
||||||
// 你还可以传别的配置参数, 不过先这么简单着吧。
|
// 你还可以传别的配置参数, 不过先这么简单着吧。
|
||||||
const router = new VueRouter({
|
const router = new VueRouter({
|
||||||
routes // (缩写) 相当于 routes: routes
|
routes, // (缩写) 相当于 routes: routes
|
||||||
})
|
})
|
||||||
const app = new Vue({
|
const app = new Vue({
|
||||||
router,
|
router,
|
||||||
render: h => h(App)
|
render: h => h(App),
|
||||||
})
|
})
|
||||||
view.initApi(app).then(async (api) => {
|
view.initApi(app).then(async (api) => {
|
||||||
// 初始化status
|
// 初始化status
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import path from 'path'
|
|
||||||
import os from 'os'
|
import os from 'os'
|
||||||
|
import path from 'path'
|
||||||
|
|
||||||
function getSystemPlatform () {
|
function getSystemPlatform () {
|
||||||
switch (os.platform()) {
|
switch (os.platform()) {
|
||||||
case 'darwin':
|
case 'darwin':
|
||||||
|
@ -22,5 +23,5 @@ export default {
|
||||||
return path.join(exePath, '../../')
|
return path.join(exePath, '../../')
|
||||||
}
|
}
|
||||||
return path.join(exePath, '../')
|
return path.join(exePath, '../')
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,17 @@
|
||||||
const log4js = require('log4js')
|
const path = require('path')
|
||||||
const DevSidecar = require('@docmirror/dev-sidecar')
|
const DevSidecar = require('@docmirror/dev-sidecar')
|
||||||
|
const log4js = require('log4js')
|
||||||
|
|
||||||
|
const level = process.env.NODE_ENV === 'development' ? 'debug' : 'info'
|
||||||
|
|
||||||
const getDefaultConfigBasePath = function () {
|
const getDefaultConfigBasePath = function () {
|
||||||
return DevSidecar.api.config.get().server.setting.userBasePath
|
return DevSidecar.api.config.get().server.setting.userBasePath
|
||||||
}
|
}
|
||||||
const level = process.env.NODE_ENV === 'development' ? 'debug' : 'info'
|
|
||||||
const path = require('path')
|
|
||||||
const filename = path.join(getDefaultConfigBasePath(), '/logs/gui.log')
|
const filename = path.join(getDefaultConfigBasePath(), '/logs/gui.log')
|
||||||
log4js.configure({
|
log4js.configure({
|
||||||
appenders: { std: { type: 'stdout' }, file: { type: 'file', pattern: 'yyyy-MM-dd', daysToKeep: 3, filename } },
|
appenders: { std: { type: 'stdout' }, file: { type: 'file', pattern: 'yyyy-MM-dd', daysToKeep: 3, filename } },
|
||||||
categories: { default: { appenders: ['file', 'std'], level } }
|
categories: { default: { appenders: ['file', 'std'], level } },
|
||||||
})
|
})
|
||||||
const logger = log4js.getLogger('gui')
|
const logger = log4js.getLogger('gui')
|
||||||
module.exports = logger
|
module.exports = logger
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
import lodash from 'lodash'
|
|
||||||
import { ipcRenderer, shell } from 'electron'
|
import { ipcRenderer, shell } from 'electron'
|
||||||
|
import lodash from 'lodash'
|
||||||
|
|
||||||
let inited = false
|
let inited = false
|
||||||
let apiObj = null
|
let apiObj = null
|
||||||
export function apiInit (app) {
|
export function apiInit (app) {
|
||||||
const invoke = (api, args) => {
|
const invoke = (api, args) => {
|
||||||
return ipcRenderer.invoke('apiInvoke', [api, args]).catch(e => {
|
return ipcRenderer.invoke('apiInvoke', [api, args]).catch((e) => {
|
||||||
app.$notification.error({
|
app.$notification.error({
|
||||||
message: 'Api invoke error',
|
message: 'Api invoke error',
|
||||||
description: e.message
|
description: e.message,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -31,8 +32,8 @@ export function apiInit (app) {
|
||||||
},
|
},
|
||||||
openPath (file) {
|
openPath (file) {
|
||||||
shell.openPath(file)
|
shell.openPath(file)
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
const bindApi = (api, param1) => {
|
const bindApi = (api, param1) => {
|
||||||
|
@ -42,7 +43,7 @@ export function apiInit (app) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!inited) {
|
if (!inited) {
|
||||||
return invoke('getApiList').then(list => {
|
return invoke('getApiList').then((list) => {
|
||||||
inited = true
|
inited = true
|
||||||
for (const item of list) {
|
for (const item of list) {
|
||||||
bindApi(item)
|
bindApi(item)
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { apiInit, useApi } from './api'
|
|
||||||
import modules from '../bridge/front'
|
import modules from '../bridge/front'
|
||||||
|
import { apiInit, useApi } from './api'
|
||||||
import status from './status'
|
import status from './status'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
initApi: apiInit,
|
initApi: apiInit,
|
||||||
async initPre (Vue, api) {
|
async initPre (Vue, api) {
|
||||||
|
@ -8,12 +9,12 @@ export default {
|
||||||
const setting = await api.setting.load()
|
const setting = await api.setting.load()
|
||||||
Vue.prototype.$global = {
|
Vue.prototype.$global = {
|
||||||
setting,
|
setting,
|
||||||
config: await api.config.get()
|
config: await api.config.get(),
|
||||||
}
|
}
|
||||||
await status.install(api)
|
await status.install(api)
|
||||||
},
|
},
|
||||||
initModules (app, router) {
|
initModules (app, router) {
|
||||||
const api = useApi()
|
const api = useApi()
|
||||||
modules.install(app, api, router)
|
modules.install(app, api, router)
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import DsContainer from '../components/container'
|
|
||||||
import lodash from 'lodash'
|
import lodash from 'lodash'
|
||||||
|
import DsContainer from '../components/container'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
DsContainer
|
DsContainer,
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
@ -14,7 +14,7 @@ export default {
|
||||||
wrapperCol: { span: 19 },
|
wrapperCol: { span: 19 },
|
||||||
resetDefaultLoading: false,
|
resetDefaultLoading: false,
|
||||||
applyLoading: false,
|
applyLoading: false,
|
||||||
systemPlatform: ''
|
systemPlatform: '',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created () {
|
created () {
|
||||||
|
@ -77,7 +77,7 @@ export default {
|
||||||
this.resetDefaultLoading = false
|
this.resetDefaultLoading = false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onCancel () {}
|
onCancel () {},
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
saveConfig () {
|
saveConfig () {
|
||||||
|
@ -137,6 +137,6 @@ export default {
|
||||||
},
|
},
|
||||||
isLinux () {
|
isLinux () {
|
||||||
return this.systemPlatform === 'linux'
|
return this.systemPlatform === 'linux'
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import Index from '../pages/index'
|
import Index from '../pages/index'
|
||||||
import Server from '../pages/server'
|
|
||||||
import Proxy from '../pages/proxy'
|
|
||||||
import Node from '../pages/plugin/node'
|
|
||||||
import Git from '../pages/plugin/git'
|
import Git from '../pages/plugin/git'
|
||||||
import Pip from '../pages/plugin/pip'
|
import Node from '../pages/plugin/node'
|
||||||
import Overwall from '../pages/plugin/overwall'
|
import Overwall from '../pages/plugin/overwall'
|
||||||
|
import Pip from '../pages/plugin/pip'
|
||||||
|
import Proxy from '../pages/proxy'
|
||||||
|
import Server from '../pages/server'
|
||||||
import Setting from '../pages/setting'
|
import Setting from '../pages/setting'
|
||||||
|
|
||||||
const routes = [
|
const routes = [
|
||||||
|
@ -12,12 +12,11 @@ const routes = [
|
||||||
{ path: '/index', component: Index },
|
{ path: '/index', component: Index },
|
||||||
{ path: '/server', component: Server },
|
{ path: '/server', component: Server },
|
||||||
{ path: '/proxy', component: Proxy },
|
{ path: '/proxy', component: Proxy },
|
||||||
|
{ path: '/setting', component: Setting },
|
||||||
{ path: '/plugin/node', component: Node },
|
{ path: '/plugin/node', component: Node },
|
||||||
{ 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: '/setting', component: Setting }
|
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
export default routes
|
export default routes
|
||||||
|
|
|
@ -2,7 +2,7 @@ export default function createMenus (app) {
|
||||||
const plugins = [
|
const plugins = [
|
||||||
{ title: 'NPM加速', path: '/plugin/node', icon: 'like' },
|
{ title: 'NPM加速', path: '/plugin/node', icon: 'like' },
|
||||||
{ title: 'Git.exe代理', path: '/plugin/git', icon: 'github' },
|
{ title: 'Git.exe代理', path: '/plugin/git', icon: 'github' },
|
||||||
{ title: 'pip加速', path: '/plugin/pip', icon: 'bulb' }
|
{ title: 'pip加速', path: '/plugin/pip', icon: 'bulb' },
|
||||||
]
|
]
|
||||||
const menus = [
|
const menus = [
|
||||||
{ title: '首页', path: '/index', icon: 'home' },
|
{ title: '首页', path: '/index', icon: 'home' },
|
||||||
|
@ -13,8 +13,8 @@ export default function createMenus (app) {
|
||||||
title: '应用',
|
title: '应用',
|
||||||
path: '/plugin',
|
path: '/plugin',
|
||||||
icon: 'api',
|
icon: 'api',
|
||||||
children: plugins
|
children: plugins,
|
||||||
}
|
},
|
||||||
]
|
]
|
||||||
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' })
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
import lodash from 'lodash'
|
import lodash from 'lodash'
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
|
|
||||||
const status = {
|
const status = {
|
||||||
server: {
|
server: {
|
||||||
enabled: false
|
enabled: false,
|
||||||
},
|
},
|
||||||
proxy: {
|
proxy: {
|
||||||
enabled: false
|
enabled: false,
|
||||||
},
|
},
|
||||||
plugin: {
|
plugin: {
|
||||||
node: {}
|
node: {},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
async function install (api) {
|
async function install (api) {
|
||||||
api.ipc.on('status', (event, message) => {
|
api.ipc.on('status', (event, message) => {
|
||||||
|
@ -25,5 +26,5 @@ async function install (api) {
|
||||||
}
|
}
|
||||||
export default {
|
export default {
|
||||||
install,
|
install,
|
||||||
status
|
status,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,24 @@
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const webpack = require('webpack')
|
const webpack = require('webpack')
|
||||||
|
|
||||||
const publishUrl = process.env.VUE_APP_PUBLISH_URL
|
const publishUrl = process.env.VUE_APP_PUBLISH_URL
|
||||||
const publishProvider = process.env.VUE_APP_PUBLISH_PROVIDER
|
const publishProvider = process.env.VUE_APP_PUBLISH_PROVIDER
|
||||||
console.log('Publish url:', publishUrl)
|
console.log('Publish url:', publishUrl)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {import('@vue/cli-service').ProjectOptions}
|
||||||
|
*/
|
||||||
module.exports = {
|
module.exports = {
|
||||||
pages: {
|
pages: {
|
||||||
index: {
|
index: {
|
||||||
entry: 'src/main.js',
|
entry: 'src/main.js',
|
||||||
title: 'DevSidecar-给开发者的边车辅助工具'
|
title: 'DevSidecar-给开发者的边车辅助工具',
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
configureWebpack: (config) => {
|
configureWebpack: (config) => {
|
||||||
const configNew = {
|
return {
|
||||||
plugins: [
|
plugins: [
|
||||||
new webpack.DefinePlugin({ 'global.GENTLY': true })
|
new webpack.DefinePlugin({ 'global.GENTLY': true }),
|
||||||
],
|
],
|
||||||
module: {
|
module: {
|
||||||
rules: [
|
rules: [
|
||||||
|
@ -21,14 +26,13 @@ module.exports = {
|
||||||
test: /\.json5$/i,
|
test: /\.json5$/i,
|
||||||
loader: 'json5-loader',
|
loader: 'json5-loader',
|
||||||
options: {
|
options: {
|
||||||
esModule: false
|
esModule: false,
|
||||||
},
|
},
|
||||||
type: 'javascript/auto'
|
type: 'javascript/auto',
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
return configNew
|
|
||||||
},
|
},
|
||||||
pluginOptions: {
|
pluginOptions: {
|
||||||
electronBuilder: {
|
electronBuilder: {
|
||||||
|
@ -51,7 +55,7 @@ module.exports = {
|
||||||
'@natmri/platform-napi-linux-arm64-musl',
|
'@natmri/platform-napi-linux-arm64-musl',
|
||||||
'@natmri/platform-napi-linux-arm-gnueabihf',
|
'@natmri/platform-napi-linux-arm-gnueabihf',
|
||||||
'@natmri/platform-napi-darwin-x64',
|
'@natmri/platform-napi-darwin-x64',
|
||||||
'@natmri/platform-napi-darwin-arm64'
|
'@natmri/platform-napi-darwin-arm64',
|
||||||
],
|
],
|
||||||
nodeIntegration: true,
|
nodeIntegration: true,
|
||||||
// Provide an array of files that, when changed, will recompile the main process and restart Electron
|
// Provide an array of files that, when changed, will recompile the main process and restart Electron
|
||||||
|
@ -67,8 +71,8 @@ module.exports = {
|
||||||
extraResources: [
|
extraResources: [
|
||||||
{
|
{
|
||||||
from: 'extra',
|
from: 'extra',
|
||||||
to: 'extra'
|
to: 'extra',
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
appId: 'dev-sidecar',
|
appId: 'dev-sidecar',
|
||||||
productName: 'dev-sidecar',
|
productName: 'dev-sidecar',
|
||||||
|
@ -80,35 +84,35 @@ module.exports = {
|
||||||
perMachine: true,
|
perMachine: true,
|
||||||
allowElevation: true,
|
allowElevation: true,
|
||||||
allowToChangeInstallationDirectory: true,
|
allowToChangeInstallationDirectory: true,
|
||||||
include: './build/installer.nsh'
|
include: './build/installer.nsh',
|
||||||
},
|
},
|
||||||
mac: {
|
mac: {
|
||||||
icon: './build/mac/icon.icns',
|
icon: './build/mac/icon.icns',
|
||||||
target: {
|
target: {
|
||||||
arch: 'universal',
|
arch: 'universal',
|
||||||
target: 'dmg'
|
target: 'dmg',
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
win: {
|
win: {
|
||||||
icon: 'build/icons/'
|
icon: 'build/icons/',
|
||||||
// requestedExecutionLevel: 'highestAvailable' // 加了这个无法开机自启
|
// requestedExecutionLevel: 'highestAvailable' // 加了这个无法开机自启
|
||||||
},
|
},
|
||||||
linux: {
|
linux: {
|
||||||
icon: 'build/mac/',
|
icon: 'build/mac/',
|
||||||
target: [
|
target: [
|
||||||
'deb',
|
'deb',
|
||||||
'AppImage'
|
'AppImage',
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
publish: {
|
publish: {
|
||||||
provider: publishProvider,
|
provider: publishProvider,
|
||||||
url: publishUrl
|
url: publishUrl,
|
||||||
// url: 'http://dev-sidecar.docmirror.cn/update/preview/'
|
// url: 'http://dev-sidecar.docmirror.cn/update/preview/'
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
chainWebpackMainProcess (config) {
|
chainWebpackMainProcess (config) {
|
||||||
config.entry('mitmproxy').add(path.join(__dirname, 'src/bridge/mitmproxy.js'))
|
config.entry('mitmproxy').add(path.join(__dirname, 'src/bridge/mitmproxy.js'))
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue