qinglong-go/api/system/system.go

32 lines
586 B
Go
Raw Normal View History

2022-11-16 10:20:07 +00:00
package system
import (
"github.com/gin-gonic/gin"
"github.com/huoxue1/qinglong-go/service/system"
"github.com/huoxue1/qinglong-go/utils/res"
"os"
"path"
)
2022-11-26 02:31:26 +00:00
var (
VERSION = "UNKNOWN"
)
2022-11-16 10:20:07 +00:00
func Api(group *gin.RouterGroup) {
2022-11-20 14:11:47 +00:00
group.GET("", get())
2022-11-16 10:20:07 +00:00
}
func get() gin.HandlerFunc {
return func(ctx *gin.Context) {
_, err := os.Stat(path.Join("data", "config", "auth.json"))
2022-11-20 14:11:47 +00:00
exist := os.IsNotExist(err)
2022-11-16 10:20:07 +00:00
ctx.JSON(200, res.Ok(system.System{
2022-11-20 14:11:47 +00:00
IsInitialized: !exist,
2022-11-26 02:31:26 +00:00
Version: VERSION,
2022-11-16 10:20:07 +00:00
LastCommitTime: "",
LastCommitId: "",
Branch: "master",
}))
}
}