Skip to content

A full-featured download manager.

feat: add task support out rule #326

Dr_rOot575712ba9fe7
diff --git a/src/renderer/api/Api.js b/src/renderer/api/Api.js
index 1dfcfaca..4dd98803 100644
--- a/src/renderer/api/Api.js
+++ b/src/renderer/api/Api.js
@@ -163,10 +163,14 @@ export default class Api {
addUri (params) {
const {
uris,
+ outs,
options
} = params
- const kebabOptions = changeKeysToKebabCase(options)
- const tasks = uris.map((uri) => {
+ const tasks = uris.map((uri, index) => {
+ const kebabOptions = changeKeysToKebabCase(options)
+ if (outs && outs[index]) {
+ kebabOptions['out'] = outs[index]
+ }
const args = compactUndefined([[uri], kebabOptions])
return [ 'aria2.addUri', ...args ]
})
diff --git a/src/renderer/components/Task/AddTask.vue b/src/renderer/components/Task/AddTask.vue
index b33a1728..6bb42b45 100644
--- a/src/renderer/components/Task/AddTask.vue
+++ b/src/renderer/components/Task/AddTask.vue
@@ -120,6 +120,7 @@
NONE_SELECTED_FILES,
SELECTED_ALL_FILES
} from '@shared/constants'
+ import { buildOuts } from '@shared/rename'
import {
detectResource,
splitTaskLinks
@@ -320,14 +321,17 @@
return result
},
buildUriPayload (form) {
- let { uris } = form
+ let { uris, out } = form
if (isEmpty(uris)) {
throw new Error(this.$t('task.new-task-uris-required'))
}
uris = splitTaskLinks(uris)
+ const outs = buildOuts(uris, out)
+
const options = this.buildOption('uri', form)
const result = {
uris,
+ outs,
options
}
return result
diff --git a/src/renderer/store/modules/task.js b/src/renderer/store/modules/task.js
index 92d837f8..e2dc5ca4 100644
--- a/src/renderer/store/modules/task.js
+++ b/src/renderer/store/modules/task.js
@@ -53,8 +53,8 @@ const actions = {
commit('UPDATE_CURRENT_TASK_ITEM', task)
},
addUri ({ dispatch }, data) {
- const { uris, options } = data
- return api.addUri({ uris, options })
+ const { uris, outs, options } = data
+ return api.addUri({ uris, outs, options })
.then(() => {
dispatch('fetchList')
dispatch('app/updateAddTaskOptions', {}, { root: true })