CasaOS - A simple, easy-to-use, elegant open-source Personal Cloud system.
fixed bug
link956328da864b
diff --git a/UI b/UIindex a74be10..f7c46d7 160000--- a/UI+++ b/UI@@ -1 +1 @@-Subproject commit a74be104eb5173eb1933d5e7e7a2364f6f1890de+Subproject commit f7c46d7379ab31bc70a35900ef6a50f7f3c2ef4fdiff --git a/model/sys_common.go b/model/sys_common.goindex b7f2d00..be79dfa 100644--- a/model/sys_common.go+++ b/model/sys_common.go@@ -20,9 +20,10 @@ type UserModel struct {//服务配置type ServerModel struct {- HttpPort string- RunMode string- ServerApi string+ HttpPort string+ RunMode string+ ServerApi string+ LockAccount bool}//服务配置diff --git a/pkg/utils/oasis_err/e.go b/pkg/utils/oasis_err/e.goindex da3af66..96cf572 100644--- a/pkg/utils/oasis_err/e.go+++ b/pkg/utils/oasis_err/e.go@@ -11,6 +11,7 @@ const (PWD_IS_EMPTY = 10002PWD_INVALID_OLD = 10003+ ACCOUNT_LOCK = 10004//systemDIR_ALREADY_EXISTS = 20001FILE_ALREADY_EXISTS = 20002@@ -42,6 +43,7 @@ var MsgFlags = map[int]string{PWD_INVALID: "Password invalid",PWD_IS_EMPTY: "Password is empty",PWD_INVALID_OLD: "Old Password invalid",+ ACCOUNT_LOCK: "Account Lock",//systemDIR_ALREADY_EXISTS: "Directory already exists",diff --git a/route/init.go b/route/init.goindex 4c69ab3..12adf1c 100644--- a/route/init.go+++ b/route/init.go@@ -96,7 +96,7 @@ func installSyncthing(appId string) {m.Origin = "system"m.PortMap = appInfo.PortMapm.Ports = appInfo.Ports- m.Restart = ""+ m.Restart = "always"m.Volumes = appInfo.VolumescontainerId, err := service.MyService.Docker().DockerContainerCreate(dockerImage+":"+dockerImageVersion, id, m, appInfo.NetworkModel)@@ -156,6 +156,10 @@ func checkSystemApp() {list := service.MyService.App().GetSystemAppList()for _, v := range *list {if v.Image == "linuxserver/syncthing" {+ if v.State != "running" {+ //step:start container+ service.MyService.Docker().DockerContainerStart(v.CustomId)+ }syncIsExistence = trueif config.SystemConfigInfo.SyncPort != v.Port {config.SystemConfigInfo.SyncPort = v.Portdiff --git a/route/route.go b/route/route.goindex 900c6a3..87b7adc 100644--- a/route/route.go+++ b/route/route.go@@ -12,6 +12,7 @@ import ()var swagHandler gin.HandlerFunc+var OnlineDemo bool = falsefunc InitRouter() *gin.Engine {diff --git a/route/v1/docker.go b/route/v1/docker.goindex 3b15efe..59001c0 100644--- a/route/v1/docker.go+++ b/route/v1/docker.go@@ -2,6 +2,7 @@ package v1import ("bytes"+ "encoding/json"json2 "encoding/json""net/http""reflect"@@ -420,6 +421,9 @@ func InstallApp(c *gin.Context) {rely := model.MapStrings{}copier.Copy(&rely, &relyMap)+ for i := 0; i < len(m.Volumes); i++ {+ m.Volumes[i].Path = docker.GetDir(id, m.Volumes[i].ContainerPath)+ }portsStr, _ := json2.Marshal(m.Ports)envsStr, _ := json2.Marshal(m.Envs)volumesStr, _ := json2.Marshal(m.Volumes)@@ -904,10 +908,16 @@ func UpdateSetting(c *gin.Context) {//如果容器端口均未修改,这不进行处理portsStr, _ := json2.Marshal(m.Ports)+ list := []model.PathMap{}+ json.Unmarshal([]byte(appInfo.Volumes), &list)+ for i := 0; i < len(list); i++ {+ list[i].Path = docker.GetDir(id, list[i].ContainerPath)+ }envsStr, _ := json2.Marshal(m.Envs)volumesStr, _ := json2.Marshal(m.Volumes)devicesStr, _ := json2.Marshal(m.Devices)- if !reflect.DeepEqual(string(portsStr), appInfo.Ports) || !reflect.DeepEqual(string(envsStr), appInfo.Envs) || !reflect.DeepEqual(string(volumesStr), appInfo.Volumes) || m.PortMap != appInfo.PortMap || m.NetworkModel != appInfo.NetModel {+ listStr, _ := json2.Marshal(list)+ if !reflect.DeepEqual(string(portsStr), appInfo.Ports) || !reflect.DeepEqual(string(envsStr), appInfo.Envs) || !reflect.DeepEqual(volumesStr, listStr) || m.PortMap != appInfo.PortMap || m.NetworkModel != appInfo.NetModel {var newUUid = uuid.NewV4().String()var err errordiff --git a/route/v1/user.go b/route/v1/user.goindex 0de2ee6..d79b718 100644--- a/route/v1/user.go+++ b/route/v1/user.go@@ -123,6 +123,10 @@ func Up_Load_Head(c *gin.Context) {// @Success 200 {string} string "ok"// @Router /user/changusername [put]func Chang_User_Name(c *gin.Context) {+ if config.ServerInfo.LockAccount {+ c.JSON(http.StatusOK, model.Result{Success: oasis_err2.ACCOUNT_LOCK, Message: oasis_err2.GetMsg(oasis_err2.ACCOUNT_LOCK)})+ return+ }oldname := c.PostForm("oldname")username := c.PostForm("username")if len(username) == 0 || config.UserInfo.UserName != oldname {@@ -149,6 +153,10 @@ func Chang_User_Pwd(c *gin.Context) {c.JSON(http.StatusOK, model.Result{Success: oasis_err2.PWD_INVALID_OLD, Message: oasis_err2.GetMsg(oasis_err2.PWD_INVALID_OLD)})return}+ if config.ServerInfo.LockAccount {+ c.JSON(http.StatusOK, model.Result{Success: oasis_err2.ACCOUNT_LOCK, Message: oasis_err2.GetMsg(oasis_err2.ACCOUNT_LOCK)})+ return+ }if len(pwd) == 0 {c.JSON(http.StatusOK, model.Result{Success: oasis_err2.PWD_IS_EMPTY, Message: oasis_err2.GetMsg(oasis_err2.PWD_IS_EMPTY)})returndiff --git a/service/docker.go b/service/docker.goindex 9f0d3e1..a9b8302 100644--- a/service/docker.go+++ b/service/docker.go@@ -479,15 +479,13 @@ func (ds *dockerService) DockerContainerCreate(imageName string, containerDbId sif len(m.Restart) > 0 {rp.Name = m.Restart}- //fmt.Print(port)healthTest := []string{}if len(port) > 0 {healthTest = []string{"CMD-SHELL", "curl -f http://localhost:" + port + m.Index + " || exit 1"}}health := &container.HealthConfig{- Test: healthTest,- //Test: []string{},+ Test: healthTest,StartPeriod: 0,Retries: 1000,}diff --git a/types/system.go b/types/system.goindex 5a73686..88bd872 100644--- a/types/system.go+++ b/types/system.go@@ -1,4 +1,4 @@package types-const CURRENTVERSION = "0.2.1"-const BODY = "<li>fixed path error</li>"+const CURRENTVERSION = "0.2.2"+const BODY = "<li>ui adjustment</li><li>fixed bugs</li>"