This commit is contained in:
gaoshuaixing
2022-02-24 18:40:47 +08:00
parent 809ba2b11f
commit 1f22d648f2
6 changed files with 12 additions and 13 deletions

View File

@@ -14,7 +14,7 @@ module.exports = {
* 安装
*/
install (eeApp) {
console.log('[preload] load AutoUpdater module');
eeApp.logger.info('[preload] load AutoUpdater module');
const status = {
error: -1,
@@ -27,13 +27,13 @@ module.exports = {
const updateConfig = eeApp.config.autoUpdate;
const mainWindow = eeApp.electron.mainWindow;
const version = app.getVersion();
console.log('[preload:autoUpdater] current version: ', version);
eeApp.logger.info('[preload:autoUpdater] current version: ', version);
// 设置下载服务器地址
let server = updateConfig.options.url;
let lastChar = server.substring(server.length - 1);
server = lastChar === '/' ? server : server + "/";
console.log('[preload:autoUpdater] server: ', server);
eeApp.logger.info('[preload:autoUpdater] server: ', server);
updateConfig.options.url = server;
// 是否后台自动下载
@@ -82,6 +82,7 @@ module.exports = {
totalSize: totalSize,
transferredSize: transferredSize
}
eeApp.logger.info('[preload:download-progress] progress: ', text);
sendStatusToWindow(mainWindow, info);
})
autoUpdater.on('update-downloaded', (info) => {
@@ -110,7 +111,6 @@ module.exports = {
autoUpdater.downloadUpdate();
},
}
/**
@@ -118,7 +118,6 @@ module.exports = {
*/
function sendStatusToWindow(mainWindow, content = {}) {
const textJson = JSON.stringify(content);
eLogger.info(textJson);
const channel = 'app.updater';
mainWindow.webContents.send(channel, textJson);
}

View File

@@ -11,7 +11,7 @@ module.exports = {
* 安装
*/
install (eeApp) {
console.log('[preload] load awaken module');
eeApp.logger.info('[preload] load awaken module');
const protocolInfo = eeApp.config.awakeProtocol;
const PROTOCOL = protocolInfo.protocol;
@@ -49,7 +49,7 @@ module.exports = {
urlPath: pathname,
urlParams: search && search.slice(1)
}
console.log('[awaken] [handleUrl] awakeUrlInfo:', awakeUrlInfo);
eeApp.logger.info('[awaken] [handleUrl] awakeUrlInfo:', awakeUrlInfo);
}
}
}

View File

@@ -10,7 +10,7 @@ module.exports = {
* 安装
*/
install (eeApp) {
console.log('[preload] load security module');
eeApp.logger.info('[preload] load security module');
const runWithDebug = process.argv.find(function(e){
let isHasDebug = e.includes("--inspect") || e.includes("--inspect-brk") || e.includes("--remote-debugging-port");
return isHasDebug;
@@ -18,7 +18,7 @@ module.exports = {
// 不允许远程调试
if (runWithDebug) {
console.log('[error] Remote debugging is not allowed, runWithDebug:', runWithDebug);
eeApp.logger.error('[error] Remote debugging is not allowed, runWithDebug:', runWithDebug);
eeApp.appQuit();
}
}

View File

@@ -13,7 +13,7 @@ module.exports = {
* 安装
*/
install (eeApp) {
console.log('[preload] load tray module');
eeApp.logger.info('[preload] load tray module');
const trayConfig = eeApp.config.tray;
const mainWindow = eeApp.electron.mainWindow;

View File

@@ -15,7 +15,7 @@ const awaken = require('../library/awaken');
module.exports = async (app) => {
//已实现的功能模块,可选择性使用和修改
tray.install(app);
security.install(app);
@@ -33,7 +33,7 @@ function loadUpdate (app) {
const config = app.config.autoUpdate;
if ( (is.windows() && config.windows) || (is.macOS() && config.macOS) || (is.linux() && config.linux) ) {
const autoUpdater = require('../library/autoUpdater');
autoUpdater.install();
autoUpdater.install(app);
// 是否检查更新
if (config.force) {

View File

@@ -1,6 +1,6 @@
{
"name": "ee",
"version": "2.0.0",
"version": "2.0.1",
"description": "A fast, desktop software development framework",
"main": "main.js",
"scripts": {