Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Plugins should be reloaded after the data sync https://github.com/siyuan-note/siyuan/issues/10203

Danieldb690c51b671
diff --git a/kernel/model/repository.go b/kernel/model/repository.go
index 8f987d4421..5b9d824c64 100644
--- a/kernel/model/repository.go
+++ b/kernel/model/repository.go
@@ -1374,14 +1374,15 @@ func processSyncMergeResult(exit, byHand bool, mergeResult *dejavu.MergeResult,
// 有数据变更,需要重建索引
var upserts, removes []string
var upsertTrees int
- var needReloadFlashcard, needReloadOcrTexts, needReloadFiletree bool
+ // 可能需要重新加载部分功能
+ var needReloadFlashcard, needReloadOcrTexts, needReloadFiletree, needReloadPlugin bool
for _, file := range mergeResult.Upserts {
upserts = append(upserts, file.Path)
if strings.HasPrefix(file.Path, "/storage/riff/") {
needReloadFlashcard = true
}
- if strings.HasPrefix(file.Path, "/data/assets/ocr-texts.json") {
+ if strings.HasPrefix(file.Path, "/assets/ocr-texts.json") {
needReloadOcrTexts = true
}
@@ -1389,6 +1390,10 @@ func processSyncMergeResult(exit, byHand bool, mergeResult *dejavu.MergeResult,
needReloadFiletree = true
}
+ if strings.HasPrefix(file.Path, "/storage/petal/") {
+ needReloadPlugin = true
+ }
+
if strings.HasSuffix(file.Path, ".sy") {
upsertTrees++
}
@@ -1399,13 +1404,17 @@ func processSyncMergeResult(exit, byHand bool, mergeResult *dejavu.MergeResult,
needReloadFlashcard = true
}
- if strings.HasPrefix(file.Path, "/data/assets/ocr-texts.json") {
+ if strings.HasPrefix(file.Path, "/assets/ocr-texts.json") {
needReloadOcrTexts = true
}
if strings.HasSuffix(file.Path, "/.siyuan/conf.json") {
needReloadFiletree = true
}
+
+ if strings.HasPrefix(file.Path, "/storage/petal/") {
+ needReloadPlugin = true
+ }
}
if needReloadFlashcard {
@@ -1416,6 +1425,10 @@ func processSyncMergeResult(exit, byHand bool, mergeResult *dejavu.MergeResult,
LoadAssetsTexts()
}
+ if needReloadPlugin {
+ pushReloadPlugin()
+ }
+
syncingFiles = sync.Map{}
syncingStorages.Store(false)
@@ -1951,3 +1964,7 @@ func getCloudSpace() (stat *cloud.Stat, err error) {
}
return
}
+
+func pushReloadPlugin() {
+ util.BroadcastByType("main", "reloadPlugin", 0, "", nil)
+}