Initial commit: DashCaddy v1.0
Full codebase including API server (32 modules + routes), dashboard frontend, DashCA certificate distribution, installer script, and deployment skills.
This commit is contained in:
38
dashcaddy-api/routes/backups.js
Normal file
38
dashcaddy-api/routes/backups.js
Normal file
@@ -0,0 +1,38 @@
|
||||
const express = require('express');
|
||||
|
||||
module.exports = function(ctx) {
|
||||
const router = express.Router();
|
||||
|
||||
// Get backup configuration
|
||||
router.get('/backups/config', ctx.asyncHandler(async (req, res) => {
|
||||
const config = ctx.backupManager.getConfig();
|
||||
res.json({ success: true, config });
|
||||
}, 'backups-config-get'));
|
||||
|
||||
// Update backup configuration
|
||||
router.post('/backups/config', ctx.asyncHandler(async (req, res) => {
|
||||
ctx.backupManager.updateConfig(req.body);
|
||||
res.json({ success: true, message: 'Backup configuration updated' });
|
||||
}, 'backups-config-update'));
|
||||
|
||||
// Execute manual backup
|
||||
router.post('/backups/execute', ctx.asyncHandler(async (req, res) => {
|
||||
const backup = await ctx.backupManager.executeBackup('manual', req.body);
|
||||
res.json({ success: true, backup });
|
||||
}, 'backups-execute'));
|
||||
|
||||
// Get backup history
|
||||
router.get('/backups/history', ctx.asyncHandler(async (req, res) => {
|
||||
const limit = parseInt(req.query.limit) || 50;
|
||||
const history = ctx.backupManager.getHistory(limit);
|
||||
res.json({ success: true, history });
|
||||
}, 'backups-history'));
|
||||
|
||||
// Restore from backup
|
||||
router.post('/backups/restore/:backupId', ctx.asyncHandler(async (req, res) => {
|
||||
const result = await ctx.backupManager.restoreBackup(req.params.backupId, req.body);
|
||||
res.json({ success: true, result });
|
||||
}, 'backups-restore'));
|
||||
|
||||
return router;
|
||||
};
|
||||
Reference in New Issue
Block a user