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: 开源云端同步服务实现 https://github.com/siyuan-note/siyuan/issues/6445
Liang Ding46cec73e2a37
diff --git a/kernel/go.mod b/kernel/go.modindex ab15c4f7ae..409cebcb45 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-20221102102630-25556844ddab+ github.com/siyuan-note/dejavu v0.0.0-20221102120909-ed9ad2509c64github.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 32093fa62c..82305d8e34 100644--- a/kernel/go.sum+++ b/kernel/go.sum@@ -353,10 +353,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-20221102101918-9258bfd2c7ca h1:yxlwyy/GxuzIBhTadAxjXNGAJYc3yrTjX8Yqq1SlVg4=-github.com/siyuan-note/dejavu v0.0.0-20221102101918-9258bfd2c7ca/go.mod h1:+U86jfsvpacZBThE3Ouf/ZQ4EsB4jGPJsMO2iuRv0LQ=-github.com/siyuan-note/dejavu v0.0.0-20221102102630-25556844ddab h1:pQJRm7GFp7DS3kCqlGVLq5T1jnIVNwOytbkr1BjByvY=-github.com/siyuan-note/dejavu v0.0.0-20221102102630-25556844ddab/go.mod h1:+U86jfsvpacZBThE3Ouf/ZQ4EsB4jGPJsMO2iuRv0LQ=+github.com/siyuan-note/dejavu v0.0.0-20221102120909-ed9ad2509c64 h1:psY8hXz/t7cwqJFR+6+vebb5s3P1AzqfkaJ+gIQGLjw=+github.com/siyuan-note/dejavu v0.0.0-20221102120909-ed9ad2509c64/go.mod h1:+U86jfsvpacZBThE3Ouf/ZQ4EsB4jGPJsMO2iuRv0LQ=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 ce536dc532..84da789514 100644--- a/kernel/model/repository.go+++ b/kernel/model/repository.go@@ -1009,7 +1009,7 @@ func subscribeEvents() {}func buildCloudConf() (ret *cloud.Conf, err error) {- if !IsValidCloudDirName(Conf.Sync.CloudName) {+ if !cloud.IsValidCloudDirName(Conf.Sync.CloudName) {logging.LogWarnf("invalid cloud repo name, rename it to [main]")Conf.Sync.CloudName = "main"Conf.Save()diff --git a/kernel/model/sync.go b/kernel/model/sync.goindex f035e87cad..eb578ec888 100644--- a/kernel/model/sync.go+++ b/kernel/model/sync.go@@ -25,7 +25,6 @@ import ("strings""sync""time"- "unicode/utf8""github.com/88250/gulu""github.com/dustin/go-humanize"@@ -70,7 +69,7 @@ func BootSyncData() {util.IncBootProgress(3, "Syncing data from the cloud...")BootSyncSucc = 0- if !IsSubscriber() || !Conf.Sync.Enabled || "" == Conf.Sync.CloudName || !IsValidCloudDirName(Conf.Sync.CloudName) {+ if !IsSubscriber() || !Conf.Sync.Enabled || "" == Conf.Sync.CloudName || !cloud.IsValidCloudDirName(Conf.Sync.CloudName) {return}@@ -135,7 +134,7 @@ func SyncData(boot, exit, byHand bool) {return}- if !IsValidCloudDirName(Conf.Sync.CloudName) {+ if !cloud.IsValidCloudDirName(Conf.Sync.CloudName) {return}@@ -297,7 +296,7 @@ func CreateCloudSyncDir(name string) (err error) {name = strings.TrimSpace(name)name = gulu.Str.RemoveInvisible(name)- if !IsValidCloudDirName(name) {+ if !cloud.IsValidCloudDirName(name) {return errors.New(Conf.Language(37))}@@ -405,24 +404,6 @@ func formatErrorMsg(err error) string {return msg}-func IsValidCloudDirName(cloudDirName string) bool {- if 16 < utf8.RuneCountInString(cloudDirName) || 1 > utf8.RuneCountInString(cloudDirName) {- return false- }-- chars := []byte{'~', '`', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '+', '=',- '[', ']', '{', '}', '\\', '|', ';', ':', '\'', '"', '<', ',', '>', '.', '?', '/', ' '}- var charsStr string- for _, char := range chars {- charsStr += string(char)- }-- if strings.ContainsAny(cloudDirName, charsStr) {- return false- }- return true-}-func getIgnoreLines() (ret []string) {ignore := filepath.Join(util.DataDir, ".siyuan", "syncignore")err := os.MkdirAll(filepath.Dir(ignore), 0755)