mirror of
https://github.com/OpenListTeam/OpenList.git
synced 2026-05-06 23:31:59 +08:00
feat(alias): support load balance (#1767)
* feat(alias): support load balance
* feat(alias): support storage match for load balance
* feat(patch): add alias addition upgrade patch
* fix bugs
* fix(op/balance): optimize compatibility
* chore: change default read conflict policy
* feat(alias): refactor Alias initialization and enhance path handling
* feat(alias): enhance object masking and add support for operation restrictions
* feat(alias): enhance object masking
* feat(fs): add permission checks
* improve parsing
* update object masks
* feat(fs): enhance virtual file handling
* feat(storage): enhance virtual file retrieval and path handling
* refactor(alias): rename path handling functions for clarity and consistency
* fix(alias): update path handling in Other method to use balanced path
* fix bug
* feat(alias): add file size validation
* feat(alias): add hash consistency check
* 移除哈希合并,
* fix(alias): wrong behavior for all_strict/deterministic_or_all
* Revert "fix(alias): wrong behavior for all_strict/deterministic_or_all"
This reverts commit f001f2dcd7.
* fix(alias): wrong behavior for all_strict/deterministic_or_all
* feat(alias): support part-based read load balance
* fix(alias): list panic when leak conflict path
* fix(alias): remove Other load balance
* fix(alias): 修复 Link 方法中 resultLink 的返回类型和内容复制问题
* fix(alias): 更好的下载并发?
* chore(alias): all tips
* fix(alias): moving paths mismatch
---------
Co-authored-by: j2rong4cn <j2rong@qq.com>
Co-authored-by: ShenLin <773933146@qq.com>
This commit is contained in:
@@ -136,7 +136,6 @@ func (d *Crypt) List(ctx context.Context, dir model.Obj, args model.ListArgs) ([
|
||||
if !d.ShowHidden && strings.HasPrefix(name, ".") {
|
||||
continue
|
||||
}
|
||||
mask &^= model.Temp
|
||||
objRes := &model.Object{
|
||||
Path: stdpath.Join(remoteFullPath, obj.GetName()),
|
||||
Name: name,
|
||||
@@ -144,10 +143,11 @@ func (d *Crypt) List(ctx context.Context, dir model.Obj, args model.ListArgs) ([
|
||||
Modified: obj.ModTime(),
|
||||
IsFolder: obj.IsDir(),
|
||||
Ctime: obj.CreateTime(),
|
||||
Mask: mask &^ model.Temp,
|
||||
// discarding hash as it's encrypted
|
||||
}
|
||||
if !d.Thumbnail || !strings.HasPrefix(args.ReqPath, "/") {
|
||||
result = append(result, model.ObjAddMask(objRes, mask))
|
||||
result = append(result, objRes)
|
||||
continue
|
||||
}
|
||||
thumbPath := stdpath.Join(args.ReqPath, ".thumbnails", name+".webp")
|
||||
@@ -155,12 +155,12 @@ func (d *Crypt) List(ctx context.Context, dir model.Obj, args model.ListArgs) ([
|
||||
common.GetApiUrl(ctx),
|
||||
utils.EncodePath(thumbPath, true),
|
||||
sign.Sign(thumbPath))
|
||||
result = append(result, model.ObjAddMask(&model.ObjThumb{
|
||||
result = append(result, &model.ObjThumb{
|
||||
Object: *objRes,
|
||||
Thumbnail: model.Thumbnail{
|
||||
Thumbnail: thumb,
|
||||
},
|
||||
}, mask))
|
||||
})
|
||||
}
|
||||
|
||||
return result, nil
|
||||
@@ -196,8 +196,7 @@ func (d *Crypt) Get(ctx context.Context, path string) (model.Obj, error) {
|
||||
|
||||
size := remoteObj.GetSize()
|
||||
name := remoteObj.GetName()
|
||||
mask := model.GetObjMask(remoteObj)
|
||||
mask &^= model.Temp
|
||||
mask := model.GetObjMask(remoteObj) &^ model.Temp
|
||||
if mask&model.Virtual == 0 {
|
||||
if !remoteObj.IsDir() {
|
||||
decryptedSize, err := d.cipher.DecryptedSize(size)
|
||||
@@ -221,15 +220,15 @@ func (d *Crypt) Get(ctx context.Context, path string) (model.Obj, error) {
|
||||
}
|
||||
}
|
||||
}
|
||||
obj := &model.Object{
|
||||
return &model.Object{
|
||||
Path: remoteFullPath,
|
||||
Name: name,
|
||||
Size: size,
|
||||
Modified: remoteObj.ModTime(),
|
||||
IsFolder: remoteObj.IsDir(),
|
||||
Ctime: remoteObj.CreateTime(),
|
||||
}
|
||||
return model.ObjAddMask(obj, mask), nil
|
||||
Mask: mask,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// https://github.com/rclone/rclone/blob/v1.67.0/backend/crypt/cipher.go#L37
|
||||
|
||||
Reference in New Issue
Block a user