diff --git a/CHANGELOG.md b/CHANGELOG.md
index c6647f6..d0cba07 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -18,14 +18,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
-## [0.3.2.1] - 2022-06-14
+## [0.3.2.1] - 2022-06-16(UTC)
+
+### Changed
+
+- [System] Adjusted the display style.
### Fixed
-- Fix the problem of application opening failure on non-80 ports ([#283](https://github.com/IceWhaleTech/CasaOS/issues/283) [#280](https://github.com/IceWhaleTech/CasaOS/issues/280))
-- Modify port failure problem ([#282](https://github.com/IceWhaleTech/CasaOS/issues/282))
-- Modify environment variables disappearing problem([#284](https://github.com/IceWhaleTech/CasaOS/issues/284))
-- Fix no update alert([#278](https://github.com/IceWhaleTech/CasaOS/issues/278))
+- [System] Fixed the issue of widgets displaying wrongly on mobile devices.
+- [App] Fix the problem of application opening failure on non-80 ports ([#283](https://github.com/IceWhaleTech/CasaOS/issues/283) [#280](https://github.com/IceWhaleTech/CasaOS/issues/280))
+- [System] Modify port failure problem ([#282](https://github.com/IceWhaleTech/CasaOS/issues/282))
+- [App]Modify environment variables disappearing problem([#284](https://github.com/IceWhaleTech/CasaOS/issues/284))
+- [System]Fix no update alert([#278](https://github.com/IceWhaleTech/CasaOS/issues/278))
+- [System] Fixed some bugs of application cpu usage and memory staging([#272](https://github.com/IceWhaleTech/CasaOS/issues/272))
+- [App] Fixed plex and HA network mode error issues ([#299](https://github.com/IceWhaleTech/CasaOS/issues/299))
+- [App] Fix application terminal not working ([#266](https://github.com/IceWhaleTech/CasaOS/issues/266))
## [0.3.2] - 2022-06-10
diff --git a/model/docker.go b/model/docker.go
index 1718eb6..59b006d 100644
--- a/model/docker.go
+++ b/model/docker.go
@@ -1,3 +1,13 @@
+/*
+ * @Author: LinkLeong link@icewhale.com
+ * @Date: 2021-12-08 18:10:25
+ * @LastEditors: LinkLeong
+ * @LastEditTime: 2022-06-14 17:20:36
+ * @FilePath: /CasaOS/model/docker.go
+ * @Description:
+ * @Website: https://www.casaos.io
+ * Copyright (c) 2022 by icewhale, All Rights Reserved.
+ */
package model
type DockerStatsModel struct {
diff --git a/pkg/utils/version/version.go b/pkg/utils/version/version.go
index 10a646b..a2aaa39 100644
--- a/pkg/utils/version/version.go
+++ b/pkg/utils/version/version.go
@@ -2,7 +2,7 @@
* @Author: LinkLeong link@icewhale.com
* @Date: 2022-05-13 18:15:46
* @LastEditors: LinkLeong
- * @LastEditTime: 2022-06-14 11:17:16
+ * @LastEditTime: 2022-06-16 20:08:21
* @FilePath: /CasaOS/pkg/utils/version/version.go
* @Description:
* @Website: https://www.casaos.io
@@ -41,6 +41,9 @@ func IsNeedUpdate() (bool, model.Version) {
for i := 0; i < len(v1); i++ {
a, _ := strconv.Atoi(v1[i])
b, _ := strconv.Atoi(v2[i])
+ if i == 0 && a > b {
+ continue
+ }
if a > b {
return true, version
}
diff --git a/route/init.go b/route/init.go
index 461ef98..32ec46d 100644
--- a/route/init.go
+++ b/route/init.go
@@ -106,9 +106,10 @@ func installSyncthing(appId string) {
m.Ports = appInfo.Ports
m.Restart = "always"
m.Volumes = appInfo.Volumes
+ m.NetworkModel = appInfo.NetworkModel
m.Label = id
m.CustomId = id
- containerId, err := service.MyService.Docker().DockerContainerCreate(dockerImage+":"+dockerImageVersion, m, appInfo.NetworkModel)
+ containerId, err := service.MyService.Docker().DockerContainerCreate(dockerImage+":"+dockerImageVersion, m)
if err != nil {
fmt.Println("container create error", err)
// create container error
diff --git a/route/route.go b/route/route.go
index 594ad68..3490d34 100644
--- a/route/route.go
+++ b/route/route.go
@@ -118,6 +118,7 @@ func InitRouter() *gin.Engine {
v1SysGroup := v1Group.Group("/sys")
v1SysGroup.Use()
{
+ v1SysGroup.GET("/check", v1.GetSystemCheckVersion)
v1SysGroup.GET("/version/check", v1.GetSystemCheckVersion)
v1SysGroup.GET("/hardware/info", v1.GetSystemHardwareInfo)
v1SysGroup.POST("/update", v1.SystemUpdate)
diff --git a/route/v1/docker.go b/route/v1/docker.go
index f5a5140..78d3760 100644
--- a/route/v1/docker.go
+++ b/route/v1/docker.go
@@ -326,7 +326,7 @@ func InstallApp(c *gin.Context) {
time.Sleep(time.Second)
}
- _, err = service.MyService.Docker().DockerContainerCreate(dockerImage+":"+dockerImageVersion, m, appInfo.NetworkModel)
+ _, err = service.MyService.Docker().DockerContainerCreate(dockerImage+":"+dockerImageVersion, m)
if err != nil {
//service.MyService.Redis().Set(id, "{\"id\"\""+id+"\",\"state\":false,\"message\":\""+err.Error()+"\",\"speed\":80}", 100)
notify := notify.Application{}
@@ -900,7 +900,7 @@ func UpdateSetting(c *gin.Context) {
service.MyService.Docker().DockerContainerUpdateName(id, id)
//service.MyService.Docker().DockerContainerRemove(id, true)
- containerId, err := service.MyService.Docker().DockerContainerCreate(m.Image, m, m.NetworkModel)
+ containerId, err := service.MyService.Docker().DockerContainerCreate(m.Image, m)
if err != nil {
service.MyService.Docker().DockerContainerUpdateName(m.Label, id)
service.MyService.Docker().DockerContainerStart(id)
diff --git a/service/app.go b/service/app.go
index 17bfa33..f464dd9 100644
--- a/service/app.go
+++ b/service/app.go
@@ -464,12 +464,8 @@ func (a *appStruct) GetHardwareUsageSteam() {
fts := filters.NewArgs()
fts.Add("label", "casaos=casaos")
- //fts.Add("label", "casaos")
- //fts.Add("casaos", "casaos")
- containers, err := cli.ContainerList(context.Background(), types.ContainerListOptions{All: true, Filters: fts})
- if err != nil {
- loger.Error("Failed to get container_list", zap.Any("err", err))
- }
+ //fts.Add("status", "running")
+
for i := 0; i < 100; i++ {
if config.CasaOSGlobalVariables.AppChange {
config.CasaOSGlobalVariables.AppChange = false
@@ -479,8 +475,16 @@ func (a *appStruct) GetHardwareUsageSteam() {
return true
})
}
+ containers, err := cli.ContainerList(context.Background(), types.ContainerListOptions{All: true, Filters: fts})
+ if err != nil {
+ loger.Error("Failed to get container_list", zap.Any("err", err))
+ }
+ var temp sync.Map
var wg sync.WaitGroup
for _, v := range containers {
+ if v.State != "running" {
+ continue
+ }
wg.Add(1)
go func(v types.Container, i int) {
defer wg.Done()
@@ -501,15 +505,18 @@ func (a *appStruct) GetHardwareUsageSteam() {
dockerStats.Data = data
dockerStats.Icon = v.Labels["icon"]
dockerStats.Title = strings.ReplaceAll(v.Names[0], "/", "")
- dataStats.Store(v.ID, dockerStats)
+
+ temp.Store(v.ID, dockerStats)
if i == 99 {
stats.Body.Close()
}
}(v, i)
}
wg.Wait()
+ dataStats = temp
isFinish = true
- time.Sleep(time.Second * 3)
+
+ time.Sleep(time.Second * 1)
}
isFinish = false
cancel()
diff --git a/service/docker.go b/service/docker.go
index 69a87fd..593794c 100644
--- a/service/docker.go
+++ b/service/docker.go
@@ -45,7 +45,7 @@ import (
type DockerService interface {
DockerPullImage(imageName string, icon, name string) error
IsExistImage(imageName string) bool
- DockerContainerCreate(imageName string, m model.CustomizationPostData, net string) (containerId string, err error)
+ DockerContainerCreate(imageName string, m model.CustomizationPostData) (containerId string, err error)
DockerContainerCopyCreate(info *types.ContainerJSON) (containerId string, err error)
DockerContainerStart(name string) error
DockerContainerStats(name string) (string, error)
@@ -376,9 +376,9 @@ func (ds *dockerService) DockerContainerCopyCreate(info *types.ContainerJSON) (c
//param mapPort 容器主端口映射到外部的端口
//param tcp 容器其他tcp端口
//param udp 容器其他udp端口
-func (ds *dockerService) DockerContainerCreate(imageName string, m model.CustomizationPostData, net string) (containerId string, err error) {
- if len(net) == 0 {
- net = "bridge"
+func (ds *dockerService) DockerContainerCreate(imageName string, m model.CustomizationPostData) (containerId string, err error) {
+ if len(m.NetworkModel) == 0 {
+ m.NetworkModel = "bridge"
}
cli, err := client2.NewClientWithOpts(client2.FromEnv)
@@ -402,7 +402,7 @@ func (ds *dockerService) DockerContainerCreate(imageName string, m model.Customi
tContainer, _ := strconv.Atoi(portMap.ContainerPort)
if tContainer > 0 {
ports[nat.Port(portMap.ContainerPort+"/tcp")] = struct{}{}
- if net != "host" {
+ if m.NetworkModel != "host" {
portMaps[nat.Port(portMap.ContainerPort+"/tcp")] = []nat.PortBinding{{HostPort: portMap.CommendPort}}
}
}
@@ -411,7 +411,7 @@ func (ds *dockerService) DockerContainerCreate(imageName string, m model.Customi
tContainer, _ := strconv.Atoi(portMap.ContainerPort)
if tContainer > 0 {
ports[nat.Port(portMap.ContainerPort+"/tcp")] = struct{}{}
- if net != "host" {
+ if m.NetworkModel != "host" {
portMaps[nat.Port(portMap.ContainerPort+"/tcp")] = []nat.PortBinding{{HostPort: portMap.CommendPort}}
}
}
@@ -419,7 +419,7 @@ func (ds *dockerService) DockerContainerCreate(imageName string, m model.Customi
uContainer, _ := strconv.Atoi(portMap.ContainerPort)
if uContainer > 0 {
ports[nat.Port(portMap.ContainerPort+"/udp")] = struct{}{}
- if net != "host" {
+ if m.NetworkModel != "host" {
portMaps[nat.Port(portMap.ContainerPort+"/udp")] = []nat.PortBinding{{HostPort: portMap.CommendPort}}
}
}
@@ -428,7 +428,7 @@ func (ds *dockerService) DockerContainerCreate(imageName string, m model.Customi
uContainer, _ := strconv.Atoi(portMap.ContainerPort)
if uContainer > 0 {
ports[nat.Port(portMap.ContainerPort+"/udp")] = struct{}{}
- if net != "host" {
+ if m.NetworkModel != "host" {
portMaps[nat.Port(portMap.ContainerPort+"/udp")] = []nat.PortBinding{{HostPort: portMap.CommendPort}}
}
}
@@ -541,7 +541,7 @@ func (ds *dockerService) DockerContainerCreate(imageName string, m model.Customi
config.Labels["protocol"] = m.Protocol
config.Labels["host"] = m.Host
//config.Labels["order"] = strconv.Itoa(MyService.App().GetCasaOSCount() + 1)
- hostConfig := &container.HostConfig{Resources: res, Mounts: volumes, RestartPolicy: rp, NetworkMode: container.NetworkMode(net), Privileged: m.Privileged, CapAdd: m.CapAdd}
+ hostConfig := &container.HostConfig{Resources: res, Mounts: volumes, RestartPolicy: rp, NetworkMode: container.NetworkMode(m.NetworkModel), Privileged: m.Privileged, CapAdd: m.CapAdd}
//if net != "host" {
config.ExposedPorts = ports
hostConfig.PortBindings = portMaps
@@ -550,7 +550,7 @@ func (ds *dockerService) DockerContainerCreate(imageName string, m model.Customi
containerDb, err := cli.ContainerCreate(context.Background(),
config,
hostConfig,
- &network.NetworkingConfig{EndpointsConfig: map[string]*network.EndpointSettings{net: {NetworkID: "", Aliases: []string{}}}},
+ &network.NetworkingConfig{EndpointsConfig: map[string]*network.EndpointSettings{m.NetworkModel: {NetworkID: "", Aliases: []string{}}}},
nil,
m.Label)
if err != nil {
diff --git a/service/file.go b/service/file.go
index 697dd14..9b14b70 100644
--- a/service/file.go
+++ b/service/file.go
@@ -2,7 +2,7 @@
* @Author: LinkLeong link@icewhale.com
* @Date: 2021-12-20 14:15:46
* @LastEditors: LinkLeong
- * @LastEditTime: 2022-06-09 18:15:54
+ * @LastEditTime: 2022-06-16 16:47:46
* @FilePath: /CasaOS/service/file.go
* @Description:
* @Website: https://www.casaos.io
@@ -93,13 +93,12 @@ func FileOperate(k string) {
v := temp.Item[i]
if temp.Type == "move" {
lastPath := v.From[strings.LastIndex(v.From, "/")+1:]
-
if !file.CheckNotExist(temp.To + "/" + lastPath) {
if temp.Style == "skip" {
temp.Item[i].Finished = true
continue
} else {
- os.Remove(temp.To + "/" + lastPath)
+ os.RemoveAll(temp.To + "/" + lastPath)
}
}
diff --git a/web/index.html b/web/index.html
index 8ee9d75..84e74cf 100644
--- a/web/index.html
+++ b/web/index.html
@@ -20,7 +20,7 @@
CasaOS
-
+