Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
hexbee
Cloudreve
提交
16613a61
C
Cloudreve
项目概览
hexbee
/
Cloudreve
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
Cloudreve
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
16613a61
编写于
2月 07, 2020
作者:
H
HFO4
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Modify: return parent folder id while listing objects
上级
4c530a26
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
30 addition
and
36 deletion
+30
-36
models/group.go
models/group.go
+0
-13
models/group_test.go
models/group_test.go
+0
-16
models/migration.go
models/migration.go
+0
-2
pkg/filesystem/driver/cos/handller.go
pkg/filesystem/driver/cos/handller.go
+1
-0
pkg/filesystem/driver/onedrive/handller.go
pkg/filesystem/driver/onedrive/handller.go
+2
-0
pkg/filesystem/driver/oss/handller.go
pkg/filesystem/driver/oss/handller.go
+1
-0
pkg/filesystem/driver/qiniu/handller.go
pkg/filesystem/driver/qiniu/handller.go
+1
-0
pkg/filesystem/driver/remote/handler.go
pkg/filesystem/driver/remote/handler.go
+2
-0
pkg/filesystem/driver/upyun/handller.go
pkg/filesystem/driver/upyun/handller.go
+1
-0
pkg/filesystem/manage.go
pkg/filesystem/manage.go
+1
-0
pkg/serializer/user.go
pkg/serializer/user.go
+3
-3
service/explorer/directory.go
service/explorer/directory.go
+9
-1
service/share/visit.go
service/share/visit.go
+9
-1
未找到文件。
models/group.go
浏览文件 @
16613a61
...
...
@@ -13,7 +13,6 @@ type Group struct {
MaxStorage
uint64
ShareEnabled
bool
WebDAVEnabled
bool
Aria2Option
string
Color
string
SpeedLimit
int
Options
string
`json:"-",gorm:"type:text"`
...
...
@@ -36,18 +35,6 @@ type GroupOption struct {
Aria2Options
[]
interface
{}
`json:"aria2_options,omitempty"`
// 离线下载用户组配置
}
// GetAria2Option 获取用户离线下载设备
func
(
group
*
Group
)
GetAria2Option
()
[
3
]
bool
{
if
len
(
group
.
Aria2Option
)
!=
5
{
return
[
3
]
bool
{
false
,
false
,
false
}
}
return
[
3
]
bool
{
group
.
Aria2Option
[
0
]
==
'1'
,
group
.
Aria2Option
[
2
]
==
'1'
,
group
.
Aria2Option
[
4
]
==
'1'
,
}
}
// GetGroupByID 用ID获取用户组
func
GetGroupByID
(
ID
interface
{})
(
Group
,
error
)
{
var
group
Group
...
...
models/group_test.go
浏览文件 @
16613a61
...
...
@@ -63,22 +63,6 @@ func TestGroup_AfterFind(t *testing.T) {
asserts
.
Equal
(
testCase
.
PolicyList
,
[]
uint
{})
}
func
TestGroup_GetAria2Option
(
t
*
testing
.
T
)
{
asserts
:=
assert
.
New
(
t
)
group
:=
Group
{}
// 格式错误
{
group
.
Aria2Option
=
"123"
asserts
.
Equal
([
3
]
bool
{
false
,
false
,
false
},
group
.
GetAria2Option
())
}
// 正常
{
group
.
Aria2Option
=
"1,1,0"
asserts
.
Equal
([
3
]
bool
{
true
,
true
,
false
},
group
.
GetAria2Option
())
}
}
func
TestGroup_BeforeSave
(
t
*
testing
.
T
)
{
asserts
:=
assert
.
New
(
t
)
group
:=
Group
{
...
...
models/migration.go
浏览文件 @
16613a61
...
...
@@ -188,7 +188,6 @@ func addDefaultGroups() {
ShareEnabled
:
true
,
Color
:
"danger"
,
WebDAVEnabled
:
true
,
Aria2Option
:
"0,0,0"
,
OptionsSerialized
:
GroupOption
{
ArchiveDownload
:
true
,
ArchiveTask
:
true
,
...
...
@@ -211,7 +210,6 @@ func addDefaultGroups() {
ShareEnabled
:
true
,
Color
:
"danger"
,
WebDAVEnabled
:
true
,
Aria2Option
:
"0,0,0"
,
}
if
err
:=
DB
.
Create
(
&
defaultAdminGroup
)
.
Error
;
err
!=
nil
{
util
.
Log
()
.
Panic
(
"无法创建初始注册会员用户组, %s"
,
err
)
...
...
pkg/filesystem/driver/cos/handller.go
浏览文件 @
16613a61
...
...
@@ -67,6 +67,7 @@ func (handler Driver) Get(ctx context.Context, path string) (response.RSCloser,
downloadURL
,
nil
,
request
.
WithContext
(
ctx
),
request
.
WithTimeout
(
time
.
Duration
(
0
)),
)
.
CheckHTTPResponse
(
200
)
.
GetRSCloser
()
if
err
!=
nil
{
return
nil
,
err
...
...
pkg/filesystem/driver/onedrive/handller.go
浏览文件 @
16613a61
...
...
@@ -10,6 +10,7 @@ import (
"github.com/HFO4/cloudreve/pkg/serializer"
"io"
"net/url"
"time"
)
// Driver OneDrive 适配器
...
...
@@ -40,6 +41,7 @@ func (handler Driver) Get(ctx context.Context, path string) (response.RSCloser,
downloadURL
,
nil
,
request
.
WithContext
(
ctx
),
request
.
WithTimeout
(
time
.
Duration
(
0
)),
)
.
CheckHTTPResponse
(
200
)
.
GetRSCloser
()
if
err
!=
nil
{
return
nil
,
err
...
...
pkg/filesystem/driver/oss/handller.go
浏览文件 @
16613a61
...
...
@@ -99,6 +99,7 @@ func (handler Driver) Get(ctx context.Context, path string) (response.RSCloser,
downloadURL
,
nil
,
request
.
WithContext
(
ctx
),
request
.
WithTimeout
(
time
.
Duration
(
0
)),
)
.
CheckHTTPResponse
(
200
)
.
GetRSCloser
()
if
err
!=
nil
{
return
nil
,
err
...
...
pkg/filesystem/driver/qiniu/handller.go
浏览文件 @
16613a61
...
...
@@ -50,6 +50,7 @@ func (handler Driver) Get(ctx context.Context, path string) (response.RSCloser,
request
.
WithHeader
(
http
.
Header
{
"Cache-Control"
:
{
"no-cache"
,
"no-store"
,
"must-revalidate"
}},
),
request
.
WithTimeout
(
time
.
Duration
(
0
)),
)
.
CheckHTTPResponse
(
200
)
.
GetRSCloser
()
if
err
!=
nil
{
return
nil
,
err
...
...
pkg/filesystem/driver/remote/handler.go
浏览文件 @
16613a61
...
...
@@ -17,6 +17,7 @@ import (
"net/url"
"path"
"strings"
"time"
)
// Driver 远程存储策略适配器
...
...
@@ -70,6 +71,7 @@ func (handler Driver) Get(ctx context.Context, path string) (response.RSCloser,
downloadURL
,
nil
,
request
.
WithContext
(
ctx
),
request
.
WithTimeout
(
time
.
Duration
(
0
)),
)
.
CheckHTTPResponse
(
200
)
.
GetRSCloser
()
if
err
!=
nil
{
return
nil
,
err
...
...
pkg/filesystem/driver/upyun/handller.go
浏览文件 @
16613a61
...
...
@@ -68,6 +68,7 @@ func (handler Driver) Get(ctx context.Context, path string) (response.RSCloser,
request
.
WithHeader
(
http
.
Header
{
"Cache-Control"
:
{
"no-cache"
,
"no-store"
,
"must-revalidate"
}},
),
request
.
WithTimeout
(
time
.
Duration
(
0
)),
)
.
CheckHTTPResponse
(
200
)
.
GetRSCloser
()
if
err
!=
nil
{
return
nil
,
err
...
...
pkg/filesystem/manage.go
浏览文件 @
16613a61
...
...
@@ -257,6 +257,7 @@ func (fs *FileSystem) List(ctx context.Context, dirPath string, pathProcessor fu
if
!
isExist
{
return
[]
Object
{},
nil
}
fs
.
SetTargetDir
(
&
[]
model
.
Folder
{
*
folder
})
var
parentPath
=
path
.
Join
(
folder
.
Position
,
folder
.
Name
)
var
childFolders
[]
model
.
Folder
...
...
pkg/serializer/user.go
浏览文件 @
16613a61
...
...
@@ -44,6 +44,7 @@ type group struct {
AllowArchiveDownload
bool
`json:"allowArchiveDownload"`
ShareFreeEnabled
bool
`json:"shareFree"`
ShareDownload
bool
`json:"shareDownload"`
CompressEnabled
bool
`json:"compress"`
}
type
storage
struct
{
...
...
@@ -54,7 +55,6 @@ type storage struct {
// BuildUser 序列化用户
func
BuildUser
(
user
model
.
User
)
User
{
aria2Option
:=
user
.
Group
.
GetAria2Option
()
return
User
{
ID
:
user
.
ID
,
Email
:
user
.
Email
,
...
...
@@ -75,11 +75,11 @@ func BuildUser(user model.User) User {
ID
:
user
.
GroupID
,
Name
:
user
.
Group
.
Name
,
AllowShare
:
user
.
Group
.
ShareEnabled
,
AllowRemoteDownload
:
aria2Option
[
0
],
AllowTorrentDownload
:
aria2Option
[
2
],
AllowRemoteDownload
:
user
.
Group
.
OptionsSerialized
.
Aria2
,
AllowArchiveDownload
:
user
.
Group
.
OptionsSerialized
.
ArchiveDownload
,
ShareFreeEnabled
:
user
.
Group
.
OptionsSerialized
.
ShareFree
,
ShareDownload
:
user
.
Group
.
OptionsSerialized
.
ShareDownload
,
CompressEnabled
:
user
.
Group
.
OptionsSerialized
.
ArchiveTask
,
},
}
}
...
...
service/explorer/directory.go
浏览文件 @
16613a61
...
...
@@ -31,9 +31,17 @@ func (service *DirectoryService) ListDirectory(c *gin.Context) serializer.Respon
return
serializer
.
Err
(
serializer
.
CodeCreateFolderFailed
,
err
.
Error
(),
err
)
}
var
parentID
uint
if
len
(
fs
.
DirTarget
)
>
0
{
parentID
=
fs
.
DirTarget
[
0
]
.
ID
}
return
serializer
.
Response
{
Code
:
0
,
Data
:
objects
,
Data
:
map
[
string
]
interface
{}{
"parent"
:
parentID
,
"objects"
:
objects
,
},
}
}
...
...
service/share/visit.go
浏览文件 @
16613a61
...
...
@@ -215,9 +215,17 @@ func (service *Service) List(c *gin.Context) serializer.Response {
return
serializer
.
Err
(
serializer
.
CodeCreateFolderFailed
,
err
.
Error
(),
err
)
}
var
parentID
uint
if
len
(
fs
.
DirTarget
)
>
0
{
parentID
=
fs
.
DirTarget
[
0
]
.
ID
}
return
serializer
.
Response
{
Code
:
0
,
Data
:
objects
,
Data
:
map
[
string
]
interface
{}{
"parent"
:
parentID
,
"objects"
:
objects
,
},
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录