diff --git a/CHANGELOG.md b/CHANGELOG.md index 0fe2495..186bad7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ 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.3] - 2022-01-02 +### Changed +- Fixed automatic adding of AllDebrid torrents. +### Added +- Added update notification. + ## [2.0.2] - 2021-11-24 ### Changed - Fixed update timer for providers. diff --git a/client/src/app/navbar/navbar.component.html b/client/src/app/navbar/navbar.component.html index ad6d854..042fa46 100644 --- a/client/src/app/navbar/navbar.component.html +++ b/client/src/app/navbar/navbar.component.html @@ -55,13 +55,13 @@ Profile Logout - + -
+
Version {{ profile.latestVersion }} of RealDebrid Client was found. You are currently on version {{ profile.currentVersion }}.
diff --git a/package.json b/package.json index 3a8ba8b..b263b85 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rdt-client", - "version": "2.0.2", + "version": "2.0.3", "description": "This is a web interface to manage your torrents on Real-Debrid.", "main": "index.js", "dependencies": { diff --git a/server/RdtClient.Service/RdtClient.Service.csproj b/server/RdtClient.Service/RdtClient.Service.csproj index f05b2ed..d5129a9 100644 --- a/server/RdtClient.Service/RdtClient.Service.csproj +++ b/server/RdtClient.Service/RdtClient.Service.csproj @@ -6,9 +6,9 @@ - + - + diff --git a/server/RdtClient.Service/Services/TorrentClients/AllDebridTorrentClient.cs b/server/RdtClient.Service/Services/TorrentClients/AllDebridTorrentClient.cs index 6abfd73..aef27b9 100644 --- a/server/RdtClient.Service/Services/TorrentClients/AllDebridTorrentClient.cs +++ b/server/RdtClient.Service/Services/TorrentClients/AllDebridTorrentClient.cs @@ -6,10 +6,12 @@ using System.Threading.Tasks; using AllDebridNET; using Microsoft.Extensions.Logging; using Newtonsoft.Json; +using RDNET; +using RDNET.Exceptions; using RdtClient.Data.Enums; -using RdtClient.Data.Models.Data; using RdtClient.Data.Models.TorrentClient; using RdtClient.Service.Helpers; +using Torrent = RdtClient.Data.Models.Data.Torrent; namespace RdtClient.Service.Services.TorrentClients { @@ -192,9 +194,20 @@ namespace RdtClient.Service.Services.TorrentClients _ => TorrentStatus.Error }; } - catch (Exception ex) + catch (AllDebridException ex) { - if (ex.Message == "Resource not found") + if (ex.ErrorCode == "MAGNET_INVALID_ID") + { + torrent.RdStatusRaw = "deleted"; + } + else + { + throw; + } + } + catch (RealDebridException ex) + { + if (ex.ErrorCode == 7) { torrent.RdStatusRaw = "deleted"; } diff --git a/server/RdtClient.Service/Services/Torrents.cs b/server/RdtClient.Service/Services/Torrents.cs index 5b22a90..f2341c3 100644 --- a/server/RdtClient.Service/Services/Torrents.cs +++ b/server/RdtClient.Service/Services/Torrents.cs @@ -370,14 +370,14 @@ namespace RdtClient.Service.Services RdId = rdTorrent.Id }; - await _torrentClient.UpdateData(newTorrent, rdTorrent); - if (newTorrent.RdStatus == TorrentStatus.WaitingForFileSelection) { continue; } - await _torrentData.Add(rdTorrent.Id, rdTorrent.Hash, null, false, newTorrent); + torrent = await _torrentData.Add(rdTorrent.Id, rdTorrent.Hash, null, false, newTorrent); + + await UpdateTorrentClientData(torrent, rdTorrent); } else { @@ -624,23 +624,30 @@ namespace RdtClient.Service.Services private async Task UpdateTorrentClientData(Torrent torrent, TorrentClientTorrent torrentClientTorrent = null) { - var originalTorrent = JsonSerializer.Serialize(torrent, - new JsonSerializerOptions - { - ReferenceHandler = ReferenceHandler.IgnoreCycles - }); - - await _torrentClient.UpdateData(torrent, torrentClientTorrent); - - var newTorrent = JsonSerializer.Serialize(torrent, - new JsonSerializerOptions - { - ReferenceHandler = ReferenceHandler.IgnoreCycles - }); - - if (originalTorrent != newTorrent) + try { - await _torrentData.UpdateRdData(torrent); + var originalTorrent = JsonSerializer.Serialize(torrent, + new JsonSerializerOptions + { + ReferenceHandler = ReferenceHandler.IgnoreCycles + }); + + await _torrentClient.UpdateData(torrent, torrentClientTorrent); + + var newTorrent = JsonSerializer.Serialize(torrent, + new JsonSerializerOptions + { + ReferenceHandler = ReferenceHandler.IgnoreCycles + }); + + if (originalTorrent != newTorrent) + { + await _torrentData.UpdateRdData(torrent); + } + } + catch (Exception ex) + { + // ignored } } diff --git a/server/RdtClient.Web/RdtClient.Web.csproj b/server/RdtClient.Web/RdtClient.Web.csproj index b5d1d4f..f41ce7c 100644 --- a/server/RdtClient.Web/RdtClient.Web.csproj +++ b/server/RdtClient.Web/RdtClient.Web.csproj @@ -4,7 +4,7 @@ net6.0 Exe 94c24cba-f03f-4453-a671-3640b517c573 - 2.0.2 + 2.0.3