Skip to content

A full-featured download manager.

fix: reorganize the code

dicarne60161518c650
diff --git a/src/main/core/ConfigManager.js b/src/main/core/ConfigManager.js
index 192bbc5f..68b40e14 100644
--- a/src/main/core/ConfigManager.js
+++ b/src/main/core/ConfigManager.js
@@ -59,6 +59,8 @@ export default class ConfigManager {
'dht-file-path6': getDhtPath(IP_VERSION.V6),
'dht-listen-port': 26701,
'dir': getUserDownloadsPath(),
+ 'follow-metalink': false,
+ 'follow-torrent': false,
'listen-port': 21301,
'max-concurrent-downloads': 5,
'max-connection-per-server': getMaxConnectionPerServer(),
diff --git a/src/renderer/components/Preference/Basic.vue b/src/renderer/components/Preference/Basic.vue
index 25db2821..2581bbe4 100644
--- a/src/renderer/components/Preference/Basic.vue
+++ b/src/renderer/components/Preference/Basic.vue
@@ -186,14 +186,14 @@
<el-col class="form-item-sub" :span="24">
<el-switch
v-model="form.followMetalink"
- :active-text="$t('preferences.no-auto-download-files-in-magnet-link')"
+ :active-text="$t('preferences.follow-metalink')"
>
</el-switch>
</el-col>
<el-col class="form-item-sub" :span="24">
<el-switch
v-model="form.followTorrent"
- :active-text="$t('preferences.auto-download-files-in-torrent-link')"
+ :active-text="$t('preferences.follow-torrent')"
>
</el-switch>
</el-col>
@@ -285,6 +285,8 @@
btSaveMetadata,
dir,
engineMaxConnectionPerServer,
+ followMetalink,
+ followTorrent,
hideAppMenu,
keepSeeding,
keepWindowState,
@@ -302,9 +304,7 @@
seedTime,
taskNotification,
theme,
- traySpeedometer,
- followMetalink,
- followTorrent
+ traySpeedometer
} = config
const result = {
autoHideWindow,
@@ -312,6 +312,8 @@
continue: config.continue,
dir,
engineMaxConnectionPerServer,
+ followMetalink,
+ followTorrent,
hideAppMenu,
keepSeeding,
keepWindowState,
@@ -329,9 +331,7 @@
seedTime,
taskNotification,
theme,
- traySpeedometer,
- followMetalink,
- followTorrent
+ traySpeedometer
}
return result
}
diff --git a/src/renderer/components/TaskDetail/Index.vue b/src/renderer/components/TaskDetail/Index.vue
index 5c5c5328..d2732a78 100644
--- a/src/renderer/components/TaskDetail/Index.vue
+++ b/src/renderer/components/TaskDetail/Index.vue
@@ -168,7 +168,6 @@
}
})
merge(cached.files, result)
- cached.files.splice(result.length, cached.files.length - result.length)
return cached.files
},
selectedFileList () {
@@ -185,6 +184,11 @@
window.removeEventListener('resize', this.handleAppResize)
cached.files = []
},
+ watch: {
+ gid () {
+ cached.files = []
+ }
+ },
methods: {
handleClose (done) {
window.removeEventListener('resize', this.handleAppResize)
diff --git a/src/renderer/utils/task.js b/src/renderer/utils/task.js
index 642199b4..c7a21027 100644
--- a/src/renderer/utils/task.js
+++ b/src/renderer/utils/task.js
@@ -14,17 +14,19 @@ export const initTaskForm = state => {
allProxy,
dir,
engineMaxConnectionPerServer,
+ followMetalink,
+ followTorrent,
maxConnectionPerServer,
newTaskShowDownloading,
- split,
- followTorrent,
- followMetalink
+ split
} = state.preference.config
const result = {
allProxy,
cookie: '',
dir,
engineMaxConnectionPerServer,
+ followMetalink,
+ followTorrent,
maxConnectionPerServer,
newTaskShowDownloading,
out: '',
@@ -34,8 +36,6 @@ export const initTaskForm = state => {
torrent: '',
uris: addTaskUrl,
userAgent: '',
- notFollowMetalink: followMetalink,
- followTorrent,
...addTaskOptions
}
return result
@@ -98,7 +98,7 @@ export const buildOption = (type, form) => {
result.header = header
}
- result.pauseMetadata = !!form.notFollowMetalink
+ result.pauseMetadata = !form.followMetalink
result.followTorrent = !!form.followTorrent
return result
}
diff --git a/src/shared/locales/zh-CN/preferences.js b/src/shared/locales/zh-CN/preferences.js
index 5978fbf0..a62f9dbb 100644
--- a/src/shared/locales/zh-CN/preferences.js
+++ b/src/shared/locales/zh-CN/preferences.js
@@ -78,6 +78,6 @@ export default {
'auto-update': '自动更新',
'auto-check-update': '自动检查更新',
'last-check-update-time': '上次检查更新时间',
- 'no-auto-download-files-in-magnet-link': '禁止自动下载磁力链接、种子内的文件',
- 'auto-download-files-in-torrent-link': '种子下载完后下载种子内容'
+ 'follow-metalink': '自动开始下载磁力链接、种子内的文件',
+ 'follow-torrent': '种子下载完后自动下载种子内容'
}