You've already forked CasaOS
mirror of
https://github.com/IceWhaleTech/CasaOS.git
synced 2025-07-06 23:37:26 +02:00
fixed bug
This commit is contained in:
2
UI
2
UI
Submodule UI updated: a74be104eb...f7c46d7379
@ -20,9 +20,10 @@ type UserModel struct {
|
|||||||
|
|
||||||
//服务配置
|
//服务配置
|
||||||
type ServerModel struct {
|
type ServerModel struct {
|
||||||
HttpPort string
|
HttpPort string
|
||||||
RunMode string
|
RunMode string
|
||||||
ServerApi string
|
ServerApi string
|
||||||
|
LockAccount bool
|
||||||
}
|
}
|
||||||
|
|
||||||
//服务配置
|
//服务配置
|
||||||
|
@ -11,6 +11,7 @@ const (
|
|||||||
PWD_IS_EMPTY = 10002
|
PWD_IS_EMPTY = 10002
|
||||||
|
|
||||||
PWD_INVALID_OLD = 10003
|
PWD_INVALID_OLD = 10003
|
||||||
|
ACCOUNT_LOCK = 10004
|
||||||
//system
|
//system
|
||||||
DIR_ALREADY_EXISTS = 20001
|
DIR_ALREADY_EXISTS = 20001
|
||||||
FILE_ALREADY_EXISTS = 20002
|
FILE_ALREADY_EXISTS = 20002
|
||||||
@ -42,6 +43,7 @@ var MsgFlags = map[int]string{
|
|||||||
PWD_INVALID: "Password invalid",
|
PWD_INVALID: "Password invalid",
|
||||||
PWD_IS_EMPTY: "Password is empty",
|
PWD_IS_EMPTY: "Password is empty",
|
||||||
PWD_INVALID_OLD: "Old Password invalid",
|
PWD_INVALID_OLD: "Old Password invalid",
|
||||||
|
ACCOUNT_LOCK: "Account Lock",
|
||||||
|
|
||||||
//system
|
//system
|
||||||
DIR_ALREADY_EXISTS: "Directory already exists",
|
DIR_ALREADY_EXISTS: "Directory already exists",
|
||||||
|
@ -96,7 +96,7 @@ func installSyncthing(appId string) {
|
|||||||
m.Origin = "system"
|
m.Origin = "system"
|
||||||
m.PortMap = appInfo.PortMap
|
m.PortMap = appInfo.PortMap
|
||||||
m.Ports = appInfo.Ports
|
m.Ports = appInfo.Ports
|
||||||
m.Restart = ""
|
m.Restart = "always"
|
||||||
m.Volumes = appInfo.Volumes
|
m.Volumes = appInfo.Volumes
|
||||||
|
|
||||||
containerId, err := service.MyService.Docker().DockerContainerCreate(dockerImage+":"+dockerImageVersion, id, m, appInfo.NetworkModel)
|
containerId, err := service.MyService.Docker().DockerContainerCreate(dockerImage+":"+dockerImageVersion, id, m, appInfo.NetworkModel)
|
||||||
@ -156,6 +156,10 @@ func checkSystemApp() {
|
|||||||
list := service.MyService.App().GetSystemAppList()
|
list := service.MyService.App().GetSystemAppList()
|
||||||
for _, v := range *list {
|
for _, v := range *list {
|
||||||
if v.Image == "linuxserver/syncthing" {
|
if v.Image == "linuxserver/syncthing" {
|
||||||
|
if v.State != "running" {
|
||||||
|
//step:start container
|
||||||
|
service.MyService.Docker().DockerContainerStart(v.CustomId)
|
||||||
|
}
|
||||||
syncIsExistence = true
|
syncIsExistence = true
|
||||||
if config.SystemConfigInfo.SyncPort != v.Port {
|
if config.SystemConfigInfo.SyncPort != v.Port {
|
||||||
config.SystemConfigInfo.SyncPort = v.Port
|
config.SystemConfigInfo.SyncPort = v.Port
|
||||||
|
@ -12,6 +12,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var swagHandler gin.HandlerFunc
|
var swagHandler gin.HandlerFunc
|
||||||
|
var OnlineDemo bool = false
|
||||||
|
|
||||||
func InitRouter() *gin.Engine {
|
func InitRouter() *gin.Engine {
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package v1
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"encoding/json"
|
||||||
json2 "encoding/json"
|
json2 "encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"reflect"
|
"reflect"
|
||||||
@ -420,6 +421,9 @@ func InstallApp(c *gin.Context) {
|
|||||||
rely := model.MapStrings{}
|
rely := model.MapStrings{}
|
||||||
|
|
||||||
copier.Copy(&rely, &relyMap)
|
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)
|
portsStr, _ := json2.Marshal(m.Ports)
|
||||||
envsStr, _ := json2.Marshal(m.Envs)
|
envsStr, _ := json2.Marshal(m.Envs)
|
||||||
volumesStr, _ := json2.Marshal(m.Volumes)
|
volumesStr, _ := json2.Marshal(m.Volumes)
|
||||||
@ -904,10 +908,16 @@ func UpdateSetting(c *gin.Context) {
|
|||||||
//如果容器端口均未修改,这不进行处理
|
//如果容器端口均未修改,这不进行处理
|
||||||
portsStr, _ := json2.Marshal(m.Ports)
|
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)
|
envsStr, _ := json2.Marshal(m.Envs)
|
||||||
volumesStr, _ := json2.Marshal(m.Volumes)
|
volumesStr, _ := json2.Marshal(m.Volumes)
|
||||||
devicesStr, _ := json2.Marshal(m.Devices)
|
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 newUUid = uuid.NewV4().String()
|
||||||
var err error
|
var err error
|
||||||
|
@ -123,6 +123,10 @@ func Up_Load_Head(c *gin.Context) {
|
|||||||
// @Success 200 {string} string "ok"
|
// @Success 200 {string} string "ok"
|
||||||
// @Router /user/changusername [put]
|
// @Router /user/changusername [put]
|
||||||
func Chang_User_Name(c *gin.Context) {
|
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")
|
oldname := c.PostForm("oldname")
|
||||||
username := c.PostForm("username")
|
username := c.PostForm("username")
|
||||||
if len(username) == 0 || config.UserInfo.UserName != oldname {
|
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)})
|
c.JSON(http.StatusOK, model.Result{Success: oasis_err2.PWD_INVALID_OLD, Message: oasis_err2.GetMsg(oasis_err2.PWD_INVALID_OLD)})
|
||||||
return
|
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 {
|
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)})
|
c.JSON(http.StatusOK, model.Result{Success: oasis_err2.PWD_IS_EMPTY, Message: oasis_err2.GetMsg(oasis_err2.PWD_IS_EMPTY)})
|
||||||
return
|
return
|
||||||
|
@ -479,15 +479,13 @@ func (ds *dockerService) DockerContainerCreate(imageName string, containerDbId s
|
|||||||
if len(m.Restart) > 0 {
|
if len(m.Restart) > 0 {
|
||||||
rp.Name = m.Restart
|
rp.Name = m.Restart
|
||||||
}
|
}
|
||||||
//fmt.Print(port)
|
|
||||||
healthTest := []string{}
|
healthTest := []string{}
|
||||||
if len(port) > 0 {
|
if len(port) > 0 {
|
||||||
healthTest = []string{"CMD-SHELL", "curl -f http://localhost:" + port + m.Index + " || exit 1"}
|
healthTest = []string{"CMD-SHELL", "curl -f http://localhost:" + port + m.Index + " || exit 1"}
|
||||||
}
|
}
|
||||||
|
|
||||||
health := &container.HealthConfig{
|
health := &container.HealthConfig{
|
||||||
Test: healthTest,
|
Test: healthTest,
|
||||||
//Test: []string{},
|
|
||||||
StartPeriod: 0,
|
StartPeriod: 0,
|
||||||
Retries: 1000,
|
Retries: 1000,
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package types
|
package types
|
||||||
|
|
||||||
const CURRENTVERSION = "0.2.1"
|
const CURRENTVERSION = "0.2.2"
|
||||||
const BODY = "<li>fixed path error</li>"
|
const BODY = "<li>ui adjustment</li><li>fixed bugs</li>"
|
||||||
|
Reference in New Issue
Block a user