Merge remote-tracking branch 'rogerfar/master'
# Conflicts: # server/RdtClient.Service/RdtClient.Service.csproj # server/RdtClient.Service/Services/DownloadClient.cs
This commit is contained in:
commit
eeef6fb7fe
21 changed files with 768 additions and 113 deletions
|
|
@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
|
|||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [2.0.95] - 2025-01-19
|
||||
### Added
|
||||
- Added the /api/v2/transfer/info qBittorrent endpoint.
|
||||
|
||||
### Changed
|
||||
- AllDebrid Symlink path fixes.
|
||||
|
||||
## [2.0.94] - 2025-01-05
|
||||
### Changed
|
||||
- AllDebrid path fixes.
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@ WORKDIR /appclient
|
|||
|
||||
RUN apk add --no-cache git python3 py3-pip make g++
|
||||
|
||||
COPY client ./client
|
||||
COPY root ./root
|
||||
RUN \
|
||||
echo "**** Cloning Source Code ****" && \
|
||||
git clone https://github.com/rogerfar/rdt-client.git . && \
|
||||
cd client && \
|
||||
echo "**** Building Code ****" && \
|
||||
npm ci && \
|
||||
|
|
@ -30,9 +30,8 @@ ENV BUILDPLATFORM=${BUILDPLATFORM:-linux/amd64}
|
|||
RUN mkdir /appserver
|
||||
WORKDIR /appserver
|
||||
|
||||
COPY server ./server
|
||||
RUN \
|
||||
echo "**** Cloning Source Code ****" && \
|
||||
git clone https://github.com/rogerfar/rdt-client.git . && \
|
||||
echo "**** Building Source Code for $TARGETPLATFORM on $BUILDPLATFORM ****" && \
|
||||
cd server && \
|
||||
dotnet restore --no-cache RdtClient.sln && dotnet publish --no-restore -c Release -o out ;
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@
|
|||
<a class="navbar-item" routerLink="profile"> Profile </a>
|
||||
<a class="navbar-item" (click)="logout()"> Logout </a>
|
||||
<hr class="navbar-divider" />
|
||||
<a href="https://github.com/rogerfar/rdt-client" target="_blank" class="navbar-item">Version 2.0.94</a>
|
||||
<a href="https://github.com/rogerfar/rdt-client" target="_blank" class="navbar-item">Version 2.0.95</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "rdt-client",
|
||||
"version": "2.0.94",
|
||||
"version": "2.0.95",
|
||||
"description": "This is a web interface to manage your torrents on Real-Debrid.",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
|
|
|
|||
479
server/RdtClient.Data/Migrations/20250106112750_Torrent_Add_ClientKind.Designer.cs
generated
Normal file
479
server/RdtClient.Data/Migrations/20250106112750_Torrent_Add_ClientKind.Designer.cs
generated
Normal file
|
|
@ -0,0 +1,479 @@
|
|||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using RdtClient.Data.Data;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace RdtClient.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(DataContext))]
|
||||
[Migration("20250106112750_Torrent_Add_ClientKind")]
|
||||
partial class Torrent_Add_ClientKind
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "9.0.0");
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("NormalizedName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NormalizedName")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("RoleNameIndex");
|
||||
|
||||
b.ToTable("AspNetRoles", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("ClaimType")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("ClaimValue")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("RoleId")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("AspNetRoleClaims", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUser", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("AccessFailedCount")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("ConcurrencyStamp")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<bool>("EmailConfirmed")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<bool>("LockoutEnabled")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTimeOffset?>("LockoutEnd")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("NormalizedEmail")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("NormalizedUserName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("PasswordHash")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("PhoneNumber")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<bool>("PhoneNumberConfirmed")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("SecurityStamp")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<bool>("TwoFactorEnabled")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("UserName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NormalizedEmail")
|
||||
.HasDatabaseName("EmailIndex");
|
||||
|
||||
b.HasIndex("NormalizedUserName")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("UserNameIndex");
|
||||
|
||||
b.ToTable("AspNetUsers", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("ClaimType")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("ClaimValue")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("UserId")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("AspNetUserClaims", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
|
||||
{
|
||||
b.Property<string>("LoginProvider")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("ProviderKey")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("ProviderDisplayName")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("UserId")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("LoginProvider", "ProviderKey");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("AspNetUserLogins", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
|
||||
{
|
||||
b.Property<string>("UserId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("RoleId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("UserId", "RoleId");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("AspNetUserRoles", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
|
||||
{
|
||||
b.Property<string>("UserId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("LoginProvider")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Value")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("UserId", "LoginProvider", "Name");
|
||||
|
||||
b.ToTable("AspNetUserTokens", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RdtClient.Data.Models.Data.Download", b =>
|
||||
{
|
||||
b.Property<Guid>("DownloadId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTimeOffset>("Added")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTimeOffset?>("Completed")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTimeOffset?>("DownloadFinished")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTimeOffset?>("DownloadQueued")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTimeOffset?>("DownloadStarted")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Error")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("FileName")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Link")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Path")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("RemoteId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("RetryCount")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<Guid>("TorrentId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTimeOffset?>("UnpackingFinished")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTimeOffset?>("UnpackingQueued")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTimeOffset?>("UnpackingStarted")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("DownloadId");
|
||||
|
||||
b.HasIndex("TorrentId");
|
||||
|
||||
b.ToTable("Downloads");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RdtClient.Data.Models.Data.Setting", b =>
|
||||
{
|
||||
b.Property<string>("SettingId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Value")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("SettingId");
|
||||
|
||||
b.ToTable("Settings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RdtClient.Data.Models.Data.Torrent", b =>
|
||||
{
|
||||
b.Property<Guid>("TorrentId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTimeOffset>("Added")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Category")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int?>("ClientKind")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTimeOffset?>("Completed")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("DeleteOnError")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("DownloadAction")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("DownloadClient")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("DownloadManualFiles")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("DownloadMinSize")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("DownloadRetryAttempts")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Error")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("ExcludeRegex")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("FileOrMagnet")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTimeOffset?>("FilesSelected")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("FinishedAction")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Hash")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("HostDownloadAction")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("IncludeRegex")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<bool>("IsFile")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("Lifetime")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int?>("Priority")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTimeOffset?>("RdAdded")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTimeOffset?>("RdEnded")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("RdFiles")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("RdHost")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("RdId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("RdName")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<long?>("RdProgress")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<long?>("RdSeeders")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<long?>("RdSize")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<long?>("RdSpeed")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<long?>("RdSplit")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int?>("RdStatus")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("RdStatusRaw")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTimeOffset?>("Retry")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("RetryCount")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("TorrentRetryAttempts")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("TorrentId");
|
||||
|
||||
b.ToTable("Torrents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
|
||||
{
|
||||
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RdtClient.Data.Models.Data.Download", b =>
|
||||
{
|
||||
b.HasOne("RdtClient.Data.Models.Data.Torrent", "Torrent")
|
||||
.WithMany("Downloads")
|
||||
.HasForeignKey("TorrentId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Torrent");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("RdtClient.Data.Models.Data.Torrent", b =>
|
||||
{
|
||||
b.Navigation("Downloads");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace RdtClient.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Torrent_Add_ClientKind : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "ClientKind",
|
||||
table: "Torrents",
|
||||
type: "INTEGER",
|
||||
nullable: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ClientKind",
|
||||
table: "Torrents");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -293,6 +293,9 @@ namespace RdtClient.Data.Migrations
|
|||
b.Property<string>("Category")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int?>("ClientKind")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTimeOffset?>("Completed")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ public class Torrent
|
|||
[InverseProperty("Torrent")]
|
||||
public IList<Download> Downloads { get; set; } = [];
|
||||
|
||||
public TorrentClientKind? ClientKind { get; set; }
|
||||
public String? RdId { get; set; }
|
||||
public String? RdName { get; set; }
|
||||
public Int64? RdSize { get; set; }
|
||||
|
|
@ -92,4 +93,12 @@ public class Torrent
|
|||
return DownloadManualFiles.Split(",");
|
||||
}
|
||||
}
|
||||
|
||||
public enum TorrentClientKind
|
||||
{
|
||||
AllDebrid,
|
||||
Premiumize,
|
||||
RealDebrid,
|
||||
TorBox
|
||||
}
|
||||
}
|
||||
30
server/RdtClient.Data/Models/QBittorrent/TransferInfo.cs
Normal file
30
server/RdtClient.Data/Models/QBittorrent/TransferInfo.cs
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace RdtClient.Data.Models.QBittorrent;
|
||||
|
||||
public class TransferInfo
|
||||
{
|
||||
[JsonPropertyName("connection_status")]
|
||||
public String ConnectionStatus { get; set; } = default!;
|
||||
|
||||
[JsonPropertyName("dht_nodes")]
|
||||
public Int64 DhtNodes { get; set; }
|
||||
|
||||
[JsonPropertyName("dl_info_data")]
|
||||
public Int64 DlInfoData { get; set; }
|
||||
|
||||
[JsonPropertyName("dl_info_speed")]
|
||||
public Int64 DlInfoSpeed { get; set; }
|
||||
|
||||
[JsonPropertyName("dl_rate_limit")]
|
||||
public Int64 DlRateLimit { get; set; }
|
||||
|
||||
[JsonPropertyName("up_info_data")]
|
||||
public Int64 UpInfoData { get; set; }
|
||||
|
||||
[JsonPropertyName("up_info_speed")]
|
||||
public Int64 UpInfoSpeed { get; set; }
|
||||
|
||||
[JsonPropertyName("up_rate_limit")]
|
||||
public Int64 UpRateLimit { get; set; }
|
||||
}
|
||||
|
|
@ -8,11 +8,11 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="9.0.0" />
|
||||
<PackageReference Include="Microsoft.Data.Sqlite" Version="9.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="9.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.0">
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="9.0.1" />
|
||||
<PackageReference Include="Microsoft.Data.Sqlite" Version="9.0.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="9.0.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.1">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ public static class DownloadHelper
|
|||
if (matchingTorrentFiles.Count > 0)
|
||||
{
|
||||
var matchingTorrentFile = matchingTorrentFiles[0];
|
||||
|
||||
var subPath = Path.GetDirectoryName(matchingTorrentFile.Path);
|
||||
|
||||
if (!String.IsNullOrWhiteSpace(subPath))
|
||||
|
|
@ -49,22 +48,23 @@ public static class DownloadHelper
|
|||
|
||||
torrentPath = Path.Combine(torrentPath, subPath);
|
||||
}
|
||||
else if (torrent.Files.Count == 1)
|
||||
{
|
||||
if (directory != fileName)
|
||||
{
|
||||
throw new($"Torrent path {torrentPath} does not match file name {fileName}. This is a requirement for single file torrents.");
|
||||
}
|
||||
|
||||
return torrentPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (torrent.Files.Count == 1)
|
||||
{
|
||||
// Debrid servers such as RealDebrid store single file torrents in a subfolder, but AllDebrid doesn't.
|
||||
// We should replicate this behavior so that both folder structures are equal.
|
||||
// See issue: https://github.com/rogerfar/rdt-client/issues/648
|
||||
if (torrent.ClientKind != Torrent.TorrentClientKind.AllDebrid)
|
||||
{
|
||||
torrentPath = Path.Combine(downloadPath, directory);
|
||||
}
|
||||
|
||||
var torrentFile = torrent.Files[0];
|
||||
var subPath = Path.GetDirectoryName(torrentFile.Path);
|
||||
|
||||
|
||||
// What we think is a single file torrent may also be a folder with a single file in it.
|
||||
// So make sure we handle that here. If this is not the case, torrentPath will be empty below.
|
||||
if (!String.IsNullOrWhiteSpace(subPath))
|
||||
{
|
||||
subPath = subPath.Trim('/').Trim('\\');
|
||||
|
|
|
|||
|
|
@ -11,17 +11,17 @@
|
|||
<FrameworkReference Include="Microsoft.AspNetCore.App" />
|
||||
<PackageReference Include="AllDebrid.NET" Version="1.0.12" />
|
||||
<PackageReference Include="Aria2.NET" Version="1.0.5" />
|
||||
<PackageReference Include="Downloader" Version="3.3.1" />
|
||||
<PackageReference Include="Downloader" Version="3.3.3" />
|
||||
<PackageReference Include="Downloader.NET" Version="1.0.12" />
|
||||
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="9.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="9.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="9.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="9.1.0" />
|
||||
<PackageReference Include="MonoTorrent" Version="3.0.2" />
|
||||
<PackageReference Include="Polly" Version="8.5.0" />
|
||||
<PackageReference Include="Polly" Version="8.5.1" />
|
||||
<PackageReference Include="Premiumize.NET" Version="1.0.4" />
|
||||
<PackageReference Include="RD.NET" Version="2.1.6" />
|
||||
<PackageReference Include="Serilog" Version="4.2.0" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
|
||||
<PackageReference Include="SharpCompress" Version="0.38.0" />
|
||||
<PackageReference Include="SharpCompress" Version="0.39.0" />
|
||||
<PackageReference Include="Synology.Api.Client" Version="0.3.87" />
|
||||
<PackageReference Include="TorBox.NET" Version="1.3.2" />
|
||||
</ItemGroup>
|
||||
|
|
|
|||
|
|
@ -6,6 +6,9 @@ namespace RdtClient.Service.Services;
|
|||
|
||||
public class DownloadClient(Download download, Torrent torrent, String destinationPath, String? category)
|
||||
{
|
||||
private static Int64 _totalBytesDownloadedThisSession;
|
||||
private static readonly Lock TotalBytesDownloadedLock = new();
|
||||
|
||||
public IDownloader? Downloader;
|
||||
|
||||
public Data.Enums.DownloadClient Type { get; private set; }
|
||||
|
|
@ -18,6 +21,8 @@ public class DownloadClient(Download download, Torrent torrent, String destinati
|
|||
public Int64 BytesTotal { get; private set; }
|
||||
public Int64 BytesDone { get; private set; }
|
||||
|
||||
private Int64 LastBytesDone { get; set; }
|
||||
|
||||
public async Task<String> Start()
|
||||
{
|
||||
BytesDone = 0;
|
||||
|
|
@ -51,7 +56,7 @@ public class DownloadClient(Download download, Torrent torrent, String destinati
|
|||
Data.Enums.DownloadClient.Internal => new InternalDownloader(download.Link, filePath),
|
||||
Data.Enums.DownloadClient.Bezzad => new BezzadDownloader(download.Link, filePath),
|
||||
Data.Enums.DownloadClient.Aria2c => new Aria2cDownloader(download.RemoteId, download.Link, filePath, downloadPath, category),
|
||||
Data.Enums.DownloadClient.Symlink => new SymlinkDownloader(download.Link, filePath, downloadPath),
|
||||
Data.Enums.DownloadClient.Symlink => new SymlinkDownloader(download.Link, filePath, downloadPath, torrent.ClientKind),
|
||||
Data.Enums.DownloadClient.DownloadStation => await DownloadStationDownloader.Init(download.RemoteId, download.Link, filePath, downloadPath, category),
|
||||
_ => throw new($"Unknown download client {Type}")
|
||||
};
|
||||
|
|
@ -67,6 +72,12 @@ public class DownloadClient(Download download, Torrent torrent, String destinati
|
|||
Speed = args.Speed;
|
||||
BytesDone = args.BytesDone;
|
||||
BytesTotal = args.BytesTotal;
|
||||
|
||||
var bytesAdded = BytesDone - LastBytesDone;
|
||||
|
||||
LastBytesDone = BytesDone;
|
||||
|
||||
AddToTotalBytesDownloadedThisSession(bytesAdded);
|
||||
};
|
||||
|
||||
var result = await Downloader.Download();
|
||||
|
|
@ -115,4 +126,20 @@ public class DownloadClient(Download download, Torrent torrent, String destinati
|
|||
}
|
||||
await Downloader.Resume();
|
||||
}
|
||||
|
||||
public static Int64 GetTotalBytesDownloadedThisSession()
|
||||
{
|
||||
lock (TotalBytesDownloadedLock)
|
||||
{
|
||||
return _totalBytesDownloadedThisSession;
|
||||
}
|
||||
}
|
||||
|
||||
private static void AddToTotalBytesDownloadedThisSession(Int64 bytes)
|
||||
{
|
||||
lock (TotalBytesDownloadedLock)
|
||||
{
|
||||
_totalBytesDownloadedThisSession += bytes;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +1,10 @@
|
|||
using RdtClient.Service.Helpers;
|
||||
using RdtClient.Data.Models.Data;
|
||||
using RdtClient.Service.Helpers;
|
||||
using Serilog;
|
||||
|
||||
namespace RdtClient.Service.Services.Downloaders;
|
||||
|
||||
public class SymlinkDownloader(String uri, String destinationPath, String path) : IDownloader
|
||||
public class SymlinkDownloader(String uri, String destinationPath, String path, Torrent.TorrentClientKind? clientKind) : IDownloader
|
||||
{
|
||||
public event EventHandler<DownloadCompleteEventArgs>? DownloadComplete;
|
||||
public event EventHandler<DownloadProgressEventArgs>? DownloadProgress;
|
||||
|
|
@ -16,7 +17,7 @@ public class SymlinkDownloader(String uri, String destinationPath, String path)
|
|||
|
||||
public async Task<String> Download()
|
||||
{
|
||||
_logger.Debug($"Starting symlink resolving of {uri}, writing to path: {path}");
|
||||
_logger.Debug($"Starting symlink resolving of {path} (uri = {uri}), writing to path: {destinationPath}");
|
||||
|
||||
try
|
||||
{
|
||||
|
|
@ -56,83 +57,113 @@ public class SymlinkDownloader(String uri, String destinationPath, String path)
|
|||
BytesTotal = 0,
|
||||
Speed = 0
|
||||
});
|
||||
|
||||
var potentialFilePaths = new List<String>();
|
||||
|
||||
var directoryInfo = new DirectoryInfo(searchPath);
|
||||
while (directoryInfo.Parent != null)
|
||||
{
|
||||
potentialFilePaths.Add(directoryInfo.Name);
|
||||
directoryInfo = directoryInfo.Parent;
|
||||
|
||||
if (directoryInfo.FullName.TrimEnd(['\\', '/']) == rcloneMountPath)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
potentialFilePaths.Add(fileName);
|
||||
potentialFilePaths.Add(fileNameWithoutExtension);
|
||||
// add an empty path so we can check for the new file in the base directory
|
||||
potentialFilePaths.Add("");
|
||||
|
||||
potentialFilePaths = potentialFilePaths.Distinct().ToList();
|
||||
|
||||
|
||||
String? file = null;
|
||||
var shouldSearch = true;
|
||||
|
||||
for (var retryCount = 0; retryCount < MaxRetries; retryCount++)
|
||||
// When resolving symlinks for AllDebrid, we know the exact file path, so we can skip the search.
|
||||
if (clientKind == Torrent.TorrentClientKind.AllDebrid)
|
||||
{
|
||||
DownloadProgress?.Invoke(this,
|
||||
new()
|
||||
{
|
||||
BytesDone = retryCount,
|
||||
BytesTotal = 10,
|
||||
Speed = 1
|
||||
});
|
||||
|
||||
_logger.Debug($"Searching {rcloneMountPath} for {fileName} (attempt #{retryCount})...");
|
||||
|
||||
file = FindFile(rcloneMountPath, potentialFilePaths, fileName);
|
||||
|
||||
if (file == null && searchSubDirectories)
|
||||
var potentialFilePath = Path.Combine(rcloneMountPath, path);
|
||||
|
||||
// Make sure the file exists before making any assumptions.
|
||||
// If this somehow fails, fallback to the search below.
|
||||
if (File.Exists(potentialFilePath))
|
||||
{
|
||||
var subDirectories = Directory.GetDirectories(rcloneMountPath, "*.*", SearchOption.TopDirectoryOnly);
|
||||
|
||||
foreach (var subDirectory in subDirectories)
|
||||
{
|
||||
file = FindFile(Path.Combine(rcloneMountPath, subDirectory), potentialFilePaths, fileName);
|
||||
|
||||
if (file != null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (file == null)
|
||||
{
|
||||
await Task.Delay(1000 * retryCount);
|
||||
_logger.Debug($"Found file {path} at {potentialFilePath} using direct search");
|
||||
file = potentialFilePath;
|
||||
shouldSearch = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
// Log if the file wasn't found and continue searching.
|
||||
_logger.Warning($"Expected file {path} to be at {potentialFilePath} but it wasn't found. Continuing search (this will probably fail).");
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldSearch)
|
||||
{
|
||||
var potentialFilePaths = new List<String>
|
||||
{
|
||||
searchPath
|
||||
};
|
||||
|
||||
var directoryInfo = new DirectoryInfo(searchPath);
|
||||
|
||||
while (directoryInfo.Parent != null)
|
||||
{
|
||||
potentialFilePaths.Add(directoryInfo.Name);
|
||||
directoryInfo = directoryInfo.Parent;
|
||||
|
||||
if (directoryInfo.FullName.TrimEnd(['\\', '/']) == rcloneMountPath)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
potentialFilePaths.Add(fileName);
|
||||
potentialFilePaths.Add(fileNameWithoutExtension);
|
||||
|
||||
// add an empty path so we can check for the new file in the base directory
|
||||
potentialFilePaths.Add("");
|
||||
|
||||
potentialFilePaths = potentialFilePaths.Distinct().ToList();
|
||||
|
||||
for (var retryCount = 0; retryCount < MaxRetries; retryCount++)
|
||||
{
|
||||
DownloadProgress?.Invoke(this,
|
||||
new()
|
||||
{
|
||||
BytesDone = retryCount,
|
||||
BytesTotal = 10,
|
||||
Speed = 1
|
||||
});
|
||||
|
||||
_logger.Debug($"Searching {rcloneMountPath} for {fileName} (attempt #{retryCount})...");
|
||||
|
||||
file = FindFile(rcloneMountPath, potentialFilePaths, fileName);
|
||||
|
||||
if (file == null && searchSubDirectories)
|
||||
{
|
||||
var subDirectories = Directory.GetDirectories(rcloneMountPath, "*.*", SearchOption.TopDirectoryOnly);
|
||||
|
||||
foreach (var subDirectory in subDirectories)
|
||||
{
|
||||
file = FindFile(Path.Combine(rcloneMountPath, subDirectory), potentialFilePaths, fileName);
|
||||
|
||||
if (file != null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (file == null)
|
||||
{
|
||||
await Task.Delay(1000 * retryCount);
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (file == null)
|
||||
{
|
||||
_logger.Debug($"Unable to find file in rclone mount. Folders available in {rcloneMountPath}: ");
|
||||
|
||||
try
|
||||
{
|
||||
var allFolders = FileHelper.GetDirectoryContents(rcloneMountPath);
|
||||
|
||||
_logger.Debug(allFolders);
|
||||
}
|
||||
catch(Exception ex)
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex.Message);
|
||||
}
|
||||
|
||||
|
||||
throw new("Could not find file from rclone mount!");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -208,7 +208,14 @@ public class QBittorrent(ILogger<QBittorrent> logger, Settings settings, Authent
|
|||
var torrentPath = downloadPath;
|
||||
if (!String.IsNullOrWhiteSpace(torrent.RdName))
|
||||
{
|
||||
torrentPath = Path.Combine(downloadPath, torrent.RdName) + Path.DirectorySeparatorChar;
|
||||
// Alldebrid stores single file torrents at the root folder.
|
||||
if (torrent.ClientKind == Torrent.TorrentClientKind.AllDebrid && torrent.Files.Count == 1)
|
||||
{
|
||||
torrentPath = Path.Combine(downloadPath, torrent.Files[0].Path);
|
||||
} else
|
||||
{
|
||||
torrentPath = Path.Combine(downloadPath, torrent.RdName) + Path.DirectorySeparatorChar;
|
||||
}
|
||||
}
|
||||
|
||||
Int64 bytesDone = 0;
|
||||
|
|
@ -629,7 +636,7 @@ public class QBittorrent(ILogger<QBittorrent> logger, Settings settings, Authent
|
|||
|
||||
public async Task<SyncMetaData> SyncMainData()
|
||||
{
|
||||
var torrents = await TorrentInfo();
|
||||
var torrentInfo = await TorrentInfo();
|
||||
|
||||
var categories = await TorrentsCategories();
|
||||
|
||||
|
|
@ -642,7 +649,7 @@ public class QBittorrent(ILogger<QBittorrent> logger, Settings settings, Authent
|
|||
Rid = 0,
|
||||
Tags = null,
|
||||
Trackers = new Dictionary<String, List<String>>(),
|
||||
Torrents = torrents.ToDictionary(m => m.Hash, m => m),
|
||||
Torrents = torrentInfo.ToDictionary(m => m.Hash, m => m),
|
||||
ServerState = new()
|
||||
{
|
||||
DlInfoSpeed = activeDownloads,
|
||||
|
|
@ -650,4 +657,17 @@ public class QBittorrent(ILogger<QBittorrent> logger, Settings settings, Authent
|
|||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static TransferInfo TransferInfo()
|
||||
{
|
||||
var activeDownloads = TorrentRunner.ActiveDownloadClients.Sum(m => m.Value.Speed);
|
||||
|
||||
return new()
|
||||
{
|
||||
ConnectionStatus = "connected",
|
||||
DlInfoData = DownloadClient.GetTotalBytesDownloadedThisSession(),
|
||||
DlInfoSpeed = activeDownloads,
|
||||
DlRateLimit = Settings.Get.DownloadClient.MaxSpeed
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -174,6 +174,7 @@ public class AllDebridTorrentClient(ILogger<AllDebridTorrentClient> logger, IHtt
|
|||
torrent.RdFiles = JsonConvert.SerializeObject(torrentClientTorrent.Files);
|
||||
}
|
||||
|
||||
torrent.ClientKind = Torrent.TorrentClientKind.AllDebrid;
|
||||
torrent.RdHost = torrentClientTorrent.Host;
|
||||
torrent.RdSplit = torrentClientTorrent.Split;
|
||||
torrent.RdProgress = torrentClientTorrent.Progress;
|
||||
|
|
|
|||
|
|
@ -162,6 +162,7 @@ public class PremiumizeTorrentClient(ILogger<PremiumizeTorrentClient> logger, IH
|
|||
torrent.RdFiles = JsonConvert.SerializeObject(torrentClientTorrent.Files);
|
||||
}
|
||||
|
||||
torrent.ClientKind = Torrent.TorrentClientKind.Premiumize;
|
||||
torrent.RdHost = torrentClientTorrent.Host;
|
||||
torrent.RdSplit = torrentClientTorrent.Split;
|
||||
torrent.RdProgress = torrentClientTorrent.Progress;
|
||||
|
|
|
|||
|
|
@ -295,6 +295,7 @@ public class RealDebridTorrentClient(ILogger<RealDebridTorrentClient> logger, IH
|
|||
torrent.RdFiles = JsonConvert.SerializeObject(torrentClientTorrent.Files);
|
||||
}
|
||||
|
||||
torrent.ClientKind = Data.Models.Data.Torrent.TorrentClientKind.RealDebrid;
|
||||
torrent.RdHost = torrentClientTorrent.Host;
|
||||
torrent.RdSplit = torrentClientTorrent.Split;
|
||||
torrent.RdProgress = torrentClientTorrent.Progress;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ using TorBoxNET;
|
|||
using RdtClient.Data.Enums;
|
||||
using RdtClient.Data.Models.TorrentClient;
|
||||
using System.Web;
|
||||
using RdtClient.Data.Models.Data;
|
||||
|
||||
namespace RdtClient.Service.Services.TorrentClients;
|
||||
|
||||
|
|
@ -167,7 +168,7 @@ public class TorBoxTorrentClient(ILogger<TorBoxTorrentClient> logger, IHttpClien
|
|||
return [];
|
||||
}
|
||||
|
||||
public Task SelectFiles(Data.Models.Data.Torrent torrent)
|
||||
public Task SelectFiles(Torrent torrent)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
|
@ -194,7 +195,7 @@ public class TorBoxTorrentClient(ILogger<TorBoxTorrentClient> logger, IHttpClien
|
|||
return result.Data!;
|
||||
}
|
||||
|
||||
public async Task<Data.Models.Data.Torrent> UpdateData(Data.Models.Data.Torrent torrent, TorrentClientTorrent? torrentClientTorrent)
|
||||
public async Task<Torrent> UpdateData(Torrent torrent, TorrentClientTorrent? torrentClientTorrent)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -229,6 +230,7 @@ public class TorBoxTorrentClient(ILogger<TorBoxTorrentClient> logger, IHttpClien
|
|||
torrent.RdFiles = JsonConvert.SerializeObject(rdTorrent.Files);
|
||||
}
|
||||
|
||||
torrent.ClientKind = Torrent.TorrentClientKind.TorBox;
|
||||
torrent.RdHost = rdTorrent.Host;
|
||||
torrent.RdSplit = rdTorrent.Split;
|
||||
torrent.RdProgress = rdTorrent.Progress;
|
||||
|
|
@ -280,7 +282,7 @@ public class TorBoxTorrentClient(ILogger<TorBoxTorrentClient> logger, IHttpClien
|
|||
return torrent;
|
||||
}
|
||||
|
||||
public async Task<IList<String>?> GetDownloadLinks(Data.Models.Data.Torrent torrent)
|
||||
public async Task<IList<String>?> GetDownloadLinks(Torrent torrent)
|
||||
{
|
||||
var files = new List<String>();
|
||||
|
||||
|
|
|
|||
|
|
@ -322,21 +322,22 @@ public class QBittorrentController(ILogger<QBittorrentController> logger, QBitto
|
|||
|
||||
foreach (var url in urls)
|
||||
{
|
||||
try{
|
||||
if (url.StartsWith("magnet"))
|
||||
try
|
||||
{
|
||||
await qBittorrent.TorrentsAddMagnet(url.Trim(), request.Category, null);
|
||||
}
|
||||
else if (url.StartsWith("http"))
|
||||
{
|
||||
var httpClient = new HttpClient();
|
||||
var result = await httpClient.GetByteArrayAsync(url);
|
||||
await qBittorrent.TorrentsAddFile(result, request.Category, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
return BadRequest($"Invalid torrent link format {url}");
|
||||
}
|
||||
if (url.StartsWith("magnet"))
|
||||
{
|
||||
await qBittorrent.TorrentsAddMagnet(url.Trim(), request.Category, null);
|
||||
}
|
||||
else if (url.StartsWith("http"))
|
||||
{
|
||||
var httpClient = new HttpClient();
|
||||
var result = await httpClient.GetByteArrayAsync(url);
|
||||
await qBittorrent.TorrentsAddFile(result, request.Category, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
return BadRequest($"Invalid torrent link format {url}");
|
||||
}
|
||||
}
|
||||
catch (RDNET.RealDebridException ex)
|
||||
{
|
||||
|
|
@ -507,6 +508,22 @@ public class QBittorrentController(ILogger<QBittorrentController> logger, QBitto
|
|||
{
|
||||
return await SyncMainData();
|
||||
}
|
||||
|
||||
[Authorize(Policy = "AuthSetting")]
|
||||
[Route("transfer/info")]
|
||||
[HttpGet]
|
||||
public ActionResult TransferInfo()
|
||||
{
|
||||
return Ok(QBittorrent.TransferInfo());
|
||||
}
|
||||
|
||||
[Authorize(Policy = "AuthSetting")]
|
||||
[Route("transfer/info")]
|
||||
[HttpPost]
|
||||
public ActionResult TransferInfoPost()
|
||||
{
|
||||
return TransferInfo();
|
||||
}
|
||||
}
|
||||
|
||||
public class QBAuthLoginRequest
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<TargetFramework>net9.0</TargetFramework>
|
||||
<OutputType>Exe</OutputType>
|
||||
<UserSecretsId>94c24cba-f03f-4453-a671-3640b517c573</UserSecretsId>
|
||||
<Version>2.0.94</Version>
|
||||
<Version>2.0.95</Version>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<LangVersion>latest</LangVersion>
|
||||
|
|
@ -29,15 +29,15 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="9.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="9.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.0">
|
||||
<PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="9.0.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="9.0.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.1">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="9.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Identity.Core" Version="9.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="9.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Identity.Core" Version="9.0.1" />
|
||||
<PackageReference Include="Serilog" Version="4.2.0" />
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="9.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
|
||||
|
|
|
|||
Loading…
Reference in a new issue