refactor: code improve

This commit is contained in:
Dr_rOot
2023-05-20 18:27:09 +08:00
parent 4d7922f112
commit ff808dc462
6 changed files with 13 additions and 14 deletions
+5 -6
View File
@@ -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'))
@@ -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
}
},
+3 -3
View File
@@ -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()
}
}
+1 -1
View File
@@ -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 = {}) => {
+1 -1
View File
@@ -114,7 +114,7 @@ const actions = {
favoriteDirectories: favorite
})
},
updateThemeConfig ({ dispatch }, theme) {
updateAppTheme ({ dispatch }, theme) {
dispatch('updatePreference', { theme })
},
updatePreference ({ commit }, config) {
+1 -1
View File
@@ -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: [