Fix library path saving - auto-create directory and improve error handling

This commit is contained in:
2025-12-07 22:41:09 +00:00
parent 1392bc9f12
commit 427f229d69
2 changed files with 15 additions and 7 deletions

View File

@@ -311,7 +311,7 @@ async function loadSettings() {
// Save library path
async function saveLibraryPath() {
const libraryPath = document.getElementById('libraryPath').value;
const libraryPath = document.getElementById('libraryPath').value.trim();
if (!libraryPath) {
alert('Please enter a library path');
@@ -328,13 +328,14 @@ async function saveLibraryPath() {
const data = await res.json();
if (res.ok) {
alert('Library path updated! Please restart the server for changes to take effect.');
alert('✅ Library path saved!\n\nPath: ' + libraryPath + '\n\nPlease restart the server for changes to take effect.');
} else {
alert(`Error: ${data.error}`);
alert('❌ Error: ' + (data.error || 'Failed to save'));
console.error('Server error:', data);
}
} catch (error) {
console.error('Error saving settings:', error);
alert('Failed to save settings');
alert('❌ Failed to save settings. Check console for details.\n\nError: ' + error.message);
}
}