diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/UserInterfaceConfiguration.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/UserInterfaceConfiguration.cs index 1680705..e854257 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/UserInterfaceConfiguration.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/UserInterfaceConfiguration.cs @@ -9,7 +9,10 @@ namespace ConfusedPolarBear.Plugin.IntroSkipper.Configuration; /// Skip button visibility. /// Skip button intro text. /// Skip button end credits text. -public class UserInterfaceConfiguration(bool visible, string introText, string creditsText) +/// Auto Skip Intro. +/// Auto Skip Credits. +/// Auto Skip Clients. +public class UserInterfaceConfiguration(bool visible, string introText, string creditsText, bool autoSkip, bool autoSkipCredits, string clientList) { /// /// Gets or sets a value indicating whether to show the skip intro button. @@ -25,4 +28,19 @@ public class UserInterfaceConfiguration(bool visible, string introText, string c /// Gets or sets the text to display in the skip intro button in end credits mode. /// public string SkipButtonEndCreditsText { get; set; } = creditsText; + + /// + /// Gets or sets a value indicating whether auto skip intro. + /// + public bool AutoSkip { get; set; } = autoSkip; + + /// + /// Gets or sets a value indicating whether auto skip credits. + /// + public bool AutoSkipCredits { get; set; } = autoSkipCredits; + + /// + /// Gets or sets a value indicating clients to auto skip for. + /// + public string ClientList { get; set; } = clientList; } diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/inject.js b/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/inject.js index 811d2ec..5111430 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/inject.js +++ b/ConfusedPolarBear.Plugin.IntroSkipper/Configuration/inject.js @@ -303,8 +303,18 @@ const introSkipper = { localStorage.setItem('introskipperOption', option); this.d(`Introskipper option selected and saved: ${option}`); }, - injectIntroSkipperOptions(actionSheet) { + isAutoSkipLocked(config) { + const isAutoSkip = config.AutoSkip && config.AutoSkipCredits; + const isAutoSkipClient = new Set(config.ClientList.split(',')).has(ApiClient.appName()); + return isAutoSkip || (config.SkipButtonVisible && isAutoSkipClient); + }, + async injectIntroSkipperOptions(actionSheet) { if (!this.skipButton) return; + const config = await this.secureFetch("Intros/UserInterfaceConfiguration"); + if (this.isAutoSkipLocked(config)) { + this.d("Auto skip enforced by server"); + return; + } const statsButton = actionSheet.querySelector('[data-id="stats"]'); if (!statsButton) return; const menuItem = this.createButton(statsButton, 'introskipperMenu', diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Controllers/SkipIntroController.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Controllers/SkipIntroController.cs index db3f726..03a5c20 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/Controllers/SkipIntroController.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/Controllers/SkipIntroController.cs @@ -221,6 +221,9 @@ public class SkipIntroController : ControllerBase return new UserInterfaceConfiguration( config.SkipButtonVisible, config.SkipButtonIntroText, - config.SkipButtonEndCreditsText); + config.SkipButtonEndCreditsText, + config.AutoSkip, + config.AutoSkipCredits, + config.ClientList); } }