mirror of
https://github.com/MrSleeps/jellyfin-scene-search.git
synced 2026-11-19 00:03:36 +00:00
Apply authoritative library selection when plugin settings save
This commit is contained in:
@@ -460,7 +460,15 @@
|
||||
|
||||
page.querySelector('.sceneSearchConfigForm').addEventListener('submit', function (event) {
|
||||
event.preventDefault();
|
||||
var ids = selectedLibraryIds();
|
||||
if (!ids.length && !window.confirm(
|
||||
'No libraries are selected. Saving will remove all Jellyfin-backed Scene Search data from SQLite and Meilisearch. Continue?'
|
||||
)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
var updateResult = null;
|
||||
|
||||
ApiClient.getPluginConfiguration(pluginId).then(function (config) {
|
||||
config.Enabled = page.querySelector('#enabled').checked;
|
||||
@@ -470,11 +478,28 @@
|
||||
config.SearchPrefix = page.querySelector('#searchPrefix').value.trim();
|
||||
config.MaxResults = parseInt(page.querySelector('#maxResults').value, 10) || 20;
|
||||
config.TimeoutSeconds = parseInt(page.querySelector('#timeoutSeconds').value, 10) || 60;
|
||||
config.SelectedLibraryIds = selectedLibraryIds();
|
||||
config.SelectedLibraryIds = ids;
|
||||
|
||||
return ApiClient.updatePluginConfiguration(pluginId, config);
|
||||
}).then(function (result) {
|
||||
Dashboard.processPluginConfigurationUpdateResult(result);
|
||||
updateResult = result;
|
||||
return ApiClient.ajax({
|
||||
type: 'POST',
|
||||
url: ApiClient.getUrl('Plugins/SceneSearch/LibrarySelection'),
|
||||
contentType: 'application/json',
|
||||
data: JSON.stringify({
|
||||
library_ids: ids,
|
||||
force: false
|
||||
})
|
||||
});
|
||||
}).then(function () {
|
||||
currentConfig.SelectedLibraryIds = ids;
|
||||
loadLibraries();
|
||||
Dashboard.processPluginConfigurationUpdateResult(updateResult);
|
||||
}).catch(function () {
|
||||
Dashboard.hideLoadingMsg();
|
||||
page.querySelector('#indexStatus').textContent =
|
||||
'Settings were saved, but Scene Search could not apply the library selection. Try again when indexing/captioning is idle.';
|
||||
});
|
||||
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user