feat(install): restore from backup

This commit is contained in:
Jacky 2025-03-30 00:18:37 +00:00
parent 8860f71bc7
commit 000e28942a
No known key found for this signature in database
GPG key ID: 215C21B10DF38B4D
18 changed files with 1113 additions and 667 deletions

View file

@ -17,9 +17,22 @@ func InitPrivateRouter(r *gin.RouterGroup) {
r.GET("self_check", SelfCheck)
r.POST("self_check/:name/fix", SelfCheckFix)
// Backup and restore endpoints
// Backup endpoint only
r.GET("system/backup", CreateBackup)
r.POST("system/backup/restore", middleware.EncryptedForm(), RestoreBackup)
}
func InitBackupRestoreRouter(r *gin.RouterGroup) {
r.POST("system/backup/restore",
func(ctx *gin.Context) {
// If system is installed, verify user authentication
if installLockStatus() {
middleware.AuthRequired()(ctx)
} else {
ctx.Next()
}
},
middleware.EncryptedForm(),
RestoreBackup)
}
func InitWebSocketRouter(r *gin.RouterGroup) {