mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-03-13 07:56:14 +01:00
♻️ Adjust some details (#17165)
This commit is contained in:
parent
5aa9f4b5ef
commit
3e808209e5
9 changed files with 41 additions and 19 deletions
|
|
@ -89,6 +89,7 @@ func HandleAssetsRemoveEvent(assetAbsPath string) {
|
|||
if gulu.File.IsDir(assetAbsPath) {
|
||||
return
|
||||
}
|
||||
// 跳过隐藏文件,如 WPS 的临时文件、Mac 的 .DS_Store
|
||||
if filelock.IsHidden(assetAbsPath) {
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,7 +65,6 @@ func watchAssets() {
|
|||
return
|
||||
}
|
||||
|
||||
//logging.LogInfof("assets changed: %s", event)
|
||||
if watcher.Write == event.Op {
|
||||
IncSync()
|
||||
}
|
||||
|
|
@ -88,6 +87,7 @@ func watchAssets() {
|
|||
}
|
||||
}
|
||||
}()
|
||||
|
||||
if err := assetsWatcher.Start(10 * time.Second); err != nil {
|
||||
logging.LogErrorf("start assets watcher for folder [%s] failed: %s", assetsDir, err)
|
||||
return
|
||||
|
|
|
|||
|
|
@ -322,6 +322,7 @@ func GetBazaarPackageREADME(ctx context.Context, repoURL, repoHash, pkgType stri
|
|||
return
|
||||
}
|
||||
|
||||
// InstallBazaarPackage 安装集市包,themeMode 仅在 pkgType 为 "themes" 时生效
|
||||
func InstallBazaarPackage(pkgType, repoURL, repoHash, packageName string, themeMode int) error {
|
||||
installPath, jsonFileName, err := getPackageInstallPath(pkgType, packageName)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -337,10 +337,11 @@ func InitConf() {
|
|||
Conf.OpenHelp = true
|
||||
}
|
||||
} else {
|
||||
if 0 < semver.Compare("v"+util.Ver, "v"+Conf.System.KernelVersion) {
|
||||
cmp := semver.Compare("v"+util.Ver, "v"+Conf.System.KernelVersion)
|
||||
if 0 < cmp {
|
||||
logging.LogInfof("upgraded from version [%s] to [%s]", Conf.System.KernelVersion, util.Ver)
|
||||
Conf.ShowChangelog = true
|
||||
} else if 0 > semver.Compare("v"+util.Ver, "v"+Conf.System.KernelVersion) {
|
||||
} else if 0 > cmp {
|
||||
logging.LogInfof("downgraded from version [%s] to [%s]", Conf.System.KernelVersion, util.Ver)
|
||||
}
|
||||
|
||||
|
|
@ -1033,9 +1034,12 @@ const (
|
|||
MaskedAccessAuthCode = "*******"
|
||||
)
|
||||
|
||||
// GetMaskedConf 获取脱敏后的 Conf
|
||||
func GetMaskedConf() (ret *AppConf, err error) {
|
||||
// 脱敏处理
|
||||
data, err := gulu.JSON.MarshalIndentJSON(Conf, "", " ")
|
||||
// 序列化时持锁,避免与 loadThemes/LoadIcons 等写操作并发导致 slice 在编码过程中被改写而 panic https://github.com/siyuan-note/siyuan/issues/16978
|
||||
Conf.m.Lock()
|
||||
data, err := gulu.JSON.MarshalJSON(Conf)
|
||||
Conf.m.Unlock()
|
||||
if err != nil {
|
||||
logging.LogErrorf("marshal conf failed: %s", err)
|
||||
return
|
||||
|
|
|
|||
|
|
@ -40,9 +40,9 @@ func WatchEmojis() {
|
|||
}
|
||||
|
||||
func watchEmojis() {
|
||||
CloseWatchEmojis()
|
||||
emojisDir := filepath.Join(util.DataDir, "emojis")
|
||||
|
||||
CloseWatchEmojis()
|
||||
emojisWatcher = watcher.New()
|
||||
|
||||
if !gulu.File.IsDir(emojisDir) {
|
||||
|
|
@ -74,6 +74,7 @@ func watchEmojis() {
|
|||
}
|
||||
}
|
||||
}()
|
||||
|
||||
if err := emojisWatcher.Start(10 * time.Second); err != nil {
|
||||
logging.LogErrorf("start emojis watcher for folder [%s] failed: %s", emojisDir, err)
|
||||
return
|
||||
|
|
|
|||
|
|
@ -749,6 +749,10 @@ func checkoutRepo(id string) {
|
|||
CloseWatchEmojis()
|
||||
defer WatchEmojis()
|
||||
|
||||
// 若主题支持同步,需关闭监听器
|
||||
// CloseWatchThemes()
|
||||
// defer WatchThemes()
|
||||
|
||||
// 恢复快照时自动暂停同步,避免刚刚恢复后的数据又被同步覆盖
|
||||
syncEnabled := Conf.Sync.Enabled
|
||||
Conf.Sync.Enabled = false
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue