mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 23:20:13 +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
|
|
@ -20,6 +20,7 @@ import (
|
|||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
|
@ -73,14 +74,19 @@ func IsLocalOrigin(origin string) bool {
|
|||
}
|
||||
|
||||
func IsOnline(checkURL string, skipTlsVerify bool, timeout int) bool {
|
||||
_, err := url.Parse(checkURL)
|
||||
if "" == checkURL {
|
||||
return false
|
||||
}
|
||||
|
||||
u, err := url.Parse(checkURL)
|
||||
if err != nil {
|
||||
logging.LogWarnf("invalid check URL [%s]", checkURL)
|
||||
return false
|
||||
}
|
||||
|
||||
if "" == checkURL {
|
||||
return false
|
||||
if u.Scheme == "file" {
|
||||
filePath := strings.TrimPrefix(checkURL, "file://")
|
||||
_, err := os.Stat(filePath)
|
||||
return err == nil
|
||||
}
|
||||
|
||||
if isOnline(checkURL, skipTlsVerify, timeout) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue