Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7e927fea10 | |||
| 38cd952b44 | |||
| b07fedeba0 | |||
| 2bbaae5d7d | |||
| 003e9ffccb | |||
| 7a51dbaf5e |
@@ -17,6 +17,14 @@ body:
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: app-version
|
||||
attributes:
|
||||
label: Motrix Version
|
||||
description: Please provide detailed version information and installation method, such as macOS Apple silicon dmg, Windows Universal installation file, etc.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Environment
|
||||
|
||||
@@ -17,6 +17,14 @@ body:
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: app-version
|
||||
attributes:
|
||||
label: Motrix 版本
|
||||
description: 请提供详细的版本信息以及安装的方式,如 macOS Apple silicon dmg、Windows Universal 安装文件等
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: 环境
|
||||
|
||||
@@ -64,14 +64,16 @@
|
||||
"target": "dmg",
|
||||
"arch": [
|
||||
"x64",
|
||||
"arm64"
|
||||
"arm64",
|
||||
"universal"
|
||||
]
|
||||
},
|
||||
{
|
||||
"target": "zip",
|
||||
"arch": [
|
||||
"x64",
|
||||
"arm64"
|
||||
"arm64",
|
||||
"universal"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "Motrix",
|
||||
"version": "1.8.11",
|
||||
"version": "1.8.12",
|
||||
"description": "A full-featured download manager",
|
||||
"homepage": "https://motrix.app",
|
||||
"author": {
|
||||
|
||||
+31
-10
@@ -46,6 +46,8 @@ export default class Application extends EventEmitter {
|
||||
|
||||
this.initConfigManager()
|
||||
|
||||
this.setupLogger()
|
||||
|
||||
this.initLocaleManager()
|
||||
|
||||
this.setupApplicationMenu()
|
||||
@@ -105,6 +107,18 @@ export default class Application extends EventEmitter {
|
||||
this.configListeners = {}
|
||||
}
|
||||
|
||||
setupLogger () {
|
||||
const { userConfig } = this.configManager
|
||||
const key = 'log-level'
|
||||
const logLevel = userConfig.get(key)
|
||||
logger.transports.file.level = logLevel
|
||||
|
||||
this.configListeners[key] = userConfig.onDidChange(key, async (newValue, oldValue) => {
|
||||
logger.info(`[Motrix] detected ${key} value change event:`, newValue, oldValue)
|
||||
logger.transports.file.level = newValue
|
||||
})
|
||||
}
|
||||
|
||||
initLocaleManager () {
|
||||
this.locale = this.configManager.getLocale()
|
||||
this.localeManager = setupLocaleManager(this.locale)
|
||||
@@ -151,8 +165,10 @@ export default class Application extends EventEmitter {
|
||||
}
|
||||
|
||||
async stopEngine () {
|
||||
logger.info('[Motrix] stopEngine===>')
|
||||
try {
|
||||
await this.engineClient.shutdown({ force: true })
|
||||
logger.info('[Motrix] stopEngine.setImmediate===>')
|
||||
setImmediate(() => {
|
||||
this.engine.stop()
|
||||
})
|
||||
@@ -509,22 +525,27 @@ export default class Application extends EventEmitter {
|
||||
this.windowManager.destroyWindow(page)
|
||||
}
|
||||
|
||||
async stop () {
|
||||
stop () {
|
||||
try {
|
||||
await this.shutdownUPnPManager()
|
||||
const promises = [
|
||||
this.stopEngine(),
|
||||
this.shutdownUPnPManager(),
|
||||
this.energyManager.stopPowerSaveBlocker(),
|
||||
this.trayManager.destroy()
|
||||
]
|
||||
|
||||
this.energyManager.stopPowerSaveBlocker()
|
||||
|
||||
await this.stopEngine()
|
||||
|
||||
this.trayManager.destroy()
|
||||
return promises
|
||||
} catch (err) {
|
||||
logger.warn('[Motrix] stop error: ', err.message)
|
||||
}
|
||||
}
|
||||
|
||||
async stopAllSettled () {
|
||||
await Promise.allSettled(this.stop())
|
||||
}
|
||||
|
||||
async quit () {
|
||||
await this.stop()
|
||||
await this.stopAllSettled()
|
||||
app.exit()
|
||||
}
|
||||
|
||||
@@ -644,7 +665,7 @@ export default class Application extends EventEmitter {
|
||||
|
||||
this.updateManager.on('will-updated', async (event) => {
|
||||
this.windowManager.setWillQuit(true)
|
||||
await this.stop()
|
||||
await this.stopAllSettled()
|
||||
})
|
||||
|
||||
this.updateManager.on('update-error', (event) => {
|
||||
@@ -654,7 +675,7 @@ export default class Application extends EventEmitter {
|
||||
}
|
||||
|
||||
async relaunch () {
|
||||
await this.stop()
|
||||
await this.stopAllSettled()
|
||||
app.relaunch()
|
||||
app.exit()
|
||||
}
|
||||
|
||||
@@ -183,6 +183,7 @@ export default class Launcher extends EventEmitter {
|
||||
app.on('will-quit', () => {
|
||||
logger.info('[Motrix] will-quit')
|
||||
if (global.application) {
|
||||
logger.info('[Motrix] will-quit.application.stop')
|
||||
global.application.stop()
|
||||
}
|
||||
})
|
||||
|
||||
@@ -111,6 +111,7 @@ export default class ConfigManager {
|
||||
'last-check-update-time': 0,
|
||||
'last-sync-tracker-time': 0,
|
||||
'locale': app.getLocale(),
|
||||
'log-level': 'warn',
|
||||
'new-task-show-downloading': true,
|
||||
'no-confirm-before-delete-task': false,
|
||||
'open-at-login': false,
|
||||
|
||||
@@ -5,6 +5,7 @@ import logger from './Logger'
|
||||
let psbId
|
||||
export default class EnergyManager {
|
||||
startPowerSaveBlocker () {
|
||||
logger.info('[Motrix] EnergyManager.startPowerSaveBlocker', psbId)
|
||||
if (psbId && powerSaveBlocker.isStarted(psbId)) {
|
||||
return
|
||||
}
|
||||
@@ -14,6 +15,7 @@ export default class EnergyManager {
|
||||
}
|
||||
|
||||
stopPowerSaveBlocker () {
|
||||
logger.info('[Motrix] EnergyManager.stopPowerSaveBlocker', psbId)
|
||||
if (typeof psbId === 'undefined' || !powerSaveBlocker.isStarted(psbId)) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -67,6 +67,7 @@ export default class Engine {
|
||||
}
|
||||
|
||||
stop () {
|
||||
logger.info('[Motrix] engine.stop.instance')
|
||||
if (this.instance) {
|
||||
this.instance.kill()
|
||||
this.instance = null
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import is from 'electron-is'
|
||||
import logger from 'electron-log'
|
||||
|
||||
logger.transports.file.level = is.production() ? 'warn' : 'silly'
|
||||
logger.transports.file.level = is.production() ? 'info' : 'silly'
|
||||
logger.info('[Motrix] Logger init')
|
||||
logger.warn('[Motrix] Logger init')
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import is from 'electron-is'
|
||||
|
||||
import { APP_RUN_MODE, APP_THEME } from '@shared/constants'
|
||||
import { getInverseTheme } from '@shared/utils'
|
||||
import logger from '../core/Logger'
|
||||
import { getI18n } from './Locale'
|
||||
import {
|
||||
translateTemplate,
|
||||
@@ -12,7 +13,6 @@ import {
|
||||
updateStates
|
||||
} from '../utils/menu'
|
||||
import { convertArrayBufferToBuffer } from '../utils/index'
|
||||
// import logger from '../core/Logger'
|
||||
|
||||
let tray = null
|
||||
const { platform } = process
|
||||
@@ -357,6 +357,7 @@ export default class TrayManager extends EventEmitter {
|
||||
}
|
||||
|
||||
destroy () {
|
||||
logger.info('[Motrix] TrayManager.destroy')
|
||||
if (tray) {
|
||||
this.unbindEvents()
|
||||
}
|
||||
|
||||
@@ -358,16 +358,6 @@
|
||||
/>
|
||||
</el-input>
|
||||
</el-col>
|
||||
<el-col class="form-item-sub" :span="24">
|
||||
{{ $t('preferences.app-log-path') }}
|
||||
<el-input placeholder="" disabled v-model="logPath">
|
||||
<mo-show-in-folder
|
||||
slot="append"
|
||||
v-if="isRenderer"
|
||||
:path="logPath"
|
||||
/>
|
||||
</el-input>
|
||||
</el-col>
|
||||
<el-col class="form-item-sub" :span="24">
|
||||
{{ $t('preferences.download-session-path') }}
|
||||
<el-input placeholder="" disabled v-model="sessionPath">
|
||||
@@ -378,6 +368,30 @@
|
||||
/>
|
||||
</el-input>
|
||||
</el-col>
|
||||
<el-col class="form-item-sub" :span="24">
|
||||
{{ $t('preferences.app-log-path') }}
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="18">
|
||||
<el-input placeholder="" disabled v-model="logPath">
|
||||
<mo-show-in-folder
|
||||
slot="append"
|
||||
v-if="isRenderer"
|
||||
:path="logPath"
|
||||
/>
|
||||
</el-input>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-select v-model="form.logLevel">
|
||||
<el-option
|
||||
v-for="item in logLevels"
|
||||
:key="item"
|
||||
:label="item"
|
||||
:value="item">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-col>
|
||||
<el-col class="form-item-sub" :span="24">
|
||||
<el-button plain type="warning" @click="() => onSessionResetClick()">
|
||||
{{ $t('preferences.session-reset') }}
|
||||
@@ -414,7 +428,7 @@
|
||||
import ShowInFolder from '@/components/Native/ShowInFolder'
|
||||
import SubnavSwitcher from '@/components/Subnav/SubnavSwitcher'
|
||||
import userAgentMap from '@shared/ua'
|
||||
import { trackerSourceOptions, ENGINE_RPC_PORT, EMPTY_STRING } from '@shared/constants'
|
||||
import { trackerSourceOptions, ENGINE_RPC_PORT, EMPTY_STRING, LOG_LEVELS } from '@shared/constants'
|
||||
import {
|
||||
backupConfig,
|
||||
buildRpcUrl,
|
||||
@@ -446,6 +460,7 @@
|
||||
lastCheckUpdateTime,
|
||||
lastSyncTrackerTime,
|
||||
listenPort,
|
||||
logLevel,
|
||||
noProxy,
|
||||
protocols,
|
||||
rpcListenPort,
|
||||
@@ -466,6 +481,7 @@
|
||||
lastCheckUpdateTime,
|
||||
lastSyncTrackerTime,
|
||||
listenPort,
|
||||
logLevel,
|
||||
noProxy: convertCommaToLine(noProxy),
|
||||
protocols: {
|
||||
...protocols
|
||||
@@ -528,6 +544,9 @@
|
||||
rpcDefaultPort () {
|
||||
return ENGINE_RPC_PORT
|
||||
},
|
||||
logLevels () {
|
||||
return LOG_LEVELS
|
||||
},
|
||||
...mapState('preference', {
|
||||
config: state => state.config,
|
||||
aria2ConfPath: state => state.config.aria2ConfPath,
|
||||
|
||||
@@ -15,14 +15,13 @@ const userKeys = [
|
||||
'last-check-update-time',
|
||||
'last-sync-tracker-time',
|
||||
'locale',
|
||||
'log-path',
|
||||
'log-level',
|
||||
'new-task-show-downloading',
|
||||
'no-confirm-before-delete-task',
|
||||
'open-at-login',
|
||||
'protocols',
|
||||
'resume-all-when-app-launched',
|
||||
'run-mode',
|
||||
'session-path',
|
||||
'show-progress-bar',
|
||||
'task-notification',
|
||||
'theme',
|
||||
|
||||
@@ -27,6 +27,15 @@ export const TASK_STATUS = {
|
||||
SEEDING: 'seeding'
|
||||
}
|
||||
|
||||
export const LOG_LEVELS = [
|
||||
'error',
|
||||
'warn',
|
||||
'info',
|
||||
'verbose',
|
||||
'debug',
|
||||
'silly'
|
||||
]
|
||||
|
||||
export const MAX_NUM_OF_DIRECTORIES = 5
|
||||
|
||||
export const ENGINE_RPC_HOST = '127.0.0.1'
|
||||
|
||||
Reference in New Issue
Block a user