From a89e61b919f64ffa823fea289a3b5dfc30015755 Mon Sep 17 00:00:00 2001 From: Kilian von Pflugk Date: Sun, 24 Nov 2024 15:30:42 +0100 Subject: [PATCH] try catch InjectSkipButton --- IntroSkipper/Helper/LegacyMigrations.cs | 60 ++++++++++++++----------- 1 file changed, 34 insertions(+), 26 deletions(-) diff --git a/IntroSkipper/Helper/LegacyMigrations.cs b/IntroSkipper/Helper/LegacyMigrations.cs index 4fb6180..7007c79 100644 --- a/IntroSkipper/Helper/LegacyMigrations.cs +++ b/IntroSkipper/Helper/LegacyMigrations.cs @@ -63,7 +63,7 @@ internal static class LegacyMigrations catch (Exception ex) { // Handle exceptions, such as file not found, deserialization errors, etc. - logger.LogWarning("Something stupid happened: {Exception}", ex); + logger.LogWarning("Failed to migrate from the ConfusedPolarBear Config {Exception}", ex); } } } @@ -111,44 +111,52 @@ internal static class LegacyMigrations string pattern; string indexPath = Path.Join(webPath, "index.html"); - if (File.Exists(indexPath)) + try { - logger.LogDebug("Reading index.html from {Path}", indexPath); - string contents = File.ReadAllText(indexPath); - - if (!plugin.Configuration.SkipButtonEnabled) + if (File.Exists(indexPath)) { - pattern = @""; + + if (contents.Contains(scriptTag, StringComparison.OrdinalIgnoreCase)) + { + logger.LogInformation("The skip button has already been injected."); + return; + } + + pattern = @""; - - if (contents.Contains(scriptTag, StringComparison.OrdinalIgnoreCase)) + else { - logger.LogInformation("The skip button has already been injected."); - return; + logger.LogInformation("Jellyfin running as nowebclient"); } - - pattern = @"