diff --git a/model/app.go b/model/app.go index d195132..58b69c2 100644 --- a/model/app.go +++ b/model/app.go @@ -45,7 +45,7 @@ type ServerAppList struct { Index string `json:"index"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` - State string `json:"state"` + State int `json:"state"` Author string `json:"author"` MinMemory int `json:"min_memory"` MinDisk int `json:"min_disk"` diff --git a/route/route.go b/route/route.go index 22d8aa8..d6af7a8 100644 --- a/route/route.go +++ b/route/route.go @@ -35,7 +35,7 @@ func InitRouter() *gin.Engine { r.POST("/v1/users/register", v1.PostUserRegister) r.POST("/v1/users/login", v1.PostUserLogin) r.GET("/v1/users/name", v1.GetUserAllUsername) //all/name - r.POST("/v1/user/refresh", v1.PostUserRefreshToken) + r.POST("/v1/users/refresh", v1.PostUserRefreshToken) // No short-term modifications r.GET("/v1/users/image", v1.GetUserImage) diff --git a/route/v1/app.go b/route/v1/app.go index 7d6b6ed..eec6a7b 100644 --- a/route/v1/app.go +++ b/route/v1/app.go @@ -137,6 +137,7 @@ func MyAppList(c *gin.Context) { func AppUsageList(c *gin.Context) { list := service.MyService.App().GetHardwareUsage() c.JSON(common_err.SUCCESS, &model.Result{Success: common_err.SUCCESS, Message: common_err.GetMsg(common_err.SUCCESS), Data: list}) + //c.JSON(common_err.SUCCESS, &model.Result{Success: common_err.SUCCESS, Message: common_err.GetMsg(common_err.SUCCESS), Data: nil}) } // @Summary 应用详情 diff --git a/route/v1/docker.go b/route/v1/docker.go index 4c2cd7f..3e15ae1 100644 --- a/route/v1/docker.go +++ b/route/v1/docker.go @@ -1121,13 +1121,13 @@ func ContainerUpdateInfo(c *gin.Context) { showENV := info.Config.Labels["show_env"] showENVList := strings.Split(showENV, ",") showENVMap := make(map[string]string) - if len(showENVList) > 1 { + if len(showENVList) > 0 { for _, name := range showENVList { showENVMap[name] = "1" } } for _, v := range info.Config.Env { - if len(showENVList) > 1 { + if len(showENVList) > 0 { if _, ok := showENVMap[strings.Split(v, "=")[0]]; ok { temp := model.Env{ Name: strings.Split(v, "=")[0], diff --git a/service/casa.go b/service/casa.go index a0f03e9..b5ca80e 100644 --- a/service/casa.go +++ b/service/casa.go @@ -240,7 +240,11 @@ func (o *casaService) GetServerAppInfo(id, t string, language string) (model.Ser if infoS == "" { return info, errors.New("server error") } - json2.Unmarshal([]byte(gjson.Get(infoS, "data").String()), &info) + err := json2.Unmarshal([]byte(gjson.Get(infoS, "data").String()), &info) + if err != nil { + fmt.Println(infoS) + return info, err + } return info, nil } diff --git a/service/disk.go b/service/disk.go index fcb3ac9..fb026bc 100644 --- a/service/disk.go +++ b/service/disk.go @@ -59,6 +59,7 @@ func (d *diskService) SmartCTL(path string) model.SmartctlA { str := command2.ExecSmartCTLByPath(path) if str == nil { loger.Error("failed to exec shell ", zap.Any("err", "smartctl exec error")) + Cache.Add(key, m, time.Minute*10) return m } diff --git a/shell/helper.sh b/shell/helper.sh index 930dd97..8bd81bf 100644 --- a/shell/helper.sh +++ b/shell/helper.sh @@ -346,3 +346,21 @@ USB_Remove_File() { GetDeviceTree(){ cat /proc/device-tree/model } + +# restart samba service +RestartSMBD(){ + $sudo_cmd systemctl restart smbd +} + +# edit user password $1:username +EditSmabaUserPassword(){ + $sudo_cmd smbpasswd $1 +} + +AddSmabaUser(){ + $sudo_cmd useradd $1 + $sudo_cmd smbpasswd -a $1 < CasaOS - +