Enhanced setup and settings pages with full configuration
- Extended SetupRequest model to include all configuration fields - Updated setup API endpoint to handle comprehensive configuration - Created new setup.html with organized configuration sections - Enhanced config modal in index.html with all settings - Updated JavaScript modules to use unified config API - Added backup configuration section - Documented new features in features.md and instructions.md
This commit is contained in:
@@ -55,24 +55,25 @@ AniWorld.SchedulerConfig = (function() {
|
||||
async function save() {
|
||||
try {
|
||||
const enabled = document.getElementById('scheduled-rescan-enabled').checked;
|
||||
const time = document.getElementById('scheduled-rescan-time').value;
|
||||
const autoDownload = document.getElementById('auto-download-after-rescan').checked;
|
||||
const interval = parseInt(document.getElementById('scheduled-rescan-interval').value) || 60;
|
||||
|
||||
const response = await AniWorld.ApiClient.post(API.SCHEDULER_CONFIG, {
|
||||
// Get current config
|
||||
const configResponse = await AniWorld.ApiClient.get(AniWorld.Constants.API.CONFIG);
|
||||
if (!configResponse) return;
|
||||
const config = await configResponse.json();
|
||||
|
||||
// Update scheduler settings
|
||||
config.scheduler = {
|
||||
enabled: enabled,
|
||||
time: time,
|
||||
auto_download_after_rescan: autoDownload
|
||||
});
|
||||
interval_minutes: interval
|
||||
};
|
||||
|
||||
// Save updated config
|
||||
const response = await AniWorld.ApiClient.put(AniWorld.Constants.API.CONFIG, config);
|
||||
if (!response) return;
|
||||
const data = await response.json();
|
||||
|
||||
if (data.success) {
|
||||
AniWorld.UI.showToast('Scheduler configuration saved successfully', 'success');
|
||||
await load();
|
||||
} else {
|
||||
AniWorld.UI.showToast('Failed to save config: ' + data.error, 'error');
|
||||
}
|
||||
AniWorld.UI.showToast('Scheduler configuration saved successfully', 'success');
|
||||
await load();
|
||||
} catch (error) {
|
||||
console.error('Error saving scheduler config:', error);
|
||||
AniWorld.UI.showToast('Failed to save scheduler configuration', 'error');
|
||||
|
||||
Reference in New Issue
Block a user