Refactor of plugin structure to make more sense compared to the default template

This commit is contained in:
2026-02-16 14:08:15 -07:00
parent 61e868bfa2
commit a720bba7a7
12 changed files with 110 additions and 185 deletions

View File

@@ -0,0 +1,40 @@
var MediaCleanerConfig = {
pluginUniqueId: 'fef007a8-3e8f-4aa8-a22e-486a387f4192'
};
document.querySelector('#MediaCleanerConfigPage')
.addEventListener('pageshow', function() {
Dashboard.showLoadingMsg();
ApiClient.getPluginConfiguration(MediaCleanerConfig.pluginUniqueId).then(function (config) {
document.querySelector('#RadarrHTTPAddress').value = config.RadarrHTTPAddress;
document.querySelector('#RadarrPort').value = config.RadarrPort;
document.querySelector('#RadarrAPIKey').value = config.RadarrAPIKey;
document.querySelector('#SonarrHTTPAddress').value = config.SonarrHTTPAddress;
document.querySelector('#SonarrPort').value = config.SonarrPort;
document.querySelector('#SonarrAPIKey').value = config.SonarrAPIKey;
document.querySelector('#StaleMediaCutoff').value = config.StaleMediaCutoff;
document.querySelector('#DebugMode').checked = config.DebugMode;
Dashboard.hideLoadingMsg();
});
});
document.querySelector('#MediaCleanerConfigForm')
.addEventListener('submit', function(e) {
Dashboard.showLoadingMsg();
ApiClient.getPluginConfiguration(MediaCleanerConfig.pluginUniqueId).then(function (config) {
config.RadarrHTTPAddress = document.querySelector('#RadarrHTTPAddress').value;
config.RadarrPort = document.querySelector('#RadarrPort').value;
config.RadarrAPIKey = document.querySelector('#RadarrAPIKey').value;
config.SonarrHTTPAddress = document.querySelector('#SonarrHTTPAddress').value;
config.SonarrPort = document.querySelector('#SonarrPort').value;
config.SonarrAPIKey = document.querySelector('#SonarrAPIKey').value;
config.StaleMediaCutoff = document.querySelector('#StaleMediaCutoff').value;
config.DebugMode = document.querySelector('#DebugMode').checked;
ApiClient.updatePluginConfiguration(MediaCleanerConfig.pluginUniqueId, config).then(function (result) {
Dashboard.processPluginConfigurationUpdateResult(result);
});
});
e.preventDefault();
return false;
});