From 2c4c8de8b5cd5014c8be4645f7a1571e7b96bfc6 Mon Sep 17 00:00:00 2001 From: Glax Date: Sun, 11 Feb 2024 00:39:21 +0100 Subject: [PATCH] Remove StyleSheet from TrangaSettings --- Tranga/Server.cs | 12 ------------ Tranga/TrangaSettings.cs | 15 --------------- 2 files changed, 27 deletions(-) diff --git a/Tranga/Server.cs b/Tranga/Server.cs index c12f1fa..92a9fb0 100644 --- a/Tranga/Server.cs +++ b/Tranga/Server.cs @@ -366,18 +366,6 @@ public class Server : GlobalBase settings.UpdateDownloadLocation(downloadLocation, moveFiles); SendResponse(HttpStatusCode.Accepted, response); break; - case "Settings/ChangeStyleSheet": - if (!requestVariables.TryGetValue("styleSheet", out string? styleSheet)) - { - SendResponse(HttpStatusCode.BadRequest, response); - break; - } - - if (settings.UpdateStyleSheet(styleSheet)) - SendResponse(HttpStatusCode.Accepted, response); - else - SendResponse(HttpStatusCode.BadRequest, response, "Invalid parameter for styleSheet"); - break; /*case "Settings/UpdateWorkingDirectory": if (!requestVariables.TryGetValue("workingDirectory", out string? workingDirectory)) { diff --git a/Tranga/TrangaSettings.cs b/Tranga/TrangaSettings.cs index 4058188..da474a5 100644 --- a/Tranga/TrangaSettings.cs +++ b/Tranga/TrangaSettings.cs @@ -13,7 +13,6 @@ public class TrangaSettings public string downloadLocation { get; private set; } public string workingDirectory { get; private set; } public int apiPortNumber { get; init; } - public string styleSheet { get; private set; } public string userAgent { get; set; } = DefaultUserAgent; [JsonIgnore] public string settingsFilePath => Path.Join(workingDirectory, "settings.json"); [JsonIgnore] public string libraryConnectorsFilePath => Path.Join(workingDirectory, "libraryConnectors.json"); @@ -46,7 +45,6 @@ public class TrangaSettings this.downloadLocation = downloadLocation ?? settings.downloadLocation; this.workingDirectory = workingDirectory ?? settings.workingDirectory; this.apiPortNumber = apiPortNumber ?? settings.apiPortNumber; - this.styleSheet = "default" ?? settings.styleSheet; lockFile.Close(); //unlock settingsfile } else if(!File.Exists(settingsFilePath)) @@ -56,7 +54,6 @@ public class TrangaSettings this.apiPortNumber = apiPortNumber ?? 6531; this.downloadLocation = downloadLocation ?? (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ? "/Manga" : Path.Join(Directory.GetCurrentDirectory(), "Downloads")); this.workingDirectory = workingDirectory ?? Path.Join(RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ? "/usr/share" : Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "tranga-api"); - this.styleSheet = "default"; ExportSettings(); } else @@ -64,7 +61,6 @@ public class TrangaSettings this.apiPortNumber = apiPortNumber!.Value; this.downloadLocation = downloadLocation!; this.workingDirectory = workingDirectory!; - this.styleSheet = "default"; } UpdateDownloadLocation(this.downloadLocation, false); } @@ -97,17 +93,6 @@ public class TrangaSettings })!; } - public bool UpdateStyleSheet(string newStyleSheet) - { - string[] validStyleSheets = { "default", "hover" }; - if (validStyleSheets.Contains(newStyleSheet)) - { - this.styleSheet = newStyleSheet; - return true; - } - return false; - } - public void UpdateDownloadLocation(string newPath, bool moveFiles = true) { if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))