From 8774243d2fa3202ffb54d4716d07a892b48200a6 Mon Sep 17 00:00:00 2001 From: Roger Far Date: Sat, 30 Oct 2021 18:48:32 -0600 Subject: [PATCH] Add AllDebrid support. --- CHANGELOG.md | 4 + README.md | 12 +- .../add-new-torrent.component.html | 58 +++--- .../add-new-torrent.component.ts | 13 +- client/src/app/models/profile.model.ts | 1 + client/src/app/navbar/navbar.component.html | 4 +- client/src/app/navbar/navbar.component.ts | 10 + .../src/app/settings/settings.component.html | 35 +++- client/src/app/settings/settings.component.ts | 6 + client/src/app/setup/setup.component.html | 47 +++-- client/src/app/setup/setup.component.ts | 13 +- client/src/app/torrent.service.ts | 2 +- client/src/app/users.service.ts | 10 - package.json | 2 +- server/RdtClient.Data/Data/DataContext.cs | 6 + server/RdtClient.Data/Data/SettingData.cs | 1 + server/RdtClient.Data/Enums/TorrentStatus.cs | 2 +- server/RdtClient.Data/Models/Data/Torrent.cs | 2 +- .../Models/Internal/DbSettings.cs | 1 + .../RdtClient.Data/Models/Internal/Profile.cs | 1 + .../TorrentClient/TorrentClientTorrent.cs | 1 + .../Models/TorrentClient/TorrentClientUser.cs | 2 +- server/RdtClient.Service/DiConfig.cs | 1 + .../RdtClient.Service.csproj | 2 +- .../RdtClient.Service/Services/QBittorrent.cs | 2 +- .../TorrentClients/AllDebridTorrentClient.cs | 169 ++++++++++++++++- .../Services/TorrentClients/ITorrentClient.cs | 7 +- .../TorrentClients/RealDebridTorrentClient.cs | 172 +++++++++++++++++- .../Services/TorrentRunner.cs | 63 +------ server/RdtClient.Service/Services/Torrents.cs | 106 +++-------- .../Controllers/TorrentsController.cs | 19 ++ server/RdtClient.Web/RdtClient.Web.csproj | 2 +- 32 files changed, 548 insertions(+), 228 deletions(-) delete mode 100644 client/src/app/users.service.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a32327..7582f96 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ 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). +## [1.9.7] - 2021-10-30 +### Added +- Add AllDebrid support. + ## [1.9.6] - 2021-10-30 ### Added - Improved handling of errors on the torrent itself diff --git a/README.md b/README.md index 59b00ab..cc131ca 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,20 @@ # Real-Debrid Torrent Client -This is a web interface to manage your torrents on Real-Debrid. It supports the following features: +This is a web interface to manage your torrents on Real-Debrid or AllDebrid. It supports the following features: - Add new torrents through magnets or files -- Download all files from Real Debrid to your local machine automatically +- Download all files from Real Debrid or AllDebrid to your local machine automatically - Unpack all files when finished downloading - Implements a fake qBittorrent API so you can hook up other applications like Sonarr or Couchpotato. - Built with Angular 11 and .NET 5 -**You will need a Premium service at Real-Debrid!** +**You will need a Premium service at Real-Debrid or AllDebrid!** -[Click here to sign up (referal link so I can get a few free premium days).](https://real-debrid.com/?id=1348683) +[Click here to sign up at Real-Debrid.](https://real-debrid.com/?id=1348683) + +[Click here to sign up AllDebrid.](https://real-debrid.com/?id=1348683) + +(referal links so I can get a few free premium days) ## Docker Setup diff --git a/client/src/app/add-new-torrent/add-new-torrent.component.html b/client/src/app/add-new-torrent/add-new-torrent.component.html index 83fc19c..326378a 100644 --- a/client/src/app/add-new-torrent/add-new-torrent.component.html +++ b/client/src/app/add-new-torrent/add-new-torrent.component.html @@ -39,12 +39,29 @@
- + + +
+

+ This option is only available for RealDebrid. AllDebrid will always download the full torrent. +

+
+ +
+ This torrent is available for immediate download. +
+ +
+ This torrent is not available for immediate download.
@@ -59,6 +76,10 @@
+

+ When downloading with AllDebrid it cannot be guaranteed that only files above this limit will be download as + some files are grouped together in 1 large archive. +

This setting does not apply to manually selected files.

@@ -93,28 +114,14 @@
- +

When a single download fails it will retry it this many times before marking it as failed.

- +

When a single download has failed multiple times (see setting above) or when the torrent itself received an @@ -122,12 +129,12 @@

-
+

These files are available for immediate download from Real-Debrid.
- It is possible that there are more files in the torrent, which are not shown here. + It is possible that there are more files in the torrent, which are not shown here.

@@ -136,7 +143,7 @@ Select all
-
+
-
+
diff --git a/client/src/app/add-new-torrent/add-new-torrent.component.ts b/client/src/app/add-new-torrent/add-new-torrent.component.ts index d3b9681..e9daf86 100644 --- a/client/src/app/add-new-torrent/add-new-torrent.component.ts +++ b/client/src/app/add-new-torrent/add-new-torrent.component.ts @@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core'; import { Router } from '@angular/router'; import { TorrentService } from 'src/app/torrent.service'; import { Torrent, TorrentFileAvailability } from '../models/torrent.model'; +import { SettingsService } from '../settings.service'; @Component({ selector: 'app-add-new-torrent', @@ -13,6 +14,8 @@ export class AddNewTorrentComponent implements OnInit { public magnetLink: string; private currentTorrentFile: string; + public provider: string; + public category: string; public priority: number; @@ -24,7 +27,7 @@ export class AddNewTorrentComponent implements OnInit { public downloadRetryAttempts: number = 3; public torrentRetryAttempts: number = 1; - public availableFiles: TorrentFileAvailability[] = []; + public availableFiles: TorrentFileAvailability[]; public downloadFiles: { [key: string]: boolean } = {}; public allSelected: boolean; @@ -33,7 +36,11 @@ export class AddNewTorrentComponent implements OnInit { private selectedFile: File; - constructor(private router: Router, private torrentService: TorrentService) {} + constructor(private router: Router, private torrentService: TorrentService, private settingsService: SettingsService) { + this.settingsService.get().subscribe(settings => { + this.provider = settings.firstOrDefault(m => m.settingId === 'Provider')?.value; + }); + } ngOnInit(): void {} @@ -143,7 +150,7 @@ export class AddNewTorrentComponent implements OnInit { this.saving = true; this.error = null; - this.availableFiles = []; + this.availableFiles = null; this.downloadFiles = {}; this.allSelected = true; diff --git a/client/src/app/models/profile.model.ts b/client/src/app/models/profile.model.ts index d84b49b..a3a090d 100644 --- a/client/src/app/models/profile.model.ts +++ b/client/src/app/models/profile.model.ts @@ -1,4 +1,5 @@ export class Profile { + public provider: string; public userName: string; public expiration: Date; } diff --git a/client/src/app/navbar/navbar.component.html b/client/src/app/navbar/navbar.component.html index 163c44e..26e71b2 100644 --- a/client/src/app/navbar/navbar.component.html +++ b/client/src/app/navbar/navbar.component.html @@ -38,7 +38,7 @@ Settings - + @@ -55,7 +55,7 @@ Profile Logout - +
diff --git a/client/src/app/navbar/navbar.component.ts b/client/src/app/navbar/navbar.component.ts index 0aa7162..7f62035 100644 --- a/client/src/app/navbar/navbar.component.ts +++ b/client/src/app/navbar/navbar.component.ts @@ -13,12 +13,22 @@ export class NavbarComponent implements OnInit { public showMobileMenu = false; public profile: Profile; + public providerLink: string; constructor(private settingsService: SettingsService, private authService: AuthService, private router: Router) {} ngOnInit(): void { this.settingsService.getProfile().subscribe((result) => { this.profile = result; + + switch (result.provider) { + case 'RealDebrid': + this.providerLink = 'https://real-debrid.com/?id=1348683'; + break; + case 'AllDebrid': + this.providerLink = 'https://alldebrid.com/?uid=2v91l&lang=en'; + break; + } }); } diff --git a/client/src/app/settings/settings.component.html b/client/src/app/settings/settings.component.html index 00f612e..3c70271 100644 --- a/client/src/app/settings/settings.component.html +++ b/client/src/app/settings/settings.component.html @@ -3,6 +3,9 @@
  • General
  • +
  • + Provider +
  • Download Client
  • @@ -15,8 +18,26 @@
    -
    +
    + +
    + +
    +

    + The following 2 providers are supported: +
    + https://real-debrid.com +
    + https://alldebrid.com +
    + At this point only 1 provider can be used at the time. +

    +
    +
    @@ -26,7 +47,19 @@ https://real-debrid.com/apitoken.

    +
    + +
    + +
    +

    + You can find your API key here: + https://alldebrid.com/apikeys/. +

    +
    +
    +
    diff --git a/client/src/app/settings/settings.component.ts b/client/src/app/settings/settings.component.ts index f01851a..28887bf 100644 --- a/client/src/app/settings/settings.component.ts +++ b/client/src/app/settings/settings.component.ts @@ -26,6 +26,7 @@ export class SettingsComponent implements OnInit { public testAria2cConnectionSuccess: string = null; public settingLogLevel: string; + public settingProvider: string; public settingRealDebridApiKey: string; public settingDownloadPath: string; public settingMappedPath: string; @@ -57,6 +58,7 @@ export class SettingsComponent implements OnInit { this.settingsService.get().subscribe( (results) => { + this.settingProvider = this.getSetting(results, 'Provider'); this.settingRealDebridApiKey = this.getSetting(results, 'RealDebridApiKey'); this.settingLogLevel = this.getSetting(results, 'LogLevel'); this.settingDownloadPath = this.getSetting(results, 'DownloadPath'); @@ -86,6 +88,10 @@ export class SettingsComponent implements OnInit { this.saving = true; const settings: Setting[] = [ + { + settingId: 'Provider', + value: this.settingProvider, + }, { settingId: 'RealDebridApiKey', value: this.settingRealDebridApiKey, diff --git a/client/src/app/setup/setup.component.html b/client/src/app/setup/setup.component.html index cbe8fac..48d53bc 100644 --- a/client/src/app/setup/setup.component.html +++ b/client/src/app/setup/setup.component.html @@ -28,11 +28,7 @@
    -
    @@ -46,25 +42,46 @@
    To be able to use the Real-Debrid Client you need a premium subscription to download torrents.

    - Not premium yet? + Not premium yet? You have the choice of 2 providers: +
    Use this link to sign up to Real-Debrid. -

    - To connect to Real-Debrid please enter your Personal Prive API Token found here: - https://real-debrid.com/apitoken. +
    + Use this link to sign up to AllDebrid. +
    + (Referal links) +
    +
    + +
    + +
    -
    +
    - - -
    +

    + You can find your API key here: + https://real-debrid.com/apitoken. +

    +

    + You can find your API key here: + https://alldebrid.com/apikeys/. +

    +