diff --git a/app/libs/client/de.js b/app/libs/client/de.js
index e351fe9a..6a5b9f2e 100644
--- a/app/libs/client/de.js
+++ b/app/libs/client/de.js
@@ -1,4 +1,5 @@
const util = require('../util');
+const fs = require('fs');
exports.login = async function (username, clientUrl, password) {
const message = {
@@ -84,6 +85,65 @@ exports.addTorrent = async function (clientUrl, cookie, torrentUrl, isSkipChecki
return res;
};
+exports.addTorrentByTorrentFile = async function (clientUrl, cookie, filepath, isSkipChecking, uploadLimit, downloadLimit, savePath, label) {
+ let message = {
+ url: clientUrl + '/upload',
+ method: 'POST',
+ headers: {
+ cookie
+ },
+ formData: {
+ file: fs.createReadStream(filepath)
+ }
+ };
+ let res = await util.requestPromise(message);
+ const torrentPath = JSON.parse(res.body).files[0];
+ message = {
+ method: 'POST',
+ url: clientUrl + '/json',
+ json: true,
+ gzip: true,
+ body: {
+ id: 0,
+ method: 'web.add_torrents',
+ params: [
+ [
+ {
+ path: torrentPath,
+ options: {
+ file_priorities: [
+ 1
+ ],
+ add_paused: false,
+ sequential_download: false,
+ pre_allocate_storage: false,
+ move_completed: false,
+ max_connections: -1,
+ max_download_speed: downloadLimit,
+ max_upload_slots: -1,
+ max_upload_speed: uploadLimit,
+ prioritize_first_last_pieces: false,
+ seed_mode: isSkipChecking,
+ super_seeding: false
+ }
+ }
+ ]
+ ]
+ },
+ headers: {
+ cookie
+ }
+ };
+ if (savePath) {
+ message.body.params[0][0].options.download_location = savePath;
+ }
+ if (label) {
+ message.body.params[0][0].options.label = label;
+ }
+ res = await util.requestPromise(message);
+ return res;
+};
+
exports.getMaindata = async function (clientUrl, cookie) {
const option = {
method: 'POST',
@@ -148,6 +208,7 @@ exports.getMaindata = async function (clientUrl, cookie) {
}
torrent.progress = torrent.progress / 100;
if (+torrent.progress === -1) torrent.progress = 0;
+ torrent.originProp = { ...res.torrents[k] };
torrent.completedTime = Math.max(Date.now() / 1000 - torrent.seedingTime, torrent.addedTime);
maindata.torrents.push(torrent);
}
diff --git a/webui/src/pages/base/Downloader.vue b/webui/src/pages/base/Downloader.vue
index 65dec215..ea931101 100644
--- a/webui/src/pages/base/Downloader.vue
+++ b/webui/src/pages/base/Downloader.vue
@@ -90,11 +90,12 @@
qBittorrent
Transmission
+ Deluge
+ 克隆
+
编辑
@@ -280,6 +282,9 @@ export default {
modifyClick (row) {
this.rssRule = { ...row };
},
+ cloneClick (row) {
+ this.rssRule = { ...row, id: undefined };
+ },
async deleteRssRule (row) {
if (row.used) {
this.$message().error('组件被占用, 取消占用后删除');