mirror of
https://github.com/ranaldsgift/KefinTweaks.git
synced 2026-11-05 15:52:47 +01:00
Fix configuration logic related to saving JS Injector, and added Thumbnail Scrubber configuration
This commit is contained in:
1 parent
62de725cea
commit
17a44e3daf
2 files changed
+13
-27
No files matched your search
+12
-27
@@ -1178,7 +1178,7 @@
|
|||||||
// Build script toggle switches
|
// Build script toggle switches
|
||||||
function buildScriptToggles(scripts) {
|
function buildScriptToggles(scripts) {
|
||||||
// Features that have configuration options (not just toggles)
|
// Features that have configuration options (not just toggles)
|
||||||
const featuresWithConfig = new Set(['homeScreen', 'search', 'flattenSingleSeasonShows', 'skinManager', 'customMenuLinks', 'seriesInfo']);
|
const featuresWithConfig = new Set(['homeScreen', 'search', 'flattenSingleSeasonShows', 'skinManager', 'customMenuLinks', 'seriesInfo', 'thumbnailScrubber']);
|
||||||
|
|
||||||
const scriptNames = [
|
const scriptNames = [
|
||||||
{ key: 'watchlist', label: 'Watchlist', desc: 'Allows your users to add items to their Watchlist. The Watchlist page shows an overview of all items on a user\'s Watchlist, as well as their Series Progress and Movie History. It also includes a Statistics page with an overview of your user watched stats.' },
|
{ key: 'watchlist', label: 'Watchlist', desc: 'Allows your users to add items to their Watchlist. The Watchlist page shows an overview of all items on a user\'s Watchlist, as well as their Series Progress and Movie History. It also includes a Statistics page with an overview of your user watched stats.' },
|
||||||
@@ -2550,7 +2550,7 @@
|
|||||||
config.enabled = isEnabled;
|
config.enabled = isEnabled;
|
||||||
|
|
||||||
// Save the updated config to the injector
|
// Save the updated config to the injector
|
||||||
await saveConfigToJavaScriptInjector(config);
|
await KefinTweaksUtils.saveConfigToJavaScriptInjector(config);
|
||||||
|
|
||||||
window.KefinTweaksConfigEnabled = isEnabled;
|
window.KefinTweaksConfigEnabled = isEnabled;
|
||||||
console.log('[KefinTweaks Configuration] KefinTweaks', isEnabled ? 'enabled' : 'disabled');
|
console.log('[KefinTweaks Configuration] KefinTweaks', isEnabled ? 'enabled' : 'disabled');
|
||||||
@@ -2669,7 +2669,7 @@
|
|||||||
const importBtn = e.target.closest('.import-custom-sections-btn');
|
const importBtn = e.target.closest('.import-custom-sections-btn');
|
||||||
if (importBtn) {
|
if (importBtn) {
|
||||||
showImportDialog(config, async (newConfig) => {
|
showImportDialog(config, async (newConfig) => {
|
||||||
await saveConfigToJavaScriptInjector(newConfig);
|
await KefinTweaksUtils.saveConfigToJavaScriptInjector(newConfig);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -2679,7 +2679,7 @@
|
|||||||
const importBtn = e.target.closest('.import-community-sections-btn');
|
const importBtn = e.target.closest('.import-community-sections-btn');
|
||||||
if (importBtn) {
|
if (importBtn) {
|
||||||
showCommunityImportDialog(config, async (newConfig) => {
|
showCommunityImportDialog(config, async (newConfig) => {
|
||||||
await saveConfigToJavaScriptInjector(newConfig);
|
await KefinTweaksUtils.saveConfigToJavaScriptInjector(newConfig);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -3790,12 +3790,10 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hide suggestions when clicking outside
|
// Hide suggestions when focus leaves the input
|
||||||
document.addEventListener('click', (e) => {
|
input.addEventListener('blur', () => {
|
||||||
if (!badgeContainer.contains(e.target) && !suggestionsDiv.contains(e.target)) {
|
suggestionsDiv.style.display = 'none';
|
||||||
suggestionsDiv.style.display = 'none';
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5082,7 +5080,7 @@
|
|||||||
// Apply imported configuration
|
// Apply imported configuration
|
||||||
async function applyImportedConfig(importedConfig, modalInstance) {
|
async function applyImportedConfig(importedConfig, modalInstance) {
|
||||||
// Save to JavaScript Injector
|
// Save to JavaScript Injector
|
||||||
await saveConfigToJavaScriptInjector(importedConfig);
|
await KefinTweaksUtils.saveConfigToJavaScriptInjector(importedConfig);
|
||||||
|
|
||||||
// Reload the modal with new config
|
// Reload the modal with new config
|
||||||
modalInstance.close();
|
modalInstance.close();
|
||||||
@@ -5105,20 +5103,7 @@
|
|||||||
throw new Error('ApiClient not available');
|
throw new Error('ApiClient not available');
|
||||||
}
|
}
|
||||||
|
|
||||||
const server = ApiClient._serverAddress;
|
const plugins = await aoiHelper.getPlugins();
|
||||||
const token = ApiClient.accessToken();
|
|
||||||
|
|
||||||
const response = await fetch(`${server}/Plugins`, {
|
|
||||||
headers: {
|
|
||||||
'X-Emby-Token': token
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!response.ok) {
|
|
||||||
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
const plugins = await response.json();
|
|
||||||
console.log('[KefinTweaks Configuration] Active Plugins:', plugins);
|
console.log('[KefinTweaks Configuration] Active Plugins:', plugins);
|
||||||
|
|
||||||
// Handle both array and object with Items property
|
// Handle both array and object with Items property
|
||||||
@@ -5486,7 +5471,7 @@ window.KefinTweaksConfig = ${JSON.stringify(config, null, 2)};`;
|
|||||||
|
|
||||||
// Save to JavaScript Injector plugin
|
// Save to JavaScript Injector plugin
|
||||||
try {
|
try {
|
||||||
await saveConfigToJavaScriptInjector(config);
|
await KefinTweaksUtils.saveConfigToJavaScriptInjector(config);
|
||||||
|
|
||||||
// Update global config objects so dropdown changes reflect saved values
|
// Update global config objects so dropdown changes reflect saved values
|
||||||
window.KefinTweaksConfig = config;
|
window.KefinTweaksConfig = config;
|
||||||
@@ -5530,7 +5515,7 @@ window.KefinTweaksConfig = ${JSON.stringify(config, null, 2)};`;
|
|||||||
defaultConfig.kefinTweaksRoot = existingConfig.kefinTweaksRoot;
|
defaultConfig.kefinTweaksRoot = existingConfig.kefinTweaksRoot;
|
||||||
// Note: scriptRoot is no longer used - scripts are loaded from kefinTweaksRoot + '/scripts/'
|
// Note: scriptRoot is no longer used - scripts are loaded from kefinTweaksRoot + '/scripts/'
|
||||||
|
|
||||||
await saveConfigToJavaScriptInjector(defaultConfig);
|
await KefinTweaksUtils.saveConfigToJavaScriptInjector(defaultConfig);
|
||||||
|
|
||||||
if (window.KefinTweaksToaster && window.KefinTweaksToaster.toast) {
|
if (window.KefinTweaksToaster && window.KefinTweaksToaster.toast) {
|
||||||
window.KefinTweaksToaster.toast('Configuration reset to defaults.');
|
window.KefinTweaksToaster.toast('Configuration reset to defaults.');
|
||||||
|
|||||||
@@ -447,6 +447,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
const pluginId = plugin.Id;
|
const pluginId = plugin.Id;
|
||||||
|
const server = ApiClient._serverAddress;
|
||||||
|
|
||||||
// Get current injector config
|
// Get current injector config
|
||||||
const configUrl = `${server}/Plugins/${pluginId}/Configuration`;
|
const configUrl = `${server}/Plugins/${pluginId}/Configuration`;
|
||||||
|
|||||||
Reference in new issue
Block a user