🎨 Support local file system sync & backup (#13663)

* 🎨 Use local file system sync & backup

* ⬆️ dejavu

* 🎨 Add the settings panel of local file system sync & backup

* 📝 Update user guides of local file system sync & backup

* 🎨 Adjust supported runtime environments
This commit is contained in:
Yingyi / 颖逸 2024-12-31 21:06:13 +08:00 committed by GitHub
parent 0386bc9ebd
commit 6ee4705e2a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
27 changed files with 408 additions and 32 deletions

View file

@ -188,16 +188,39 @@ func GetChildDocDepth(treeAbsPath string) (ret int) {
}
func NormalizeConcurrentReqs(concurrentReqs int, provider int) int {
if 1 > concurrentReqs {
if 2 == provider { // S3
return 8
} else if 3 == provider { // WebDAV
return 1
switch provider {
case 0: // SiYuan
switch {
case concurrentReqs < 1:
concurrentReqs = 8
case concurrentReqs > 16:
concurrentReqs = 16
default:
}
case 2: // S3
switch {
case concurrentReqs < 1:
concurrentReqs = 8
case concurrentReqs > 16:
concurrentReqs = 16
default:
}
case 3: // WebDAV
switch {
case concurrentReqs < 1:
concurrentReqs = 1
case concurrentReqs > 16:
concurrentReqs = 16
default:
}
case 4: // Local File System
switch {
case concurrentReqs < 1:
concurrentReqs = 16
case concurrentReqs > 1024:
concurrentReqs = 1024
default:
}
return 8
}
if 16 < concurrentReqs {
return 16
}
return concurrentReqs
}
@ -229,6 +252,18 @@ func NormalizeEndpoint(endpoint string) string {
return endpoint
}
func NormalizeLocalPath(endpoint string) string {
endpoint = strings.TrimSpace(endpoint)
if "" == endpoint {
return ""
}
endpoint = filepath.ToSlash(filepath.Clean(endpoint))
if !strings.HasSuffix(endpoint, "/") {
endpoint = endpoint + "/"
}
return endpoint
}
func FilterMoveDocFromPaths(fromPaths []string, toPath string) (ret []string) {
tmp := FilterSelfChildDocs(fromPaths)
for _, fromPath := range tmp {