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: S3/WebDAV 数据同步支持设置跳过 HTTPS 证书验证 Fix https://github.com/siyuan-note/siyuan/issues/6609
Liang Dingad3f7d89641a
diff --git a/app/src/config/repos.ts b/app/src/config/repos.tsindex 7ee5ac459c..a6db061ebe 100644--- a/app/src/config/repos.ts+++ b/app/src/config/repos.ts@@ -77,6 +77,14 @@ const renderProvider = (provider: number) => {<option ${window.siyuan.config.sync.s3.pathStyle ? "" : "selected"} value="false">Virtual-hosted-style</option><option ${window.siyuan.config.sync.s3.pathStyle ? "selected" : ""} value="true">Path-style</option></select>+</div>+<div class="b3-label b3-label--noborder">+ <div>TLS verify</div>+ <div class="fn__hr"></div>+ <select class="b3-select fn__block" id="s3SkipTlsVerify">+ <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></div>`;}return `${tip}@@ -112,6 +120,14 @@ const renderProvider = (provider: number) => {<option ${window.siyuan.config.sync.s3.pathStyle ? "" : "selected"} value="false">Virtual-hosted-style</option><option ${window.siyuan.config.sync.s3.pathStyle ? "selected" : ""} value="true">Path-style</option></select>+</label>+<label class="b3-label b3-label--noborder fn__flex">+ <div class="fn__flex-center fn__size200">TLS Verify</div>+ <div class="fn__space"></div>+ <select class="b3-select fn__flex-1" id="s3SkipTlsVerify">+ <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>`;} else if (provider === 3) {const tip = `<div class="b3-label b3-label--inner">@@ -137,6 +153,14 @@ const renderProvider = (provider: number) => {<div>Password</div><div class="fn__hr"></div><input id="password" class="b3-text-field fn__block" value="${window.siyuan.config.sync.webdav.password}">+</div>+<div class="b3-label b3-label--noborder">+ <div>TLS verify</div>+ <div class="fn__hr"></div>+ <select class="b3-select fn__block" id="webdavSkipTlsVerify">+ <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></div>`;}return `${tip}@@ -154,6 +178,14 @@ const renderProvider = (provider: number) => {<div class="fn__flex-center fn__size200">Password</div><div class="fn__space"></div><input id="password" class="b3-text-field fn__flex-1" value="${window.siyuan.config.sync.webdav.password}">+</label>+<label class="b3-label b3-label--noborder fn__flex">+ <div class="fn__flex-center fn__size200">TLS Verify</div>+ <div class="fn__space"></div>+ <select class="b3-select fn__flex-1" id="webdavSkipTlsVerify">+ <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>`;}return "";@@ -222,6 +254,7 @@ const bindProviderEvent = () => {bucket: (providerPanelElement.querySelector("#bucket") as HTMLInputElement).value,pathStyle: (providerPanelElement.querySelector("#pathStyle") as HTMLInputElement).value === "true",region: (providerPanelElement.querySelector("#region") as HTMLInputElement).value,+ skipTlsVerify: (providerPanelElement.querySelector("#s3SkipTlsVerify") as HTMLInputElement).value === "true",};fetchPost("/api/sync/setSyncProviderS3", {s3}, () => {window.siyuan.config.sync.s3 = s3;@@ -231,6 +264,7 @@ const bindProviderEvent = () => {endpoint: (providerPanelElement.querySelector("#endpoint") as HTMLInputElement).value,username: (providerPanelElement.querySelector("#username") as HTMLInputElement).value,password: (providerPanelElement.querySelector("#password") as HTMLInputElement).value,+ skipTlsVerify: (providerPanelElement.querySelector("#webdavSkipTlsVerify") as HTMLInputElement).value === "true",};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 9f5c2ea150..554faa45e5 100644--- a/app/src/types/index.d.ts+++ b/app/src/types/index.d.ts@@ -340,11 +340,13 @@ declare interface IConfig {secretKey: stringbucket: stringregion: string+ skipTlsVerify: boolean}webdav: {endpoint: stringusername: stringpassword: string+ skipTlsVerify: boolean}},lang: stringdiff --git a/kernel/go.mod b/kernel/go.modindex 8f8de19b34..a998cab6d2 100644--- a/kernel/go.mod+++ b/kernel/go.mod@@ -36,7 +36,7 @@ require (github.com/panjf2000/ants/v2 v2.6.0github.com/patrickmn/go-cache v2.1.0+incompatiblegithub.com/radovskyb/watcher v1.0.7- github.com/siyuan-note/dejavu v0.0.0-20221116031102-5d5af638b8e5+ github.com/siyuan-note/dejavu v0.0.0-20221116103627-5fbf73fe103egithub.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75github.com/siyuan-note/eventbus v0.0.0-20220916025349-3ac6e75522dagithub.com/siyuan-note/filelock v0.0.0-20221007163134-7e64809023efdiff --git a/kernel/go.sum b/kernel/go.sumindex 7fcc2e2e70..b9bdab187e 100644--- a/kernel/go.sum+++ b/kernel/go.sum@@ -359,8 +359,8 @@ github.com/shurcooL/reactions v0.0.0-20181006231557-f2e0b4ca5b82/go.mod h1:TCR1lgithub.com/shurcooL/sanitized_anchor_name v0.0.0-20170918181015-86672fcb3f95/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=github.com/shurcooL/users v0.0.0-20180125191416-49c67e49c537/go.mod h1:QJTqeLYEDaXHZDBsXlPCDqdhQuJkuw4NOtaxYe3xii4=github.com/shurcooL/webdavfs v0.0.0-20170829043945-18c3829fa133/go.mod h1:hKmq5kWdCj2z2KEozexVbfEZIWiTjhE0+UjmZgPqehw=-github.com/siyuan-note/dejavu v0.0.0-20221116031102-5d5af638b8e5 h1:m4+9OWYEKS832LJ9E1eAiUz0ATQAUo7gFs7E5S9JSho=-github.com/siyuan-note/dejavu v0.0.0-20221116031102-5d5af638b8e5/go.mod h1:PiWhnZhdVqhY0FifDg6kXwn75V97Dg3U/nFeD76fBis=+github.com/siyuan-note/dejavu v0.0.0-20221116103627-5fbf73fe103e h1:gwI3Zo+ce5GPZlau8kMcUipZwY1yJFjeG8ghwxB6YW4=+github.com/siyuan-note/dejavu v0.0.0-20221116103627-5fbf73fe103e/go.mod h1:PiWhnZhdVqhY0FifDg6kXwn75V97Dg3U/nFeD76fBis=github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75 h1:Bi7/7f29LW+Fm0cHc0J1NO1cZqyJwljSWVmfOqVZgaE=github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75/go.mod h1:H8fyqqAbp9XreANjeSbc72zEdFfKTXYN34tc1TjZwtw=github.com/siyuan-note/eventbus v0.0.0-20220916025349-3ac6e75522da h1:/jNhl7LC+9BhkWvNxuJDdsNfA/2wvfuj9mqWx4CbV90=diff --git a/kernel/model/repository.go b/kernel/model/repository.goindex e35f5b1a6c..9ff57f12fa 100644--- a/kernel/model/repository.go+++ b/kernel/model/repository.go@@ -828,7 +828,7 @@ func newRepository() (ret *dejavu.Repo, err error) {s3HTTPClient.Timeout = 30 * time.SecondcloudRepo = cloud.NewS3(&cloud.BaseCloud{Conf: cloudConf}, s3HTTPClient)case conf.ProviderWebDAV:- webdavClient := gowebdav.NewClient(cloudConf.Endpoint, cloudConf.WebDAV.Username, cloudConf.WebDAV.Password)+ webdavClient := gowebdav.NewClient(cloudConf.WebDAV.Endpoint, cloudConf.WebDAV.Username, cloudConf.WebDAV.Password)a := cloudConf.WebDAV.Username + ":" + cloudConf.WebDAV.Passwordauth := "Basic " + base64.StdEncoding.EncodeToString([]byte(a))webdavClient.SetHeader("Authorization", auth)@@ -1049,18 +1049,22 @@ func buildCloudConf() (ret *cloud.Conf, err error) {case conf.ProviderSiYuan:ret.Endpoint = "https://siyuan-data.b3logfile.com/"case conf.ProviderS3:- ret.Endpoint = Conf.Sync.S3.Endpoint- ret.S3.AccessKey = Conf.Sync.S3.AccessKey- ret.S3.SecretKey = Conf.Sync.S3.SecretKey- ret.S3.Bucket = Conf.Sync.S3.Bucket- ret.S3.Region = Conf.Sync.S3.Region- ret.S3.PathStyle = Conf.Sync.S3.PathStyle- ret.S3.SkipTlsVerify = Conf.Sync.S3.SkipTlsVerify+ ret.S3 = &cloud.ConfS3{+ Endpoint: Conf.Sync.S3.Endpoint,+ AccessKey: Conf.Sync.S3.AccessKey,+ SecretKey: Conf.Sync.S3.SecretKey,+ Bucket: Conf.Sync.S3.Bucket,+ Region: Conf.Sync.S3.Region,+ PathStyle: Conf.Sync.S3.PathStyle,+ SkipTlsVerify: Conf.Sync.S3.SkipTlsVerify,+ }case conf.ProviderWebDAV:- ret.Endpoint = Conf.Sync.WebDAV.Endpoint- ret.WebDAV.Username = Conf.Sync.WebDAV.Username- ret.WebDAV.Password = Conf.Sync.WebDAV.Password- ret.WebDAV.SkipTlsVerify = Conf.Sync.WebDAV.SkipTlsVerify+ ret.WebDAV = &cloud.ConfWebDAV{+ Endpoint: Conf.Sync.WebDAV.Endpoint,+ Username: Conf.Sync.WebDAV.Username,+ Password: Conf.Sync.WebDAV.Password,+ SkipTlsVerify: Conf.Sync.WebDAV.SkipTlsVerify,+ }default:err = fmt.Errorf("invalid provider [%d]", Conf.Sync.Provider)return