Simple Torrent 是基于 Cloud Torrent 二开的应用程序,可以配置在服务器中作为远程下载器使用。搭配自身的 donecmd 功能可以调用外部命令实现下载完成后自动上传到 Onedrive 等网盘中。同时还具有 BT 加密下载、种子订阅等功能。
在控制台执行
$ bash <(wget -qO- https://raw.githubusercontent.com/boypt/simple-torrent/master/scripts/quickinstall.sh)
即可完成安装,服务将运行在ip:3000
端口上
命令
$ systemctl start cloud-torrent #启动程序
$ systemctl restart cloud-torrent #重启程序
$ systemctl stop cloud-torrent #停止程序
$ systemctl status cloud-torrent #查看状态
在程序更新后可能会出现初始验证失效的情况,可以在/etc/systemd/system/cloud-torrent.service
文件中修改
[Unit]
Description=Cloud torrent download manager
After=network.target
[Service]
Type=simple
User=root
WorkingDirectory=~
Environment=AUTH=user:ctorrent #验证内容,用户名:密码
Environment=PORT=3000
ExecStart=/usr/local/bin/cloud-torrent -c ./cloud-torrent.json --host 0.0.0.0 --disable-log-time
Restart=always
RestartPreventExitStatus=42
RestartSec=
[Install]
WantedBy=multi-user.target
修改完成后执行以下命令
$ systemctl daemon-reload
$ systemctl restart cloud-torrent
在 Nginx 配置文件中写入以下内容
location / {
proxy_pass http://127.0.0.1:3000;
}
location /sync {
proxy_pass http://127.0.0.1:3000;
proxy_set_header Connection '';
proxy_http_version 1.1;
chunked_transfer_encoding off;
proxy_buffering off;
proxy_cache off;
}
完整的 conf 配置文件如下
server {
listen 80;
listen [::]:80;
listen 443 ssl http2;
listen [::]:443 ssl http2;
ssl_certificate #;
ssl_certificate_key #;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
ssl_ciphers TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-GCM-SHA256:TLS13-AES-128-CCM-8-SHA256:TLS13-AES-128-CCM-SHA256:EEC$
ssl_prefer_server_ciphers on;
ssl_session_timeout 10m;
ssl_session_cache builtin:1000 shared:SSL:10m;
ssl_buffer_size 1400;
add_header Strict-Transport-Security max-age=15768000;
ssl_stapling on;
ssl_stapling_verify on;
server_name #;
if ($ssl_protocol = "") { return 301 https://$host$request_uri; }
location / {
proxy_pass http://127.0.0.1:3000;
}
location /sync {
proxy_pass http://127.0.0.1:3000;
proxy_set_header Connection '';
proxy_http_version 1.1;
chunked_transfer_encoding off;
proxy_buffering off;
proxy_cache off;
}
}
创建一个调用脚本,up.sh
,以下命令适用于 Rclone 挂载的 Onedrive 云盘
#!/bin/bash
if [[ ${CLD_TYPE} == "torrent" ]]; then
eval rclone move \'"${CLD_DIR}/${CLD_PATH}"\' "rc:update"; #此处的"rc:update"可按照rclone move命令自行修改远程目录
fi
给与脚本执行权限
$ chmod +x up.sh
配置 Simple Torrent 调用外部指令,修改配置文件cloud-torrent.json
#外部指令地址
"donecmd": "/root/up.sh", #填写刚才配置的脚本地址
重启服务完成设置
$ systemctl restart cloud-torrent