Compare commits

...

5 Commits

Author SHA1 Message Date
link
46e146e633 Fix the download file name error problem (#896) 2023-02-15 17:31:20 +08:00
link
1a2f917b30 Exception handling when adding a mount to the same device (#890) 2023-02-13 19:42:34 +08:00
link
86adfbaef8 Updated demo snapshot (#889) 2023-02-13 18:58:21 +08:00
link
143af78745 Add 0.4.2 changelog (#885) 2023-02-10 19:11:36 +08:00
link
7b07f22685 Fix sharing failure issue (#884) 2023-02-10 17:27:13 +08:00
9 changed files with 51 additions and 19 deletions

View File

@@ -33,7 +33,7 @@ jobs:
- name: Get old instance and snapshot name, create new instance name
run: |
echo "OLD_INSTANCE_SNAPSHOT_NAME=$(aws lightsail get-instance-snapshots | grep '"name": "casaos-0.3.6-1666150291' | sed 's/ //g' | sed 's/"//g' | sed 's/,//g' | sed 's/name://g')" >> $GITHUB_ENV
echo "OLD_INSTANCE_SNAPSHOT_NAME=$(aws lightsail get-instance-snapshots | grep '"name": "updateto_to_0.4.1-1676285322' | sed 's/ //g' | sed 's/"//g' | sed 's/,//g' | sed 's/name://g')" >> $GITHUB_ENV
echo "OLD_INSTANCE_NAME=$(aws lightsail get-instances | grep '"name": "CasaOS-Demo-[0-9]' | sed 's/ //g' | sed 's/"//g' | sed 's/,//g' | sed 's/name://g')" >> $GITHUB_ENV
echo "NEW_INSTANCE_NAME=CasaOS-Demo-$(date +%s)" >> $GITHUB_ENV

View File

@@ -17,6 +17,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Security
## [0.4.2]
### Added
- [App] Increase the display of progress during the installation process
- [App] Label whether the current app supports x86 or Pi devices
- [App] Support single app version upgrade
- [File] Support mounting of Google Drive and Dropbox cloud drives
- [System] Support Mint Linux
### Changed
- [File] Optimize the download speed of a single file
### Fixed
- [Share] Fix the samba permission issue
- [Disk] Fix the problem of disk mount point plus 1 after upgrade ([#770](https://github.com/IceWhaleTech/CasaOS/issues/770))
- [File] Fix the problem of file permission change caused by modifying files in casaos ([#829](https://github.com/IceWhaleTech/CasaOS/issues/829))
- [Share] Fix the problem of files being deleted due to samba uninstallation failure ([#843](https://github.com/IceWhaleTech/CasaOS/issues/843))
## [0.4.1] - 2023-1-19

View File

@@ -17,12 +17,14 @@ type MountList struct {
MountPoint string `json:"MountPoint"`
Fs string `json:"Fs"`
Icon string `json:"Icon"`
Name string `json:"Name"`
} `json:"mountPoints"`
}
type MountPoint struct {
MountPoint string `json:"mount_point"`
Fs string `json:"fs"`
Icon string `json:"icon"`
Name string `json:"name"`
}
type MountResult struct {
Error string `json:"error"`
@@ -77,6 +79,7 @@ func Mount(mountPoint string, fs string) error {
res, err := NewRestyClient().R().SetFormData(map[string]string{
"mountPoint": mountPoint,
"fs": fs,
"mountOpt": `{"AllowOther": true}`,
}).Post("/mount/mount")
if err != nil {
return err

View File

@@ -323,6 +323,7 @@ func DirPath(c *gin.Context) {
t.IsDir = info[i].IsDir
t.Name = info[i].Name
t.Modified = info[i].Date
t.Date = info[i].Date
t.Size = info[i].Size
t.Path = info[i].Path
t.Extensions = info[i].Extensions

View File

@@ -25,6 +25,7 @@ type ObjResp struct {
Thumb string `json:"thumb"`
Type int `json:"type"`
Path string `json:"path"`
Date time.Time `json:"date"`
Extensions map[string]interface{} `json:"extensions"`
}
type FsListResp struct {

View File

@@ -1,13 +1,13 @@
package v1
import (
"strconv"
"strings"
"time"
"github.com/IceWhaleTech/CasaOS-Common/utils/logger"
"github.com/IceWhaleTech/CasaOS/drivers/dropbox"
"github.com/IceWhaleTech/CasaOS/drivers/google_drive"
fileutil "github.com/IceWhaleTech/CasaOS/pkg/utils/file"
"github.com/IceWhaleTech/CasaOS/service"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
@@ -71,7 +71,10 @@ func GetRecoverStorage(c *gin.Context) {
}
if cf["type"] == "drive" && cf["username"] == dmap["username"] {
c.String(200, `<p>The same configuration has been added</p><script>window.close()</script>`)
service.MyService.Storage().CheckAndMountByName(cf["username"])
err := service.MyService.Storage().CheckAndMountByName(v)
if err != nil {
logger.Error("check and mount by name error: ", zap.Error(err), zap.Any("name", cf["username"]))
}
notify["status"] = "warn"
notify["message"] = "The same configuration has been added"
service.MyService.Notify().SendNotify("casaos:file:recover", notify)
@@ -82,13 +85,10 @@ func GetRecoverStorage(c *gin.Context) {
a := strings.Split(username, "@")
username = a[0]
}
username = fileutil.NameAccumulation(username, "/mnt")
dataMap, _ := service.MyService.Storage().GetConfigByName(username)
if len(dataMap) > 0 {
service.MyService.Storage().UnmountStorage("/mnt/" + username)
service.MyService.Storage().DeleteConfigByName(username)
}
//username = fileutil.NameAccumulation(username, "/mnt")
username += "_google_drive_" + strconv.FormatInt(time.Now().Unix(), 10)
dmap["client_id"] = add.ClientID
dmap["client_secret"] = add.ClientSecret
dmap["scope"] = "drive"
@@ -150,7 +150,11 @@ func GetRecoverStorage(c *gin.Context) {
}
if cf["type"] == "dropbox" && cf["username"] == dmap["username"] {
c.String(200, `<p>The same configuration has been added</p><script>window.close()</script>`)
service.MyService.Storage().CheckAndMountByName(cf["username"])
err := service.MyService.Storage().CheckAndMountByName(v)
if err != nil {
logger.Error("check and mount by name error: ", zap.Error(err), zap.Any("name", cf["username"]))
}
notify["status"] = "warn"
notify["message"] = "The same configuration has been added"
service.MyService.Notify().SendNotify("casaos:file:recover", notify)
@@ -161,13 +165,7 @@ func GetRecoverStorage(c *gin.Context) {
a := strings.Split(username, "@")
username = a[0]
}
username = fileutil.NameAccumulation(username, "/mnt")
dataMap, _ := service.MyService.Storage().GetConfigByName(username)
if len(dataMap) > 0 {
service.MyService.Storage().UnmountStorage("/mnt/" + username)
service.MyService.Storage().DeleteConfigByName(username)
}
username += "_dropbox_" + strconv.FormatInt(time.Now().Unix(), 10)
dmap["client_id"] = add.AppKey
dmap["client_secret"] = add.AppSecret

View File

@@ -52,6 +52,7 @@ func ListStorages(c *gin.Context) {
if dataMap["type"] == "dropbox" {
r.MountPoints[i].Icon = dropbox.ICONURL
}
r.MountPoints[i].Name = dataMap["username"]
}
list := []httper.MountPoint{}
@@ -60,6 +61,7 @@ func ListStorages(c *gin.Context) {
Fs: v.Fs,
Icon: v.Icon,
MountPoint: v.MountPoint,
Name: v.Name,
})
}

View File

@@ -4,6 +4,7 @@ import (
"log"
"net/http"
"net/url"
"path"
"path/filepath"
"strconv"
"strings"
@@ -138,8 +139,10 @@ func InitV2DocRouter(docHTML string, docYAML string) http.Handler {
}
func InitFile() http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
path := r.URL.Query().Get("path")
http.ServeFile(w, r, path)
filePath := r.URL.Query().Get("path")
fileName := path.Base(filePath)
w.Header().Add("Content-Disposition", "attachment; filename*=utf-8''"+url.PathEscape(fileName))
http.ServeFile(w, r, filePath)
})
}

View File

@@ -97,6 +97,7 @@ func (s *storageStruct) CheckAndMountAll() error {
}
return nil
}
func (s *storageStruct) GetConfigByName(name string) (map[string]string, error) {
return httper.GetConfigByName(name)
}