From c6722d141b514b98fad9ab8df216fff8cbaea99c Mon Sep 17 00:00:00 2001 From: dicarne Date: Wed, 9 Jun 2021 00:37:54 +0800 Subject: [PATCH 1/3] fix: tasks list has old wrong items --- src/renderer/components/TaskDetail/Index.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderer/components/TaskDetail/Index.vue b/src/renderer/components/TaskDetail/Index.vue index 27e215ba3..5c5c53282 100644 --- a/src/renderer/components/TaskDetail/Index.vue +++ b/src/renderer/components/TaskDetail/Index.vue @@ -168,7 +168,7 @@ } }) merge(cached.files, result) - + cached.files.splice(result.length, cached.files.length - result.length) return cached.files }, selectedFileList () { From a77e62066aa02792f4d0df004f7698192ddf6d60 Mon Sep 17 00:00:00 2001 From: dicarne Date: Wed, 9 Jun 2021 13:09:28 +0800 Subject: [PATCH 2/3] feat: add switch for auto download magnet and torrent --- src/renderer/components/Preference/Basic.vue | 22 ++++++++++++++++++-- src/renderer/utils/task.js | 9 +++++++- src/shared/locales/zh-CN/preferences.js | 4 +++- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/src/renderer/components/Preference/Basic.vue b/src/renderer/components/Preference/Basic.vue index 9f3f18c2f..25db2821b 100644 --- a/src/renderer/components/Preference/Basic.vue +++ b/src/renderer/components/Preference/Basic.vue @@ -183,6 +183,20 @@ :label="$t('preferences.seed-time')"> + + + + + + + +
@@ -288,7 +302,9 @@ seedTime, taskNotification, theme, - traySpeedometer + traySpeedometer, + followMetalink, + followTorrent } = config const result = { autoHideWindow, @@ -313,7 +329,9 @@ seedTime, taskNotification, theme, - traySpeedometer + traySpeedometer, + followMetalink, + followTorrent } return result } diff --git a/src/renderer/utils/task.js b/src/renderer/utils/task.js index afb4e602a..642199b4e 100644 --- a/src/renderer/utils/task.js +++ b/src/renderer/utils/task.js @@ -16,7 +16,9 @@ export const initTaskForm = state => { engineMaxConnectionPerServer, maxConnectionPerServer, newTaskShowDownloading, - split + split, + followTorrent, + followMetalink } = state.preference.config const result = { allProxy, @@ -32,6 +34,8 @@ export const initTaskForm = state => { torrent: '', uris: addTaskUrl, userAgent: '', + notFollowMetalink: followMetalink, + followTorrent, ...addTaskOptions } return result @@ -93,6 +97,9 @@ export const buildOption = (type, form) => { if (!isEmpty(header)) { result.header = header } + + result.pauseMetadata = !!form.notFollowMetalink + 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 ebb90ccc5..5978fbf0e 100644 --- a/src/shared/locales/zh-CN/preferences.js +++ b/src/shared/locales/zh-CN/preferences.js @@ -77,5 +77,7 @@ export default { 'baidu-exporter-help': '点此查看使用说明', 'auto-update': '自动更新', 'auto-check-update': '自动检查更新', - 'last-check-update-time': '上次检查更新时间' + 'last-check-update-time': '上次检查更新时间', + 'no-auto-download-files-in-magnet-link': '禁止自动下载磁力链接、种子内的文件', + 'auto-download-files-in-torrent-link': '种子下载完后下载种子内容' } From 60161518c650f368d27d9936f2a1cfa350a6d4b3 Mon Sep 17 00:00:00 2001 From: dicarne Date: Tue, 15 Jun 2021 19:50:27 +0800 Subject: [PATCH 3/3] fix: reorganize the code --- src/main/core/ConfigManager.js | 2 ++ src/renderer/components/Preference/Basic.vue | 16 ++++++++-------- src/renderer/components/TaskDetail/Index.vue | 6 +++++- src/renderer/utils/task.js | 12 ++++++------ src/shared/locales/zh-CN/preferences.js | 4 ++-- 5 files changed, 23 insertions(+), 17 deletions(-) diff --git a/src/main/core/ConfigManager.js b/src/main/core/ConfigManager.js index 192bbc5ff..68b40e14d 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 25db2821b..2581bbe4e 100644 --- a/src/renderer/components/Preference/Basic.vue +++ b/src/renderer/components/Preference/Basic.vue @@ -186,14 +186,14 @@ @@ -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 5c5c53282..d2732a783 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 642199b4e..c7a210279 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 5978fbf0e..a62f9dbb2 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': '种子下载完后自动下载种子内容' }