|
@@ -41,6 +41,7 @@ import (
|
|
"github.com/88250/lute/html"
|
|
"github.com/88250/lute/html"
|
|
"github.com/88250/lute/parse"
|
|
"github.com/88250/lute/parse"
|
|
"github.com/88250/lute/render"
|
|
"github.com/88250/lute/render"
|
|
|
|
+ "github.com/emirpasic/gods/sets/hashset"
|
|
"github.com/siyuan-note/dejavu"
|
|
"github.com/siyuan-note/dejavu"
|
|
"github.com/siyuan-note/dejavu/cloud"
|
|
"github.com/siyuan-note/dejavu/cloud"
|
|
"github.com/siyuan-note/dejavu/entity"
|
|
"github.com/siyuan-note/dejavu/entity"
|
|
@@ -1427,6 +1428,8 @@ func processSyncMergeResult(exit, byHand bool, mergeResult *dejavu.MergeResult,
|
|
upsertTrees++
|
|
upsertTrees++
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ clearWidgetsDir := hashset.New()
|
|
for _, file := range mergeResult.Removes {
|
|
for _, file := range mergeResult.Removes {
|
|
removes = append(removes, file.Path)
|
|
removes = append(removes, file.Path)
|
|
if strings.HasPrefix(file.Path, "/storage/riff/") {
|
|
if strings.HasPrefix(file.Path, "/storage/riff/") {
|
|
@@ -1444,6 +1447,12 @@ func processSyncMergeResult(exit, byHand bool, mergeResult *dejavu.MergeResult,
|
|
if strings.HasPrefix(file.Path, "/storage/petal/") {
|
|
if strings.HasPrefix(file.Path, "/storage/petal/") {
|
|
needReloadPlugin = true
|
|
needReloadPlugin = true
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if strings.HasPrefix(file.Path, "/widgets/") {
|
|
|
|
+ if parts := strings.Split(file.Path, "/"); 2 < len(parts) {
|
|
|
|
+ clearWidgetsDir.Add(parts[2])
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
if needReloadFlashcard {
|
|
if needReloadFlashcard {
|
|
@@ -1458,6 +1467,11 @@ func processSyncMergeResult(exit, byHand bool, mergeResult *dejavu.MergeResult,
|
|
pushReloadPlugin()
|
|
pushReloadPlugin()
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ for _, widgetDir := range clearWidgetsDir.Values() {
|
|
|
|
+ widgetDirPath := filepath.Join(util.DataDir, "widgets", widgetDir.(string))
|
|
|
|
+ gulu.File.RemoveEmptyDirs(widgetDirPath)
|
|
|
|
+ }
|
|
|
|
+
|
|
syncingFiles = sync.Map{}
|
|
syncingFiles = sync.Map{}
|
|
syncingStorages.Store(false)
|
|
syncingStorages.Store(false)
|
|
|
|
|