mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +01:00
🎨 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:
parent
0386bc9ebd
commit
6ee4705e2a
27 changed files with 408 additions and 32 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue