Skip to content

A full-featured download manager.

feat: auto remove aria2c unrecognized options

Dr_rOotb9bc5e6c075f
diff --git a/src/main/core/ConfigManager.js b/src/main/core/ConfigManager.js
index bd771c3e..35ae791b 100644
--- a/src/main/core/ConfigManager.js
+++ b/src/main/core/ConfigManager.js
@@ -14,6 +14,7 @@ import {
NGOSANG_TRACKERS_ALL_URL,
NGOSANG_TRACKERS_ALL_IP_URL
} from '@shared/constants'
+import { separateConfig } from '@shared/utils'
export default class ConfigManager {
constructor () {
@@ -63,6 +64,7 @@ export default class ConfigManager {
'user-agent': 'Transmission/2.94'
}
})
+ this.fixSystemConfig()
}
initUserConfig () {
@@ -104,6 +106,18 @@ export default class ConfigManager {
this.fixUserConfig()
}
+ fixSystemConfig () {
+ // Remove aria2c unrecognized options
+ const { others } = separateConfig(this.systemConfig.store)
+ if (!others) {
+ return
+ }
+
+ Object.keys(others).forEach(key => {
+ this.systemConfig.delete(key)
+ })
+ }
+
fixUserConfig () {
// Fix the value of open-at-login when the user delete
// the Motrix self-starting item through startup management.
diff --git a/src/main/core/Engine.js b/src/main/core/Engine.js
index b2c18f8e..5367d581 100644
--- a/src/main/core/Engine.js
+++ b/src/main/core/Engine.js
@@ -1,5 +1,3 @@
-'use strict'
-
import { app } from 'electron'
import is from 'electron-is'
import { existsSync } from 'fs'