refactor: code improve
This commit is contained in:
@@ -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
|
||||
}
|
||||
},
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 = {}) => {
|
||||
|
||||
@@ -114,7 +114,7 @@ const actions = {
|
||||
favoriteDirectories: favorite
|
||||
})
|
||||
},
|
||||
updateThemeConfig ({ dispatch }, theme) {
|
||||
updateAppTheme ({ dispatch }, theme) {
|
||||
dispatch('updatePreference', { theme })
|
||||
},
|
||||
updatePreference ({ commit }, config) {
|
||||
|
||||
@@ -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: [
|
||||
|
||||
Reference in New Issue
Block a user