feat: add enable/disable toggle for the plugin and update configuration handling

This commit is contained in:
CodeDevMLH
2025-12-28 18:53:25 +01:00
parent fbd77e56fd
commit 737e510a6c
5 changed files with 118 additions and 12 deletions

View File

@@ -12,6 +12,7 @@ public class PluginConfiguration : BasePluginConfiguration
/// </summary>
public PluginConfiguration()
{
IsEnabled = true;
SelectedSeason = "none";
AutomateSeasonSelection = true;
@@ -27,6 +28,11 @@ public class PluginConfiguration : BasePluginConfiguration
Easter = new EasterOptions();
}
/// <summary>
/// Gets or sets a value indicating whether the plugin is enabled.
/// </summary>
public bool IsEnabled { get; set; }
/// <summary>
/// Gets or sets the selected season.
/// </summary>

View File

@@ -24,6 +24,13 @@
<hr style="max-width: 800px; margin: 1em 0;">
<br>
<form id="SeasonalsConfigForm">
<div class="checkboxContainer checkboxContainer-withDescription">
<label class="emby-checkbox-label">
<input id="IsEnabled" name="IsEnabled" type="checkbox" is="emby-checkbox" />
<span>Enable Seasonals</span>
</label>
<div class="fieldDescription">Enable or disable the entire plugin functionality.</div>
</div>
<div class="checkboxContainer checkboxContainer-withDescription">
<label class="emby-checkbox-label">
<input id="AutomateSeasonSelection" name="AutomateSeasonSelection" type="checkbox" is="emby-checkbox" />
@@ -520,6 +527,7 @@
.addEventListener('pageshow', function() {
Dashboard.showLoadingMsg();
ApiClient.getPluginConfiguration(SeasonalsConfig.pluginUniqueId).then(function (config) {
document.querySelector('#IsEnabled').checked = config.IsEnabled;
document.querySelector('#SelectedSeason').value = config.SelectedSeason;
document.querySelector('#AutomateSeasonSelection').checked = config.AutomateSeasonSelection;
@@ -615,6 +623,7 @@
.addEventListener('submit', function(e) {
Dashboard.showLoadingMsg();
ApiClient.getPluginConfiguration(SeasonalsConfig.pluginUniqueId).then(function (config) {
config.IsEnabled = document.querySelector('#IsEnabled').checked;
config.SelectedSeason = document.querySelector('#SelectedSeason').value;
config.AutomateSeasonSelection = document.querySelector('#AutomateSeasonSelection').checked;