Merge branch 'lichang' into lite
This commit is contained in:
@@ -12,18 +12,6 @@ import (
|
||||
func Setup(router *gin.Engine) {
|
||||
logger.Infof("开始加载 ====> auth 模块路由")
|
||||
|
||||
// 系统可暴露的配置信息
|
||||
router.GET("/sys-conf", controller.NewSysConf.Handler)
|
||||
|
||||
// 系统引导初始化
|
||||
guideGroup := router.Group("/bootloader")
|
||||
{
|
||||
guideGroup.POST("", controller.NewBootloader.Start)
|
||||
guideGroup.PUT("", middleware.AuthorizeUser(nil), controller.NewBootloader.Done)
|
||||
guideGroup.DELETE("", middleware.AuthorizeUser(nil), controller.NewBootloader.Reset)
|
||||
guideGroup.PUT("/account", middleware.AuthorizeUser(nil), controller.NewBootloader.Account)
|
||||
}
|
||||
|
||||
// 验证码操作
|
||||
router.GET("/captcha-image",
|
||||
middleware.RateLimit(middleware.LimitOption{
|
||||
|
||||
@@ -52,4 +52,16 @@ func Setup(router *gin.Engine) {
|
||||
fileGroup.DELETE("", middleware.AuthorizeUser(nil), controller.NewFile.Remove)
|
||||
fileGroup.POST("/transfer-static-file", middleware.AuthorizeUser(nil), controller.NewFile.TransferStaticFile)
|
||||
}
|
||||
|
||||
// 系统可暴露的配置信息
|
||||
router.GET("/sys-conf", controller.NewSysConf.Handler)
|
||||
|
||||
// 系统引导初始化
|
||||
guideGroup := router.Group("/bootloader")
|
||||
{
|
||||
guideGroup.POST("", controller.NewBootloader.Start)
|
||||
guideGroup.PUT("", middleware.AuthorizeUser(nil), controller.NewBootloader.Done)
|
||||
guideGroup.DELETE("", middleware.AuthorizeUser(nil), controller.NewBootloader.Reset)
|
||||
guideGroup.PUT("/account", middleware.AuthorizeUser(nil), controller.NewBootloader.Account)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package controller
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
@@ -265,7 +266,9 @@ func (s *NeLicenseController) State(c *gin.Context) {
|
||||
neLicense.ExpiryDate = fmt.Sprint(neState["expire"])
|
||||
} else {
|
||||
neLicense.Status = "0"
|
||||
// 更新授权码
|
||||
}
|
||||
// 更新授权码
|
||||
if neLicense.ActivationRequestCode == "" || strings.HasPrefix(neLicense.ActivationRequestCode, "SN") {
|
||||
code, licensePath := s.neLicenseService.ReadLicenseInfo(neLicense)
|
||||
neLicense.ActivationRequestCode = code
|
||||
neLicense.LicensePath = licensePath
|
||||
|
||||
@@ -18,8 +18,8 @@ func NeTraceAdd(neInfo model.NeInfo, data any) (map[string]any, error) {
|
||||
var resData map[string]any
|
||||
if err != nil {
|
||||
errStr := err.Error()
|
||||
logger.Warnf("NeTraceAdd POST \"%s\"", neUrl)
|
||||
if !(strings.HasPrefix(errStr, "201") || strings.HasPrefix(errStr, "400")) {
|
||||
logger.Warnf("NeTraceAdd POST \"%s\"", neUrl)
|
||||
logger.Errorf("NeTraceAdd %s", errStr)
|
||||
return nil, fmt.Errorf("NeService Trace Add API Error")
|
||||
}
|
||||
|
||||
@@ -137,7 +137,13 @@ func (r *NeLicense) ReadLicenseInfo(neLicense model.NeLicense) (string, string)
|
||||
if err := file.CopyFile(nePath+"/system.ini", omcPath+"/system.ini"); err == nil {
|
||||
licensePath = omcPath + "/system.ini"
|
||||
}
|
||||
return strings.TrimSpace(string(bytes)), licensePath
|
||||
|
||||
activationRequestCode := string(bytes)
|
||||
parts := strings.SplitAfter(string(bytes), "\n")
|
||||
if len(parts) > 1 {
|
||||
activationRequestCode = parts[1] // 获取 \n 后的内容
|
||||
}
|
||||
return strings.TrimSpace(activationRequestCode), licensePath
|
||||
}
|
||||
|
||||
// UploadLicense 授权文件上传到网元主机
|
||||
|
||||
Reference in New Issue
Block a user