Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Vanessa 2022-11-02 15:42:03 +08:00
commit 067da5f54b
4 changed files with 19 additions and 19 deletions

View File

@ -23,8 +23,8 @@ type Sync struct {
Synced int64 `json:"synced"` // 最近同步时间 Synced int64 `json:"synced"` // 最近同步时间
Stat string `json:"stat"` // 最近同步统计信息 Stat string `json:"stat"` // 最近同步统计信息
GenerateConflictDoc bool `json:"generateConflictDoc"` // 云端同步冲突时是否生成冲突文档 GenerateConflictDoc bool `json:"generateConflictDoc"` // 云端同步冲突时是否生成冲突文档
Provider int `json:"provider"` // 云端存储服务提供者0思源官方1S3 协议对象存储服务 Provider int `json:"provider"` // 云端存储服务提供者0思源官方1第三方对象存储服务
S3 *S3 `json:"s3"` // S3 协议对象存储服务配置 OSS *OSS `json:"oss"` // 对象存储服务配置
} }
func NewSync() *Sync { func NewSync() *Sync {
@ -37,10 +37,10 @@ func NewSync() *Sync {
} }
} }
type S3 struct { type OSS struct {
Endpoint string // 服务端点 Endpoint string `json:"endpoint"` // 服务端点
AccessKey string // Access Key AccessKey string `json:"accessKey"` // Access Key
SecretKey string // Secret Key SecretKey string `json:"secretKey"` // Secret Key
Regin string // 存储区域 Regin string `json:"regin"` // 存储区域
Bucket string // 存储空间 Bucket string `json:"bucket"` // 存储空间
} }

View File

@ -36,7 +36,7 @@ require (
github.com/panjf2000/ants/v2 v2.6.0 github.com/panjf2000/ants/v2 v2.6.0
github.com/patrickmn/go-cache v2.1.0+incompatible github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/radovskyb/watcher v1.0.7 github.com/radovskyb/watcher v1.0.7
github.com/siyuan-note/dejavu v0.0.0-20221102002421-8e07eac1b233 github.com/siyuan-note/dejavu v0.0.0-20221102025652-e55edc4ad90c
github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75 github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75
github.com/siyuan-note/eventbus v0.0.0-20220916025349-3ac6e75522da github.com/siyuan-note/eventbus v0.0.0-20220916025349-3ac6e75522da
github.com/siyuan-note/filelock v0.0.0-20221007163134-7e64809023ef github.com/siyuan-note/filelock v0.0.0-20221007163134-7e64809023ef

View File

@ -353,8 +353,8 @@ github.com/shurcooL/reactions v0.0.0-20181006231557-f2e0b4ca5b82/go.mod h1:TCR1l
github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/shurcooL/users v0.0.0-20180125191416-49c67e49c537/go.mod h1:QJTqeLYEDaXHZDBsXlPCDqdhQuJkuw4NOtaxYe3xii4= github.com/shurcooL/users v0.0.0-20180125191416-49c67e49c537/go.mod h1:QJTqeLYEDaXHZDBsXlPCDqdhQuJkuw4NOtaxYe3xii4=
github.com/shurcooL/webdavfs v0.0.0-20170829043945-18c3829fa133/go.mod h1:hKmq5kWdCj2z2KEozexVbfEZIWiTjhE0+UjmZgPqehw= github.com/shurcooL/webdavfs v0.0.0-20170829043945-18c3829fa133/go.mod h1:hKmq5kWdCj2z2KEozexVbfEZIWiTjhE0+UjmZgPqehw=
github.com/siyuan-note/dejavu v0.0.0-20221102002421-8e07eac1b233 h1:SNKbf8fHsXkbIcERHYKeORSVBvMSXgirxXC8f0mN0mU= github.com/siyuan-note/dejavu v0.0.0-20221102025652-e55edc4ad90c h1:E+vDe5m9l3VD+Id7p3ELDSHjk/BH6u7woCILIdXEEJ0=
github.com/siyuan-note/dejavu v0.0.0-20221102002421-8e07eac1b233/go.mod h1:+U86jfsvpacZBThE3Ouf/ZQ4EsB4jGPJsMO2iuRv0LQ= github.com/siyuan-note/dejavu v0.0.0-20221102025652-e55edc4ad90c/go.mod h1:+U86jfsvpacZBThE3Ouf/ZQ4EsB4jGPJsMO2iuRv0LQ=
github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75 h1:Bi7/7f29LW+Fm0cHc0J1NO1cZqyJwljSWVmfOqVZgaE= github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75 h1:Bi7/7f29LW+Fm0cHc0J1NO1cZqyJwljSWVmfOqVZgaE=
github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75/go.mod h1:H8fyqqAbp9XreANjeSbc72zEdFfKTXYN34tc1TjZwtw= github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75/go.mod h1:H8fyqqAbp9XreANjeSbc72zEdFfKTXYN34tc1TjZwtw=
github.com/siyuan-note/eventbus v0.0.0-20220916025349-3ac6e75522da h1:/jNhl7LC+9BhkWvNxuJDdsNfA/2wvfuj9mqWx4CbV90= github.com/siyuan-note/eventbus v0.0.0-20220916025349-3ac6e75522da h1:/jNhl7LC+9BhkWvNxuJDdsNfA/2wvfuj9mqWx4CbV90=

View File

@ -343,7 +343,7 @@ func RemoveCloudSyncDir(name string) (err error) {
func ListCloudSyncDir() (syncDirs []*Sync, hSize string, err error) { func ListCloudSyncDir() (syncDirs []*Sync, hSize string, err error) {
syncDirs = []*Sync{} syncDirs = []*Sync{}
var dirs []map[string]interface{} var dirs []*cloud.Repo
var size int64 var size int64
repo, err := newRepository() repo, err := newRepository()
@ -357,20 +357,20 @@ func ListCloudSyncDir() (syncDirs []*Sync, hSize string, err error) {
return return
} }
if 1 > len(dirs) { if 1 > len(dirs) {
dirs = append(dirs, map[string]interface{}{ dirs = append(dirs, &cloud.Repo{
"name": "main", Name: "main",
"size": float64(0), Size: 0,
"updated": time.Now().Format("2006-01-02 15:04:05"), Updated: time.Now().Format("2006-01-02 15:04:05"),
}) })
} }
for _, d := range dirs { for _, d := range dirs {
dirSize := int64(d["size"].(float64)) dirSize := d.Size
syncDirs = append(syncDirs, &Sync{ syncDirs = append(syncDirs, &Sync{
Size: dirSize, Size: dirSize,
HSize: humanize.Bytes(uint64(dirSize)), HSize: humanize.Bytes(uint64(dirSize)),
Updated: d["updated"].(string), Updated: d.Updated,
CloudName: d["name"].(string), CloudName: d.Name,
}) })
} }
hSize = humanize.Bytes(uint64(size)) hSize = humanize.Bytes(uint64(size))