Compare commits

...

8 Commits

Author SHA1 Message Date
a624669980@163.com
8d088afcc5 update system version 2022-08-25 10:50:11 +08:00
link
34f35bbf20 0.3.5 (#470)
* initial completion of the sharing function

* Adjusting multi-partition disk mounts

* Add file sharing function

* update usb auto mount shell

* update samba config

* add umount disk function

* update change log

* update usb auto mount \

* update usb auto mount

* Update periodical.go

* Update periodical.go

* resolve alpha.1 issues

* Update UI

* update usb show name

* update web

* update image version
2022-08-22 18:22:12 +08:00
link
b6f413b9e9 0.3.5 (#464)
* initial completion of the sharing function

* Adjusting multi-partition disk mounts

* Add file sharing function

* update usb auto mount shell

* update samba config

* add umount disk function

* update change log

* update usb auto mount \

* update usb auto mount

* Update periodical.go

* Update periodical.go

* resolve alpha.1 issues

* Update UI
2022-08-18 11:18:27 +08:00
John Guan
091be6d12e Update push_events_to_discord.yml 2022-08-17 15:49:44 +08:00
John Guan
aefa68d8f8 Merge branch 'main' of https://github.com/IceWhaleTech/CasaOS 2022-08-16 14:23:28 +08:00
John Guan
9aed323d8d Update push_events_to_discord.yml 2022-08-16 14:23:25 +08:00
John Guan
eba607fc53 Revert "Update push_events_to_discord.yml"
This reverts commit d064f20a04.
2022-08-15 15:52:20 +08:00
John Guan
d064f20a04 Update push_events_to_discord.yml 2022-08-15 15:46:56 +08:00
26 changed files with 616 additions and 551 deletions

View File

@@ -36,13 +36,13 @@ jobs:
webhook: ${{ secrets.Discord_CasaOS_App_Request_Webhook }} webhook: ${{ secrets.Discord_CasaOS_App_Request_Webhook }}
- name: Bug Issues & Comments - name: Bug Issues & Comments
if: ${{ ( github.event_name == 'issues' || github.event_name == 'issue_comment' ) && contains(github.event.issue.labels.*.name, 'bug') && !contains(!github.event.issue.labels.*.name, 'alpha') }} if: ${{ ( github.event_name == 'issues' || github.event_name == 'issue_comment' ) && contains(github.event.issue.labels.*.name, 'bug') && !contains(github.event.issue.labels.*.name, 'alpha') }}
uses: joseph-montanez/forward-event-action@v3.0.0 uses: joseph-montanez/forward-event-action@v3.0.0
with: with:
webhook: ${{ secrets.Discord_CasaOS_Bug_Webhook }} webhook: ${{ secrets.Discord_CasaOS_Bug_Webhook }}
- name: Alpha Issues & Comments - name: Alpha Issues & Comments
if: ${{ ( github.event_name == 'issues' || github.event_name == 'issue_comment' ) && contains(!github.event.issue.labels.*.name, 'alpha') }} if: ${{ ( github.event_name == 'issues' || github.event_name == 'issue_comment' ) && contains(github.event.issue.labels.*.name, 'alpha') }}
uses: joseph-montanez/forward-event-action@v3.0.0 uses: joseph-montanez/forward-event-action@v3.0.0
with: with:
webhook: ${{ secrets.Discord_CasaOS_Alpha_Webhook }} webhook: ${{ secrets.Discord_CasaOS_Alpha_Webhook }}

3
.gitignore vendored
View File

@@ -38,3 +38,6 @@ main
CasaOS CasaOS
github.com github.com
.all-contributorsrc .all-contributorsrc
build
dist
.goreleaser.yaml

View File

@@ -5,15 +5,18 @@ import (
"os" "os"
"strconv" "strconv"
"strings" "strings"
"time"
"github.com/IceWhaleTech/CasaOS/pkg/config" "github.com/IceWhaleTech/CasaOS/pkg/config"
"github.com/IceWhaleTech/CasaOS/pkg/samba" "github.com/IceWhaleTech/CasaOS/pkg/samba"
"github.com/IceWhaleTech/CasaOS/pkg/utils/command" "github.com/IceWhaleTech/CasaOS/pkg/utils/command"
"github.com/IceWhaleTech/CasaOS/pkg/utils/encryption" "github.com/IceWhaleTech/CasaOS/pkg/utils/encryption"
"github.com/IceWhaleTech/CasaOS/pkg/utils/file" "github.com/IceWhaleTech/CasaOS/pkg/utils/file"
"github.com/IceWhaleTech/CasaOS/pkg/utils/loger"
"github.com/IceWhaleTech/CasaOS/service" "github.com/IceWhaleTech/CasaOS/service"
model2 "github.com/IceWhaleTech/CasaOS/service/model" model2 "github.com/IceWhaleTech/CasaOS/service/model"
uuid "github.com/satori/go.uuid" uuid "github.com/satori/go.uuid"
"go.uber.org/zap"
) )
func InitFunction() { func InitFunction() {
@@ -24,7 +27,8 @@ func InitFunction() {
// Soon to be removed // Soon to be removed
ChangeAPIUrl() ChangeAPIUrl()
MoveUserToDB() MoveUserToDB()
InitNetworkMount() go InitNetworkMount()
} }
func CheckSerialDiskMount() { func CheckSerialDiskMount() {
@@ -141,12 +145,14 @@ func MoveUserToDB() {
} }
func InitNetworkMount() { func InitNetworkMount() {
time.Sleep(time.Second * 10)
connections := service.MyService.Connections().GetConnectionsList() connections := service.MyService.Connections().GetConnectionsList()
for _, v := range connections { for _, v := range connections {
connection := service.MyService.Connections().GetConnectionByID(fmt.Sprint(v.ID)) connection := service.MyService.Connections().GetConnectionByID(fmt.Sprint(v.ID))
directories, err := samba.GetSambaSharesList(connection.Host, connection.Port, connection.Username, connection.Password) directories, err := samba.GetSambaSharesList(connection.Host, connection.Port, connection.Username, connection.Password)
if err != nil { if err != nil {
service.MyService.Connections().DeleteConnection(fmt.Sprint(connection.ID)) service.MyService.Connections().DeleteConnection(fmt.Sprint(connection.ID))
loger.Error("mount samba err", zap.Any("err", err), zap.Any("info", connection))
continue continue
} }
baseHostPath := "/mnt/" + connection.Host baseHostPath := "/mnt/" + connection.Host

View File

@@ -220,7 +220,7 @@ func AppInfo(c *gin.Context) {
// sort.EnvSort(envOrder).Sort(info.Envs) // sort.EnvSort(envOrder).Sort(info.Envs)
// sort.VolSort(volOrder).Sort(info.Volumes.([]model.PathMap)) // sort.VolSort(volOrder).Sort(info.Volumes.([]model.PathMap))
// sort.DevSort(devOrder).Sort(info.Devices) // sort.DevSort(devOrder).Sort(info.Devices)
info.Image += ":" + info.ImageVersion
info.MaxMemory = (service.MyService.System().GetMemInfo()["total"]).(uint64) >> 20 info.MaxMemory = (service.MyService.System().GetMemInfo()["total"]).(uint64) >> 20
c.JSON(common_err.SUCCESS, &model.Result{Success: common_err.SUCCESS, Message: common_err.GetMsg(common_err.SUCCESS), Data: info}) c.JSON(common_err.SUCCESS, &model.Result{Success: common_err.SUCCESS, Message: common_err.GetMsg(common_err.SUCCESS), Data: info})

View File

@@ -1,7 +1,9 @@
package v1 package v1
import ( import (
"fmt"
"net/http" "net/http"
"path/filepath"
"reflect" "reflect"
"strconv" "strconv"
"strings" "strings"
@@ -209,6 +211,9 @@ func GetDisksUSBList(c *gin.Context) {
tempChildren.Size, _ = strconv.ParseUint(child.FSSize, 10, 64) tempChildren.Size, _ = strconv.ParseUint(child.FSSize, 10, 64)
tempChildren.Avail, _ = strconv.ParseUint(child.FSAvail, 10, 64) tempChildren.Avail, _ = strconv.ParseUint(child.FSAvail, 10, 64)
tempChildren.Name = child.Label tempChildren.Name = child.Label
if len(tempChildren.Name) == 0 {
tempChildren.Name = filepath.Base(child.MountPoint)
}
avail, _ := strconv.ParseUint(child.FSAvail, 10, 64) avail, _ := strconv.ParseUint(child.FSAvail, 10, 64)
children = append(children, tempChildren) children = append(children, tempChildren)
temp.Avail += avail temp.Avail += avail
@@ -255,6 +260,8 @@ func DeleteDisksUmount(c *gin.Context) {
service.MyService.Disk().UmountPointAndRemoveDir(v.Path) service.MyService.Disk().UmountPointAndRemoveDir(v.Path)
//delete data //delete data
service.MyService.Disk().DeleteMountPoint(v.Path, v.MountPoint) service.MyService.Disk().DeleteMountPoint(v.Path, v.MountPoint)
service.MyService.Shares().DeleteShareByPath(v.MountPoint)
} }
service.MyService.Disk().RemoveLSBLKCache() service.MyService.Disk().RemoveLSBLKCache()
@@ -367,7 +374,7 @@ func PostDiskAddPartition(c *gin.Context) {
js := make(map[string]interface{}) js := make(map[string]interface{})
c.ShouldBind(&js) c.ShouldBind(&js)
path := js["path"].(string) path := js["path"].(string)
//name := js["name"].(string) name := js["name"].(string)
format := js["format"].(bool) format := js["format"].(bool)
if len(path) == 0 { if len(path) == 0 {
@@ -412,10 +419,16 @@ func PostDiskAddPartition(c *gin.Context) {
// c.JSON(common_err.SERVICE_ERROR, model.Result{Success: common_err.DISK_NEEDS_FORMAT, Message: common_err.GetMsg(common_err.DISK_NEEDS_FORMAT)}) // c.JSON(common_err.SERVICE_ERROR, model.Result{Success: common_err.DISK_NEEDS_FORMAT, Message: common_err.GetMsg(common_err.DISK_NEEDS_FORMAT)})
// return // return
// } // }
fmt.Println(name)
if len(name) == 0 {
name = "Storage"
}
fmt.Println(name)
for i := 0; i < len(currentDisk.Children); i++ { for i := 0; i < len(currentDisk.Children); i++ {
childrenName := currentDisk.Children[i].Label childrenName := currentDisk.Children[i].Label
if len(childrenName) == 0 { if len(childrenName) == 0 {
childrenName = "Storage_" + currentDisk.Children[i].Name //childrenName = name + "_" + currentDisk.Children[i].Name
childrenName = name + "_" + strconv.Itoa(i+1)
} }
mountPath := "/DATA/" + childrenName mountPath := "/DATA/" + childrenName
if !file.CheckNotExist(mountPath) { if !file.CheckNotExist(mountPath) {

View File

@@ -1120,7 +1120,7 @@ func ContainerUpdateInfo(c *gin.Context) {
showENV := info.Config.Labels["show_env"] showENV := info.Config.Labels["show_env"]
showENVList := strings.Split(showENV, ",") showENVList := strings.Split(showENV, ",")
showENVMap := make(map[string]string) showENVMap := make(map[string]string)
if len(showENVList) > 0 { if len(showENVList) > 0 && showENVList[0] != "" {
for _, name := range showENVList { for _, name := range showENVList {
showENVMap[name] = "1" showENVMap[name] = "1"
} }

View File

@@ -2,7 +2,7 @@
* @Author: LinkLeong link@icewhale.com * @Author: LinkLeong link@icewhale.com
* @Date: 2022-07-26 11:08:48 * @Date: 2022-07-26 11:08:48
* @LastEditors: LinkLeong * @LastEditors: LinkLeong
* @LastEditTime: 2022-08-05 12:16:39 * @LastEditTime: 2022-08-17 18:25:42
* @FilePath: /CasaOS/route/v1/samba.go * @FilePath: /CasaOS/route/v1/samba.go
* @Description: * @Description:
* @Website: https://www.casaos.io * @Website: https://www.casaos.io
@@ -85,6 +85,7 @@ func PostSambaSharesCreate(c *gin.Context) {
shareDBModel.Anonymous = true shareDBModel.Anonymous = true
shareDBModel.Path = v.Path shareDBModel.Path = v.Path
shareDBModel.Name = filepath.Base(v.Path) shareDBModel.Name = filepath.Base(v.Path)
os.Chmod(v.Path, 0777)
service.MyService.Shares().CreateShare(shareDBModel) service.MyService.Shares().CreateShare(shareDBModel)
} }
@@ -127,8 +128,8 @@ func PostSambaConnectionsCreate(c *gin.Context) {
c.JSON(common_err.CLIENT_ERROR, model.Result{Success: common_err.INVALID_PARAMS, Message: common_err.GetMsg(common_err.INVALID_PARAMS)}) c.JSON(common_err.CLIENT_ERROR, model.Result{Success: common_err.INVALID_PARAMS, Message: common_err.GetMsg(common_err.INVALID_PARAMS)})
return return
} }
connection.Host = strings.Split(connection.Host, "/")[0]
// check is exists // check is exists
connections := service.MyService.Connections().GetConnectionByHost(connection.Host) connections := service.MyService.Connections().GetConnectionByHost(connection.Host)
if len(connections) > 0 { if len(connections) > 0 {
c.JSON(common_err.SERVICE_ERROR, model.Result{Success: common_err.Record_ALREADY_EXIST, Message: common_err.GetMsg(common_err.Record_ALREADY_EXIST), Data: common_err.GetMsg(common_err.Record_ALREADY_EXIST)}) c.JSON(common_err.SERVICE_ERROR, model.Result{Success: common_err.Record_ALREADY_EXIST, Message: common_err.GetMsg(common_err.Record_ALREADY_EXIST), Data: common_err.GetMsg(common_err.Record_ALREADY_EXIST)})

View File

@@ -2,7 +2,7 @@
* @Author: LinkLeong link@icewhale.com * @Author: LinkLeong link@icewhale.com
* @Date: 2022-07-11 16:02:29 * @Date: 2022-07-11 16:02:29
* @LastEditors: LinkLeong * @LastEditors: LinkLeong
* @LastEditTime: 2022-08-11 14:20:02 * @LastEditTime: 2022-08-17 19:14:50
* @FilePath: /CasaOS/route/v1/storage.go * @FilePath: /CasaOS/route/v1/storage.go
* @Description: * @Description:
* @Website: https://www.casaos.io * @Website: https://www.casaos.io
@@ -11,8 +11,8 @@
package v1 package v1
import ( import (
"path/filepath"
"reflect" "reflect"
"strconv"
"github.com/IceWhaleTech/CasaOS/model" "github.com/IceWhaleTech/CasaOS/model"
"github.com/IceWhaleTech/CasaOS/pkg/utils/common_err" "github.com/IceWhaleTech/CasaOS/pkg/utils/common_err"
@@ -70,7 +70,12 @@ func GetStorageList(c *gin.Context) {
stor.Type = v.FsType stor.Type = v.FsType
stor.DriveName = v.Name stor.DriveName = v.Name
if len(v.Label) == 0 { if len(v.Label) == 0 {
stor.Label = "Storage" + strconv.Itoa(diskNumber) + "_" + strconv.Itoa(children) if stor.MountPoint == "/" {
stor.Label = "System"
} else {
stor.Label = filepath.Base(stor.MountPoint)
}
children += 1 children += 1
} else { } else {
stor.Label = v.Label stor.Label = v.Label

View File

@@ -535,13 +535,14 @@ func (ds *dockerService) DockerContainerCreate(m model.CustomizationPostData, id
// info.NetworkSettings = &types.NetworkSettings{} // info.NetworkSettings = &types.NetworkSettings{}
hostConfig = info.HostConfig hostConfig = info.HostConfig
config = info.Config config = info.Config
} } else {
config.Cmd = m.Cmd config.Cmd = m.Cmd
config.Image = m.Image config.Image = m.Image
config.Env = envArr config.Env = envArr
config.Hostname = m.HostName config.Hostname = m.HostName
config.ExposedPorts = ports config.ExposedPorts = ports
}
config.Labels["origin"] = m.Origin config.Labels["origin"] = m.Origin
config.Labels["casaos"] = "casaos" config.Labels["casaos"] = "casaos"
config.Labels["web"] = m.PortMap config.Labels["web"] = m.PortMap

View File

@@ -1,3 +1,13 @@
/*
* @Author: LinkLeong link@icewhale.org
* @Date: 2021-12-07 17:14:41
* @LastEditors: LinkLeong
* @LastEditTime: 2022-08-17 18:46:43
* @FilePath: /CasaOS/service/model/o_disk.go
* @Description:
* @Website: https://www.casaos.io
* Copyright (c) 2022 by icewhale, All Rights Reserved.
*/
package model package model
//SerialAdvanced Technology Attachment (STAT) //SerialAdvanced Technology Attachment (STAT)

View File

@@ -2,7 +2,7 @@
* @Author: LinkLeong link@icewhale.org * @Author: LinkLeong link@icewhale.org
* @Date: 2022-07-26 11:21:14 * @Date: 2022-07-26 11:21:14
* @LastEditors: LinkLeong * @LastEditors: LinkLeong
* @LastEditTime: 2022-08-11 14:04:00 * @LastEditTime: 2022-08-18 11:16:25
* @FilePath: /CasaOS/service/shares.go * @FilePath: /CasaOS/service/shares.go
* @Description: * @Description:
* @Website: https://www.casaos.io * @Website: https://www.casaos.io
@@ -30,12 +30,18 @@ type SharesService interface {
DeleteShare(id string) DeleteShare(id string)
UpdateConfigFile() UpdateConfigFile()
InitSambaConfig() InitSambaConfig()
DeleteShareByPath(path string)
} }
type sharesStruct struct { type sharesStruct struct {
db *gorm.DB db *gorm.DB
} }
func (s *sharesStruct) DeleteShareByPath(path string) {
s.db.Where("path LIKE ?", path+"%").Delete(&model.SharesDBModel{})
s.UpdateConfigFile()
}
func (s *sharesStruct) GetSharesByName(name string) (shares []model2.SharesDBModel) { func (s *sharesStruct) GetSharesByName(name string) (shares []model2.SharesDBModel) {
s.db.Select("anonymous,path,id").Where("name = ?", name).Find(&shares) s.db.Select("anonymous,path,id").Where("name = ?", name).Find(&shares)

View File

@@ -2,7 +2,7 @@
* @Author: LinkLeong link@icewhale.com * @Author: LinkLeong link@icewhale.com
* @Date: 2022-02-17 18:53:22 * @Date: 2022-02-17 18:53:22
* @LastEditors: LinkLeong * @LastEditors: LinkLeong
* @LastEditTime: 2022-08-10 13:50:57 * @LastEditTime: 2022-08-25 10:49:46
* @FilePath: /CasaOS/types/system.go * @FilePath: /CasaOS/types/system.go
* @Description: * @Description:
* @Website: https://www.casaos.io * @Website: https://www.casaos.io
@@ -10,6 +10,6 @@
*/ */
package types package types
const CURRENTVERSION = "0.3.5" const CURRENTVERSION = "0.3.5.1"
const BODY = " " const BODY = " "

View File

@@ -20,7 +20,7 @@
<title> <title>
CasaOS CasaOS
</title> </title>
<link href="/ui/css/13.a16d5119.css" rel="prefetch"><link href="/ui/css/14.cf8c898a.css" rel="prefetch"><link href="/ui/css/4.f17f9b01.css" rel="prefetch"><link href="/ui/css/5.e8438f80.css" rel="prefetch"><link href="/ui/css/6.d72d6157.css" rel="prefetch"><link href="/ui/css/7.805596b0.css" rel="prefetch"><link href="/ui/css/8.92188e4d.css" rel="prefetch"><link href="/ui/css/9.dccf29b4.css" rel="prefetch"><link href="/ui/js/0.js" rel="prefetch"><link href="/ui/js/1.js" rel="prefetch"><link href="/ui/js/10.js" rel="prefetch"><link href="/ui/js/11.js" rel="prefetch"><link href="/ui/js/12.js" rel="prefetch"><link href="/ui/js/13.js" rel="prefetch"><link href="/ui/js/14.js" rel="prefetch"><link href="/ui/js/15.js" rel="prefetch"><link href="/ui/js/2.js" rel="prefetch"><link href="/ui/js/3.js" rel="prefetch"><link href="/ui/js/4.js" rel="prefetch"><link href="/ui/js/5.js" rel="prefetch"><link href="/ui/js/6.js" rel="prefetch"><link href="/ui/js/7.js" rel="prefetch"><link href="/ui/js/8.js" rel="prefetch"><link href="/ui/js/9.js" rel="prefetch"><link href="/ui/css/app.c78d232d.css" rel="preload" as="style"><link href="/ui/css/vendors~app.c42f9a2b.css" rel="preload" as="style"><link href="/ui/js/app.js" rel="preload" as="script"><link href="/ui/js/vendors~app.js" rel="preload" as="script"><link href="/ui/css/vendors~app.c42f9a2b.css" rel="stylesheet"><link href="/ui/css/app.c78d232d.css" rel="stylesheet"></head> <link href="/ui/css/13.3244968c.css" rel="prefetch"><link href="/ui/css/14.edf73182.css" rel="prefetch"><link href="/ui/css/4.0b84e87b.css" rel="prefetch"><link href="/ui/css/5.b9bdfac7.css" rel="prefetch"><link href="/ui/css/6.c3a0b3d4.css" rel="prefetch"><link href="/ui/css/7.fdbd0ee0.css" rel="prefetch"><link href="/ui/css/8.d53635ba.css" rel="prefetch"><link href="/ui/css/9.b2f820da.css" rel="prefetch"><link href="/ui/js/0.js" rel="prefetch"><link href="/ui/js/1.js" rel="prefetch"><link href="/ui/js/10.js" rel="prefetch"><link href="/ui/js/11.js" rel="prefetch"><link href="/ui/js/12.js" rel="prefetch"><link href="/ui/js/13.js" rel="prefetch"><link href="/ui/js/14.js" rel="prefetch"><link href="/ui/js/15.js" rel="prefetch"><link href="/ui/js/2.js" rel="prefetch"><link href="/ui/js/3.js" rel="prefetch"><link href="/ui/js/4.js" rel="prefetch"><link href="/ui/js/5.js" rel="prefetch"><link href="/ui/js/6.js" rel="prefetch"><link href="/ui/js/7.js" rel="prefetch"><link href="/ui/js/8.js" rel="prefetch"><link href="/ui/js/9.js" rel="prefetch"><link href="/ui/css/app.274cdf77.css" rel="preload" as="style"><link href="/ui/css/vendors~app.a44f2742.css" rel="preload" as="style"><link href="/ui/js/app.js" rel="preload" as="script"><link href="/ui/js/vendors~app.js" rel="preload" as="script"><link href="/ui/css/vendors~app.a44f2742.css" rel="stylesheet"><link href="/ui/css/app.274cdf77.css" rel="stylesheet"></head>
<body> <body>
<noscript> <noscript>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long