removed useless stuff
This commit is contained in:
@@ -26,9 +26,6 @@ class AniWorldApp {
|
||||
this.loadSeries();
|
||||
this.initTheme();
|
||||
this.updateConnectionStatus();
|
||||
|
||||
// Initialize Mobile & Accessibility features
|
||||
this.initMobileAndAccessibility();
|
||||
}
|
||||
|
||||
async checkAuthentication() {
|
||||
@@ -1726,155 +1723,6 @@ class AniWorldApp {
|
||||
}
|
||||
}
|
||||
|
||||
showBackupsModal(backups) {
|
||||
// Create modal to show backups
|
||||
const modal = document.createElement('div');
|
||||
modal.className = 'modal';
|
||||
modal.style.display = 'block';
|
||||
|
||||
const modalContent = document.createElement('div');
|
||||
modalContent.className = 'modal-content';
|
||||
modalContent.style.maxWidth = '60%';
|
||||
|
||||
const header = document.createElement('div');
|
||||
header.innerHTML = '<h3>Configuration Backups</h3>';
|
||||
|
||||
const backupList = document.createElement('div');
|
||||
backupList.className = 'backup-list';
|
||||
|
||||
if (backups.length === 0) {
|
||||
backupList.innerHTML = '<div class="backup-item"><span>No backups found</span></div>';
|
||||
} else {
|
||||
backups.forEach(backup => {
|
||||
const item = document.createElement('div');
|
||||
item.className = 'backup-item';
|
||||
|
||||
const info = document.createElement('div');
|
||||
info.className = 'backup-info';
|
||||
|
||||
const name = document.createElement('div');
|
||||
name.className = 'backup-name';
|
||||
name.textContent = backup.filename;
|
||||
|
||||
const details = document.createElement('div');
|
||||
details.className = 'backup-details';
|
||||
details.textContent = `Size: ${backup.size_kb} KB • Modified: ${backup.modified_display}`;
|
||||
|
||||
info.appendChild(name);
|
||||
info.appendChild(details);
|
||||
|
||||
const actions = document.createElement('div');
|
||||
actions.className = 'backup-actions';
|
||||
|
||||
const restoreBtn = document.createElement('button');
|
||||
restoreBtn.className = 'btn btn-xs btn-primary';
|
||||
restoreBtn.textContent = 'Restore';
|
||||
restoreBtn.onclick = () => {
|
||||
if (confirm('Are you sure you want to restore this backup? Current configuration will be overwritten.')) {
|
||||
this.restoreBackup(backup.filename);
|
||||
document.body.removeChild(modal);
|
||||
}
|
||||
};
|
||||
|
||||
const downloadBtn = document.createElement('button');
|
||||
downloadBtn.className = 'btn btn-xs btn-secondary';
|
||||
downloadBtn.textContent = 'Download';
|
||||
downloadBtn.onclick = () => this.downloadBackup(backup.filename);
|
||||
|
||||
actions.appendChild(restoreBtn);
|
||||
actions.appendChild(downloadBtn);
|
||||
|
||||
item.appendChild(info);
|
||||
item.appendChild(actions);
|
||||
|
||||
backupList.appendChild(item);
|
||||
});
|
||||
}
|
||||
|
||||
const closeBtn = document.createElement('button');
|
||||
closeBtn.textContent = 'Close';
|
||||
closeBtn.className = 'btn btn-secondary';
|
||||
closeBtn.onclick = () => document.body.removeChild(modal);
|
||||
|
||||
modalContent.appendChild(header);
|
||||
modalContent.appendChild(backupList);
|
||||
modalContent.appendChild(closeBtn);
|
||||
modal.appendChild(modalContent);
|
||||
document.body.appendChild(modal);
|
||||
|
||||
// Close on background click
|
||||
modal.onclick = (e) => {
|
||||
if (e.target === modal) {
|
||||
document.body.removeChild(modal);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
async restoreBackup(filename) {
|
||||
try {
|
||||
const response = await this.makeAuthenticatedRequest(`/api/config/backup/${encodeURIComponent(filename)}/restore`, {
|
||||
method: 'POST'
|
||||
});
|
||||
|
||||
if (!response) return;
|
||||
const data = await response.json();
|
||||
|
||||
if (data.success) {
|
||||
this.showToast('Configuration restored successfully', 'success');
|
||||
// Reload the config modal
|
||||
setTimeout(() => {
|
||||
this.hideConfigModal();
|
||||
this.showConfigModal();
|
||||
}, 1000);
|
||||
} else {
|
||||
this.showToast(`Failed to restore backup: ${data.error}`, 'error');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error restoring backup:', error);
|
||||
this.showToast('Failed to restore backup', 'error');
|
||||
}
|
||||
}
|
||||
|
||||
downloadBackup(filename) {
|
||||
const link = document.createElement('a');
|
||||
link.href = `/api/config/backup/${encodeURIComponent(filename)}/download`;
|
||||
link.download = filename;
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
}
|
||||
|
||||
async exportConfig() {
|
||||
try {
|
||||
const includeSensitive = confirm('Include sensitive data (passwords, salts)? Click Cancel for safe export without sensitive data.');
|
||||
|
||||
const response = await this.makeAuthenticatedRequest('/api/config/export', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ include_sensitive: includeSensitive })
|
||||
});
|
||||
|
||||
if (response && response.ok) {
|
||||
// Handle file download
|
||||
const blob = await response.blob();
|
||||
const url = window.URL.createObjectURL(blob);
|
||||
const link = document.createElement('a');
|
||||
link.href = url;
|
||||
link.download = `aniworld_config_${new Date().toISOString().slice(0, 19).replace(/:/g, '-')}.json`;
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
window.URL.revokeObjectURL(url);
|
||||
|
||||
this.showToast('Configuration exported successfully', 'success');
|
||||
} else {
|
||||
this.showToast('Failed to export configuration', 'error');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error exporting config:', error);
|
||||
this.showToast('Failed to export configuration', 'error');
|
||||
}
|
||||
}
|
||||
|
||||
async validateConfig() {
|
||||
try {
|
||||
const response = await this.makeAuthenticatedRequest('/api/config/validate', {
|
||||
|
||||
Reference in New Issue
Block a user