backup.go 436 B

123456789101112131415161718192021222324
  1. package api
  2. import (
  3. "github.com/0xJacky/Nginx-UI/model"
  4. "github.com/gin-gonic/gin"
  5. "github.com/unknwon/com"
  6. "net/http"
  7. )
  8. func GetFileBackupList(c *gin.Context) {
  9. path := c.Query("path")
  10. backups := model.GetBackupList(path)
  11. c.JSON(http.StatusOK, gin.H{
  12. "backups": backups,
  13. })
  14. }
  15. func GetFileBackup(c *gin.Context) {
  16. id := c.Param("id")
  17. backup := model.GetBackup(com.StrTo(id).MustInt())
  18. c.JSON(http.StatusOK, backup)
  19. }