Compare commits

...

4 Commits

Author SHA1 Message Date
link
9ca57e105e Merge pull request #38 from IceWhaleTech/dev
add uninstall.sh
2021-12-01 02:50:01 -06:00
link
2651140095 add uninstall.sh 2021-12-01 16:48:38 +08:00
link
14175bc438 Merge pull request #37 from IceWhaleTech/dev
fixed bug
2021-12-01 02:39:22 -06:00
link
956328da86 fixed bug 2021-12-01 16:25:56 +08:00
10 changed files with 41 additions and 11 deletions

View File

@@ -35,6 +35,12 @@ or
curl -fsSL https://get.icewhale.io/casaos.sh | bash
```
### Uninstall CasaOS
```sh
curl -fsSL https://get.icewhale.io/casaos-uninstall.sh | bash
```
### System Compatibility
- Ubuntu Server 20.04 amd64 (✅ Recommend, Tested)

2
UI

Submodule UI updated: a74be104eb...f7c46d7379

View File

@@ -20,9 +20,10 @@ type UserModel struct {
//服务配置
type ServerModel struct {
HttpPort string
RunMode string
ServerApi string
HttpPort string
RunMode string
ServerApi string
LockAccount bool
}
//服务配置

View File

@@ -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",

View File

@@ -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" {
//stepstart container
service.MyService.Docker().DockerContainerStart(v.CustomId)
}
syncIsExistence = true
if config.SystemConfigInfo.SyncPort != v.Port {
config.SystemConfigInfo.SyncPort = v.Port

View File

@@ -12,6 +12,7 @@ import (
)
var swagHandler gin.HandlerFunc
var OnlineDemo bool = false
func InitRouter() *gin.Engine {

View File

@@ -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

View File

@@ -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

View File

@@ -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,
}

View File

@@ -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>"