mirror of
https://github.com/IceWhaleTech/CasaOS.git
synced 2025-11-07 23:29:45 +00:00
wip
This commit is contained in:
parent
38e300419b
commit
56d59a2c69
@ -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,
|
||||
})
|
||||
}
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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结构*******************/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user