|
|
|
/**
|
|
|
|
* @Author: jager
|
|
|
|
* @Email: lhj168os@gmail.com
|
|
|
|
* @File: api
|
|
|
|
* @Date: 2021/12/31 2:34 下午
|
|
|
|
* @package: api
|
|
|
|
* @Version: v1.0.0
|
|
|
|
*
|
|
|
|
* @Description:
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
package api
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
"github.com/jageros/hawox/jwt"
|
|
|
|
"idata/internal/service/almanac"
|
|
|
|
"idata/internal/service/dirty"
|
|
|
|
"idata/internal/service/network"
|
|
|
|
"idata/internal/service/soup"
|
|
|
|
"idata/internal/service/user"
|
|
|
|
)
|
|
|
|
|
|
|
|
func Registry(engine *gin.Engine) {
|
|
|
|
r := engine.Group("/haw")
|
|
|
|
ur := r.Group("/user")
|
|
|
|
ur.POST("/register", user.Register)
|
|
|
|
ur.POST("/login", user.Login)
|
|
|
|
ur.GET("/info", jwt.CheckToken, user.Info)
|
|
|
|
ur.GET("/secret", jwt.CheckToken, user.Secret)
|
|
|
|
ur.GET("/openapi", jwt.CheckToken, user.OpenApi)
|
|
|
|
|
|
|
|
apiR := r.Group("/api")
|
|
|
|
apiR.GET("/soup", soup.GetRandSoup)
|
|
|
|
apiR.GET("/almanac", almanac.Almanac)
|
|
|
|
apiR.GET("/dirty_word", dirty.IsDirtyWord)
|
|
|
|
apiR.GET("/my-ip", network.MyIp)
|
|
|
|
apiR.GET("/dns", network.Domain2IP)
|
|
|
|
apiR.GET("/domain", network.IP2Domain)
|
|
|
|
}
|