An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: Support configuration of cloud provider connectivity check URL https://github.com/siyuan-note/siyuan/issues/7805
Liang Ding0f912cf1b352
diff --git a/kernel/conf/sync.go b/kernel/conf/sync.goindex da28993935..952509143a 100644--- a/kernel/conf/sync.go+++ b/kernel/conf/sync.go@@ -56,7 +56,7 @@ type WebDAV struct {Password string `json:"password"` // 密码SkipTlsVerify bool `json:"skipTlsVerify"` // 是否跳过 TLS 验证Timeout int `json:"timeout"` // 超时时间,单位:秒- CheckURL string `json:"checkUrl"` // 连通性检查 URL // https://github.com/siyuan-note/siyuan/issues/7805+ CheckURL string `json:"checkURL"` // 连通性检查 URL // https://github.com/siyuan-note/siyuan/issues/7805}const (@@ -66,5 +66,5 @@ const ()func NewSyncProviderCheckURL() string {- return "https://www.baidu.com https://icanhazip.com https://api.ipify.org"+ return "https://www.baidu.com"}diff --git a/kernel/model/conf.go b/kernel/model/conf.goindex 774787a8e2..4035198c0b 100644--- a/kernel/model/conf.go+++ b/kernel/model/conf.go@@ -268,7 +268,8 @@ func InitConf() {}Conf.Sync.S3.Endpoint = util.NormalizeEndpoint(Conf.Sync.S3.Endpoint)Conf.Sync.S3.Timeout = util.NormalizeTimeout(Conf.Sync.S3.Timeout)- if "" == strings.TrimSpace(Conf.Sync.S3.CheckURL) {+ Conf.Sync.S3.CheckURL = util.NormalizeCheckURL(Conf.Sync.S3.CheckURL)+ if "" == Conf.Sync.S3.CheckURL {Conf.Sync.S3.CheckURL = conf.NewSyncProviderCheckURL()}if nil == Conf.Sync.WebDAV {@@ -276,7 +277,8 @@ func InitConf() {}Conf.Sync.WebDAV.Endpoint = util.NormalizeEndpoint(Conf.Sync.WebDAV.Endpoint)Conf.Sync.WebDAV.Timeout = util.NormalizeTimeout(Conf.Sync.WebDAV.Timeout)- if "" == strings.TrimSpace(Conf.Sync.WebDAV.CheckURL) {+ Conf.Sync.WebDAV.CheckURL = util.NormalizeCheckURL(Conf.Sync.WebDAV.CheckURL)+ if "" == Conf.Sync.WebDAV.CheckURL {Conf.Sync.WebDAV.CheckURL = conf.NewSyncProviderCheckURL()}diff --git a/kernel/util/net.go b/kernel/util/net.goindex 377e014425..742c1c24fb 100644--- a/kernel/util/net.go+++ b/kernel/util/net.go@@ -18,6 +18,7 @@ package utilimport ("net/http"+ "net/url""strings""time"@@ -82,6 +83,11 @@ func InvalidIDPattern(idArg string, result *gulu.Result) bool {return true}+func IsValidURL(str string) bool {+ _, err := url.Parse(str)+ return nil == err+}+func initHttpClient() {http.DefaultClient = httpclient.GetCloudFileClient2Min()http.DefaultTransport = httpclient.NewTransport(false)diff --git a/kernel/util/path.go b/kernel/util/path.goindex 106afd7933..b6c2d679ea 100644--- a/kernel/util/path.go+++ b/kernel/util/path.go@@ -156,6 +156,20 @@ func NormalizeEndpoint(endpoint string) string {return endpoint}+func NormalizeCheckURL(checkURL string) string {+ checkURL = strings.TrimSpace(checkURL)+ if "" == checkURL {+ return ""+ }+ if !strings.HasPrefix(checkURL, "http://") && !strings.HasPrefix(checkURL, "https://") {+ checkURL = "http://" + checkURL+ }+ if !IsValidURL(checkURL) {+ return ""+ }+ return checkURL+}+func FilterMoveDocFromPaths(fromPaths []string, toPath string) (ret []string) {tmp := FilterSelfChildDocs(fromPaths)for _, fromPath := range tmp {