diff --git a/route/socket.go b/route/socket.go index 8b73a0b..1ab4f88 100644 --- a/route/socket.go +++ b/route/socket.go @@ -14,15 +14,14 @@ import ( "strconv" "time" + "github.com/IceWhaleTech/CasaOS-Common/utils/port" "github.com/IceWhaleTech/CasaOS/model/notify" "github.com/IceWhaleTech/CasaOS/pkg/config" - "github.com/IceWhaleTech/CasaOS/pkg/utils/port" "github.com/IceWhaleTech/CasaOS/service" f "github.com/ambelovsky/gosf" ) func SocketInit(msg chan notify.Message) { - // set socket port socketPort := 0 if len(config.ServerInfo.SocketPort) == 0 { @@ -51,10 +50,9 @@ func SocketInit(msg chan notify.Message) { f.Broadcast("", v.Path, &v.Msg) time.Sleep(time.Millisecond * 100) } - }(msg) f.Startup(map[string]interface{}{ - "port": socketPort}) - + "port": socketPort, + }) } diff --git a/route/v1/file.go b/route/v1/file.go index 2b1fd11..a2787ea 100644 --- a/route/v1/file.go +++ b/route/v1/file.go @@ -222,19 +222,19 @@ func DirPath(c *gin.Context) { for _, v := range shares { sharesMap[v.Path] = fmt.Sprint(v.ID) } - if path == "/DATA/AppData" { - list := service.MyService.Docker().DockerContainerList() - apps := make(map[string]string, len(list)) - for _, v := range list { - apps[strings.ReplaceAll(v.Names[0], "/", "")] = strings.ReplaceAll(v.Names[0], "/", "") - } - for i := 0; i < len(info); i++ { - if v, ok := apps[info[i].Name]; ok { - info[i].Label = v - info[i].Type = "application" - } - } - } + // if path == "/DATA/AppData" { + // list := service.MyService.Docker().DockerContainerList() + // apps := make(map[string]string, len(list)) + // for _, v := range list { + // apps[strings.ReplaceAll(v.Names[0], "/", "")] = strings.ReplaceAll(v.Names[0], "/", "") + // } + // for i := 0; i < len(info); i++ { + // if v, ok := apps[info[i].Name]; ok { + // info[i].Label = v + // info[i].Type = "application" + // } + // } + // } // TODO - ? for i := 0; i < len(info); i++ { if v, ok := sharesMap[info[i].Path]; ok { diff --git a/service/model/o_rely.go b/service/model/o_rely.go index a28ecd1..dd86fe5 100644 --- a/service/model/o_rely.go +++ b/service/model/o_rely.go @@ -1,33 +1,17 @@ package model import ( - "database/sql/driver" - "encoding/json" - "github.com/IceWhaleTech/CasaOS/service/docker_base" "time" ) type RelyDBModel struct { - Id uint `gorm:"column:id;primary_key" json:"id"` - CustomId string ` json:"custom_id"` - ContainerCustomId string `json:"container_custom_id"` - Config MysqlConfigs `json:"config"` - ContainerId string `json:"container_id,omitempty"` - Type int `json:"type"` //目前暂未使用 - CreatedAt time.Time `gorm:"<-:create" json:"created_at"` - UpdatedAt time.Time `gorm:"<-:create;<-:update" json:"updated_at"` -} - -/****************使gorm支持[]string结构*******************/ -type MysqlConfigs docker_base.MysqlConfig - -func (c MysqlConfigs) Value() (driver.Value, error) { - b, err := json.Marshal(c) - return string(b), err -} - -func (c *MysqlConfigs) Scan(input interface{}) error { - return json.Unmarshal(input.([]byte), c) + Id uint `gorm:"column:id;primary_key" json:"id"` + CustomId string ` json:"custom_id"` + ContainerCustomId string `json:"container_custom_id"` + ContainerId string `json:"container_id,omitempty"` + Type int `json:"type"` // 目前暂未使用 + CreatedAt time.Time `gorm:"<-:create" json:"created_at"` + UpdatedAt time.Time `gorm:"<-:create;<-:update" json:"updated_at"` } /****************使gorm支持[]string结构*******************/