chore: removed locks

This commit is contained in:
2025-11-02 15:18:30 +01:00
parent ec987eff80
commit 64e78bb9b8
2 changed files with 5 additions and 82 deletions

View File

@@ -26,7 +26,6 @@ class AniWorldApp {
this.loadSeries();
this.initTheme();
this.updateConnectionStatus();
this.startProcessStatusMonitoring();
// Initialize Mobile & Accessibility features
this.initMobileAndAccessibility();
@@ -196,7 +195,6 @@ class AniWorldApp {
this.showToast(this.localization.getText('connected-server'), 'success');
this.updateConnectionStatus();
this.checkProcessLocks();
});
this.socket.on('disconnect', () => {
@@ -1172,74 +1170,6 @@ class AniWorldApp {
}
}
async checkProcessLocks() {
try {
const response = await this.makeAuthenticatedRequest('/api/anime/process/locks');
if (!response) {
// If no response, set status as idle
this.updateProcessStatus('rescan', false);
this.updateProcessStatus('download', false);
return;
}
// Check if response is actually JSON and not HTML (login page)
const contentType = response.headers.get('content-type');
if (!contentType || !contentType.includes('application/json')) {
console.warn('Process locks API returned non-JSON response, likely authentication issue');
// Set status as idle if we can't get proper response
this.updateProcessStatus('rescan', false);
this.updateProcessStatus('download', false);
return;
}
const data = await response.json();
if (data.success) {
const locks = data.locks;
this.updateProcessStatus('rescan', locks.rescan?.is_locked || false);
this.updateProcessStatus('download', locks.download?.is_locked || false);
// Update button states
const rescanBtn = document.getElementById('rescan-btn');
if (rescanBtn) {
if (locks.rescan?.is_locked) {
rescanBtn.disabled = true;
const span = rescanBtn.querySelector('span');
if (span) span.textContent = 'Scanning...';
} else {
rescanBtn.disabled = false;
const span = rescanBtn.querySelector('span');
if (span) span.textContent = 'Rescan';
}
}
} else {
// If API returns error, set status as idle
console.warn('Process locks API returned error:', data.error);
this.updateProcessStatus('rescan', false);
this.updateProcessStatus('download', false);
}
} catch (error) {
console.error('Error checking process locks:', error);
// On error, set status as idle
this.updateProcessStatus('rescan', false);
this.updateProcessStatus('download', false);
}
}
startProcessStatusMonitoring() {
// Initial check on page load
this.checkProcessLocks();
// Check process status every 5 seconds
setInterval(() => {
if (this.isConnected) {
this.checkProcessLocks();
}
}, 5000);
console.log('Process status monitoring started');
}
async showConfigModal() {
const modal = document.getElementById('config-modal');