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 Ding98d2d7587d7f
diff --git a/app/src/config/repos.ts b/app/src/config/repos.tsindex 26ae55ae56..da0384c74f 100644--- a/app/src/config/repos.ts+++ b/app/src/config/repos.ts@@ -93,6 +93,11 @@ const renderProvider = (provider: number) => {<option ${window.siyuan.config.sync.s3.skipTlsVerify ? "" : "selected"} value="false">Verify</option><option ${window.siyuan.config.sync.s3.skipTlsVerify ? "selected" : ""} value="true">Skip</option></select>+</label>+<label class="b3-label b3-label--noborder fn__flex config__item">+ <div class="fn__flex-center fn__size200">Connectivity Check URL</div>+ <div class="fn__space"></div>+ <input id="checkURL" class="b3-text-field fn__block" value="${window.siyuan.config.sync.s3.checkURL}"></label>`;} else if (provider === 3) {const tip = `<div class="b3-label b3-label--inner">@@ -133,6 +138,11 @@ const renderProvider = (provider: number) => {<option ${window.siyuan.config.sync.webdav.skipTlsVerify ? "" : "selected"} value="false">Verify</option><option ${window.siyuan.config.sync.webdav.skipTlsVerify ? "selected" : ""} value="true">Skip</option></select>+</label>+<label class="b3-label b3-label--noborder fn__flex config__item">+ <div class="fn__flex-center fn__size200">Connectivity Check URL</div>+ <div class="fn__space"></div>+ <input id="checkURL" class="b3-text-field fn__block" value="${window.siyuan.config.sync.webdav.checkURL}"></label>`;}return "";@@ -217,6 +227,7 @@ const bindProviderEvent = () => {region: (providerPanelElement.querySelector("#region") as HTMLInputElement).value,skipTlsVerify: (providerPanelElement.querySelector("#s3SkipTlsVerify") as HTMLInputElement).value === "true",timeout: timeout,+ checkURL: (providerPanelElement.querySelector("#checkURL") as HTMLInputElement).value,};fetchPost("/api/sync/setSyncProviderS3", {s3}, () => {window.siyuan.config.sync.s3 = s3;@@ -236,6 +247,7 @@ const bindProviderEvent = () => {password: (providerPanelElement.querySelector("#password") as HTMLInputElement).value,skipTlsVerify: (providerPanelElement.querySelector("#webdavSkipTlsVerify") as HTMLInputElement).value === "true",timeout: timeout,+ checkURL: (providerPanelElement.querySelector("#checkURL") as HTMLInputElement).value,};fetchPost("/api/sync/setSyncProviderWebDAV", {webdav}, () => {window.siyuan.config.sync.webdav = webdav;diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.tsindex d038c73f32..3bdabd4054 100644--- a/app/src/types/index.d.ts+++ b/app/src/types/index.d.ts@@ -433,6 +433,7 @@ declare interface IConfig {region: stringskipTlsVerify: booleantimeout: number+ checkURL: string}webdav: {endpoint: string@@ -440,6 +441,7 @@ declare interface IConfig {password: stringskipTlsVerify: booleantimeout: number+ checkURL: string}},lang: stringdiff --git a/kernel/conf/sync.go b/kernel/conf/sync.goindex bf80edf79e..da28993935 100644--- a/kernel/conf/sync.go+++ b/kernel/conf/sync.go@@ -47,6 +47,7 @@ type S3 struct {PathStyle bool `json:"pathStyle"` // 是否使用路径风格SkipTlsVerify bool `json:"skipTlsVerify"` // 是否跳过 TLS 验证Timeout int `json:"timeout"` // 超时时间,单位:秒+ CheckURL string `json:"checkURL"` // 连通性检查 URL // https://github.com/siyuan-note/siyuan/issues/7805}type WebDAV struct {@@ -55,6 +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}const (@@ -62,3 +64,7 @@ const (ProviderS3 = 2 // ProviderS3 为 S3 协议对象存储提供的云端存储服务ProviderWebDAV = 3 // ProviderWebDAV 为 WebDAV 协议提供的云端存储服务)++func NewSyncProviderCheckURL() string {+ return "https://www.baidu.com https://icanhazip.com https://api.ipify.org"+}diff --git a/kernel/model/conf.go b/kernel/model/conf.goindex f62182955e..774787a8e2 100644--- a/kernel/model/conf.go+++ b/kernel/model/conf.go@@ -268,11 +268,17 @@ 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 = conf.NewSyncProviderCheckURL()+ }if nil == Conf.Sync.WebDAV {Conf.Sync.WebDAV = &conf.WebDAV{}}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 = conf.NewSyncProviderCheckURL()+ }if nil == Conf.Api {Conf.Api = conf.NewAPI()@@ -297,7 +303,7 @@ func InitConf() {if 0 > Conf.Editor.BacklinkExpandCount {Conf.Editor.BacklinkExpandCount = 0}- if 0> Conf.Editor.BackmentionExpandCount {+ if 0 > Conf.Editor.BackmentionExpandCount {Conf.Editor.BackmentionExpandCount = 0}diff --git a/kernel/model/sync.go b/kernel/model/sync.goindex 1d570c1aab..e1ae9ea39b 100644--- a/kernel/model/sync.go+++ b/kernel/model/sync.go@@ -365,6 +365,10 @@ func SetSyncProviderS3(s3 *conf.S3) (err error) {s3.Bucket = strings.TrimSpace(s3.Bucket)s3.Region = strings.TrimSpace(s3.Region)s3.Timeout = util.NormalizeTimeout(s3.Timeout)+ s3.CheckURL = strings.TrimSpace(s3.CheckURL)+ if "" == s3.CheckURL {+ s3.CheckURL = conf.NewSyncProviderCheckURL()+ }Conf.Sync.S3 = s3Conf.Save()@@ -384,6 +388,10 @@ func SetSyncProviderWebDAV(webdav *conf.WebDAV) (err error) {webdav.Username = strings.TrimSpace(webdav.Username)webdav.Password = strings.TrimSpace(webdav.Password)webdav.Timeout = util.NormalizeTimeout(webdav.Timeout)+ webdav.CheckURL = strings.TrimSpace(webdav.CheckURL)+ if "" == webdav.CheckURL {+ webdav.CheckURL = conf.NewSyncProviderCheckURL()+ }Conf.Sync.WebDAV = webdavConf.Save()