Skip to content

Commit

Permalink
feat: 支持Deluge
Browse files Browse the repository at this point in the history
feat: 新增 rss 规格克隆
  • Loading branch information
KyokoMiki authored and vertex-app committed Jul 30, 2024
1 parent 4fd9eb2 commit 8593e40
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 1 deletion.
61 changes: 61 additions & 0 deletions app/libs/client/de.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const util = require('../util');
const fs = require('fs');

exports.login = async function (username, clientUrl, password) {
const message = {
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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);
}
Expand Down
3 changes: 2 additions & 1 deletion webui/src/pages/base/Downloader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,12 @@
<a-form-item
label="下载器类型"
name="type"
extra="下载器类型, 目前仅支持 qBittorrentTransmission"
extra="下载器类型, 目前完整支持 qBittorrent, Deluge 和 Transmission 不完全支持"
:rules="[{ required: true, message: '${label}不可为空! ' }]">
<a-select size="small" v-model:value="downloader.type" >
<a-select-option value="qBittorrent">qBittorrent</a-select-option>
<a-select-option value="Transmission">Transmission</a-select-option>
<a-select-option value="deluge">Deluge</a-select-option>
</a-select>
</a-form-item>
<a-form-item
Expand Down
5 changes: 5 additions & 0 deletions webui/src/pages/rule/Rss.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
</template>
<template v-if="column.title === '操作'">
<span>
<a @click="cloneClick(record)">克隆</a>
<a-divider type="vertical" />
<a @click="modifyClick(record)">编辑</a>
<a-divider type="vertical" />
<a-popover title="删除?" trigger="click" :overlayStyle="{ width: '84px', overflow: 'hidden' }">
Expand Down Expand Up @@ -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('组件被占用, 取消占用后删除');
Expand Down

0 comments on commit 8593e40

Please sign in to comment.