commit
14175bc438
9 changed files with 35 additions and 11 deletions
2
UI
2
UI
|
@ -1 +1 @@
|
|||
Subproject commit a74be104eb5173eb1933d5e7e7a2364f6f1890de
|
||||
Subproject commit f7c46d7379ab31bc70a35900ef6a50f7f3c2ef4f
|
|
@ -20,9 +20,10 @@ type UserModel struct {
|
|||
|
||||
//服务配置
|
||||
type ServerModel struct {
|
||||
HttpPort string
|
||||
RunMode string
|
||||
ServerApi string
|
||||
HttpPort string
|
||||
RunMode string
|
||||
ServerApi string
|
||||
LockAccount bool
|
||||
}
|
||||
|
||||
//服务配置
|
||||
|
|
|
@ -11,6 +11,7 @@ const (
|
|||
PWD_IS_EMPTY = 10002
|
||||
|
||||
PWD_INVALID_OLD = 10003
|
||||
ACCOUNT_LOCK = 10004
|
||||
//system
|
||||
DIR_ALREADY_EXISTS = 20001
|
||||
FILE_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",
|
||||
|
||||
//system
|
||||
DIR_ALREADY_EXISTS: "Directory already exists",
|
||||
|
|
|
@ -96,7 +96,7 @@ func installSyncthing(appId string) {
|
|||
m.Origin = "system"
|
||||
m.PortMap = appInfo.PortMap
|
||||
m.Ports = appInfo.Ports
|
||||
m.Restart = ""
|
||||
m.Restart = "always"
|
||||
m.Volumes = appInfo.Volumes
|
||||
|
||||
containerId, 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 = true
|
||||
if config.SystemConfigInfo.SyncPort != v.Port {
|
||||
config.SystemConfigInfo.SyncPort = v.Port
|
||||
|
|
|
@ -12,6 +12,7 @@ import (
|
|||
)
|
||||
|
||||
var swagHandler gin.HandlerFunc
|
||||
var OnlineDemo bool = false
|
||||
|
||||
func InitRouter() *gin.Engine {
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package v1
|
|||
|
||||
import (
|
||||
"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 error
|
||||
|
|
|
@ -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)})
|
||||
return
|
||||
|
|
|
@ -479,15 +479,13 @@ func (ds *dockerService) DockerContainerCreate(imageName string, containerDbId s
|
|||
if 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,
|
||||
}
|
||||
|
|
|
@ -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>"
|
||||
|
|
Loading…
Reference in a new issue