From b0f353819bfe62d1d1f496f8e14d71fe4bfacc33 Mon Sep 17 00:00:00 2001 From: Glax Date: Thu, 18 Apr 2024 18:58:42 +0200 Subject: [PATCH 1/3] Legacy RateLimit --- Tranga/MangaConnectors/RequestType.cs | 2 +- Tranga/TrangaSettings.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Tranga/MangaConnectors/RequestType.cs b/Tranga/MangaConnectors/RequestType.cs index eb89b42..b4ead24 100644 --- a/Tranga/MangaConnectors/RequestType.cs +++ b/Tranga/MangaConnectors/RequestType.cs @@ -6,7 +6,7 @@ public enum RequestType : byte MangaDexFeed = 1, MangaImage = 2, MangaCover = 3, - MangaDexAuthor = 4, + MangaDexAuthor = 4, //Legacy MangaDexImage = 5, MangaInfo = 6 } \ No newline at end of file diff --git a/Tranga/TrangaSettings.cs b/Tranga/TrangaSettings.cs index 596ab36..0edfee4 100644 --- a/Tranga/TrangaSettings.cs +++ b/Tranga/TrangaSettings.cs @@ -28,7 +28,7 @@ public class TrangaSettings {RequestType.MangaDexImage, 40}, {RequestType.MangaImage, 60}, {RequestType.MangaCover, 250}, - {RequestType.MangaDexAuthor, 250}, + {RequestType.MangaDexAuthor, 250}, //Legacy {RequestType.Default, 60} }; From b1f72dcb8105b1233d5d88e4a6b0860d57cf8204 Mon Sep 17 00:00:00 2001 From: Glax Date: Thu, 18 Apr 2024 19:00:28 +0200 Subject: [PATCH 2/3] Legacy RateLimit remove --- Tranga/MangaConnectors/RequestType.cs | 1 - Tranga/TrangaSettings.cs | 1 - 2 files changed, 2 deletions(-) diff --git a/Tranga/MangaConnectors/RequestType.cs b/Tranga/MangaConnectors/RequestType.cs index b4ead24..47d4086 100644 --- a/Tranga/MangaConnectors/RequestType.cs +++ b/Tranga/MangaConnectors/RequestType.cs @@ -6,7 +6,6 @@ public enum RequestType : byte MangaDexFeed = 1, MangaImage = 2, MangaCover = 3, - MangaDexAuthor = 4, //Legacy MangaDexImage = 5, MangaInfo = 6 } \ No newline at end of file diff --git a/Tranga/TrangaSettings.cs b/Tranga/TrangaSettings.cs index 0edfee4..6eaa30c 100644 --- a/Tranga/TrangaSettings.cs +++ b/Tranga/TrangaSettings.cs @@ -28,7 +28,6 @@ public class TrangaSettings {RequestType.MangaDexImage, 40}, {RequestType.MangaImage, 60}, {RequestType.MangaCover, 250}, - {RequestType.MangaDexAuthor, 250}, //Legacy {RequestType.Default, 60} }; From df4d547e2b37fc1ff3cf0cd96ce5aa31be8191bc Mon Sep 17 00:00:00 2001 From: Glax Date: Thu, 18 Apr 2024 23:52:52 +0200 Subject: [PATCH 3/3] Fix crash with old settings files --- Tranga/TrangaSettings.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Tranga/TrangaSettings.cs b/Tranga/TrangaSettings.cs index 6eaa30c..2ad9492 100644 --- a/Tranga/TrangaSettings.cs +++ b/Tranga/TrangaSettings.cs @@ -1,4 +1,6 @@ using System.Runtime.InteropServices; +using System.Text.Json.Nodes; +using System.Text.RegularExpressions; using Newtonsoft.Json; using Tranga.LibraryConnectors; using Tranga.MangaConnectors; @@ -19,7 +21,7 @@ public class TrangaSettings [JsonIgnore] public string jobsFolderPath => Path.Join(workingDirectory, "jobs"); [JsonIgnore] public string coverImageCache => Path.Join(workingDirectory, "imageCache"); [JsonIgnore] internal static readonly string DefaultUserAgent = $"Tranga ({Enum.GetName(Environment.OSVersion.Platform)}; {(Environment.Is64BitOperatingSystem ? "x64" : "")}) / 1.0"; - public ushort? version { get; } = 1; + public ushort? version { get; } = 2; public bool aprilFoolsMode { get; private set; } = true; [JsonIgnore]internal static readonly Dictionary DefaultRequestLimits = new () { @@ -43,6 +45,7 @@ public class TrangaSettings {//Load from settings file FileStream lockFile = File.Create(lockFilePath,0, FileOptions.DeleteOnClose); //lock settingsfile string settingsStr = File.ReadAllText(sfp); + settingsStr = Regex.Replace(settingsStr, @"""MangaDexAuthor"": [0-9]+,", "");//https://github.com/C9Glax/tranga/pull/161 Remove sometime in the future :3 TrangaSettings settings = JsonConvert.DeserializeObject(settingsStr)!; this.requestLimits = settings.requestLimits; this.userAgent = settings.userAgent;