Server export now includes encryption key, themes, and all config files. Client export bundles all DashCaddy localStorage keys (19 named + dynamic widget keys) as browserState. Restore handles both server and browser state in one operation. Legacy v1.0 import format still supported. Removed redundant Export/Import toolbar buttons — Backup modal is now the single entry point. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
38 lines
1.1 KiB
JavaScript
38 lines
1.1 KiB
JavaScript
// ========== CADDY RELOAD BUTTON ==========
|
|
(function() {
|
|
// Reload Caddy button handler
|
|
document.getElementById('reload-caddy-top')?.addEventListener('click', async () => {
|
|
const button = document.getElementById('reload-caddy-top');
|
|
const originalText = button.textContent;
|
|
|
|
try {
|
|
button.textContent = '⏳ Reloading...';
|
|
button.disabled = true;
|
|
|
|
const response = await secureFetch('/api/v1/caddy/reload', {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' }
|
|
});
|
|
|
|
const result = await response.json();
|
|
|
|
if (response.ok && result.success) {
|
|
button.textContent = '✅ Reloaded!';
|
|
setTimeout(() => {
|
|
button.textContent = originalText;
|
|
button.disabled = false;
|
|
}, 2000);
|
|
} else {
|
|
throw new Error(result.error || 'Reload failed');
|
|
}
|
|
} catch (error) {
|
|
button.textContent = '❌ Failed';
|
|
showNotification(`Failed to reload Caddy: ${error.message}`, 'error');
|
|
setTimeout(() => {
|
|
button.textContent = originalText;
|
|
button.disabled = false;
|
|
}, 2000);
|
|
}
|
|
});
|
|
})();
|