Skip to content

A full-featured download manager.

refactor: code improve

Dr_rOotff808dc46296
diff --git a/src/main/core/ConfigManager.js b/src/main/core/ConfigManager.js
index 3adab314..bb572afe 100644
--- a/src/main/core/ConfigManager.js
+++ b/src/main/core/ConfigManager.js
@@ -31,8 +31,8 @@ export default class ConfigManager {
}
init () {
- this.initSystemConfig()
this.initUserConfig()
+ this.initSystemConfig()
}
/**
@@ -140,13 +140,12 @@ export default class ConfigManager {
fixSystemConfig () {
// Remove aria2c unrecognized options
const { others } = separateConfig(this.systemConfig.store)
- if (!others) {
- return
+ if (others && Object.keys(others).length > 0) {
+ Object.keys(others).forEach(key => {
+ this.systemConfig.delete(key)
+ })
}
- Object.keys(others).forEach(key => {
- this.systemConfig.delete(key)
- })
// Fix spawn ENAMETOOLONG on Windows
const tracker = reduceTrackerString(this.systemConfig.get('bt-tracker'))
diff --git a/src/renderer/components/Preference/Advanced.vue b/src/renderer/components/Preference/Advanced.vue
index 0d185456..8a276997 100644
--- a/src/renderer/components/Preference/Advanced.vue
+++ b/src/renderer/components/Preference/Advanced.vue
@@ -432,7 +432,7 @@
EMPTY_STRING,
ENGINE_RPC_PORT,
LOG_LEVELS,
- trackerSourceOptions
+ TRACKER_SOURCE_OPTIONS,
} from '@shared/constants'
import {
backupConfig,
@@ -516,7 +516,7 @@
formOriginal,
hideRpcSecret: true,
rules: {},
- trackerSourceOptions,
+ trackerSourceOptions: TRACKER_SOURCE_OPTIONS,
trackerSyncing: false
}
},
diff --git a/src/renderer/pages/index/App.vue b/src/renderer/pages/index/App.vue
index da8a5261..4511a10d 100644
--- a/src/renderer/pages/index/App.vue
+++ b/src/renderer/pages/index/App.vue
@@ -78,13 +78,13 @@
this.updateRootClassName()
},
watch: {
- themeClass (val, oldVal) {
+ themeClass () {
this.updateRootClassName()
},
- i18nClass (val, oldVal) {
+ i18nClass () {
this.updateRootClassName()
},
- directionClass (val, oldVal) {
+ directionClass () {
this.updateRootClassName()
}
}
diff --git a/src/renderer/pages/index/commands.js b/src/renderer/pages/index/commands.js
index 7d0457c6..ade68020 100644
--- a/src/renderer/pages/index/commands.js
+++ b/src/renderer/pages/index/commands.js
@@ -22,7 +22,7 @@ const updateSystemTheme = (payload = {}) => {
const updateTheme = (payload = {}) => {
const { theme } = payload
- store.dispatch('preference/updateThemeConfig', theme)
+ store.dispatch('preference/updateAppTheme', theme)
}
const updateTrayFocused = (payload = {}) => {
diff --git a/src/renderer/store/modules/preference.js b/src/renderer/store/modules/preference.js
index f7e39e32..b6851923 100644
--- a/src/renderer/store/modules/preference.js
+++ b/src/renderer/store/modules/preference.js
@@ -114,7 +114,7 @@ const actions = {
favoriteDirectories: favorite
})
},
- updateThemeConfig ({ dispatch }, theme) {
+ updateAppTheme ({ dispatch }, theme) {
dispatch('updatePreference', { theme })
},
updatePreference ({ commit }, config) {
diff --git a/src/shared/constants.js b/src/shared/constants.js
index eced3ff2..ff1f402a 100644
--- a/src/shared/constants.js
+++ b/src/shared/constants.js
@@ -89,7 +89,7 @@ export const XIU2_TRACKERS_HTTP_URL_CDN = 'https://fastly.jsdelivr.net/gh/XIU2/T
// For bt-exclude-tracker
export const XIU2_TRACKERS_BLACK_URL = 'https://fastly.jsdelivr.net/gh/XIU2/TrackersListCollection/blacklist.txt'
-export const trackerSourceOptions = [
+export const TRACKER_SOURCE_OPTIONS = [
{
label: 'ngosang/trackerslist',
options: [