feat(wip): self check

This commit is contained in:
Jacky 2025-01-22 16:21:33 +08:00
parent 5911462f90
commit ded74bbe0a
No known key found for this signature in database
GPG key ID: 215C21B10DF38B4D
40 changed files with 1418 additions and 69 deletions

View file

@ -13,6 +13,8 @@ func InitPublicRouter(r *gin.RouterGroup) {
func InitPrivateRouter(r *gin.RouterGroup) {
r.GET("upgrade/release", GetRelease)
r.GET("upgrade/current", GetCurrentVersion)
r.GET("self_check", SelfCheck)
r.POST("self_check/:name/fix", SelfCheckFix)
}
func InitWebSocketRouter(r *gin.RouterGroup) {

18
api/system/self_check.go Normal file
View file

@ -0,0 +1,18 @@
package system
import (
"net/http"
"github.com/0xJacky/Nginx-UI/internal/self_check"
"github.com/gin-gonic/gin"
)
func SelfCheck(c *gin.Context) {
report := self_check.Run()
c.JSON(http.StatusOK, report)
}
func SelfCheckFix(c *gin.Context) {
result := self_check.AttemptFix(c.Param("name"))
c.JSON(http.StatusOK, result)
}