diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index f780481b8..b9a41e740 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -1,6 +1,6 @@ name: 🐛 缺陷报告 Bug Report description: 报告缺陷以帮助我们进行改进 Report defects to help us improve -title: "" +title: "请输入问题报告标题 Please enter the title of the bug report" body: - type: checkboxes attributes: diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index 6b8e0a4ec..e94f60371 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -1,6 +1,6 @@ name: ✨ 特性提议 Request new features description: 欢迎提出你所期待的新特性 Come up with the features you expected -title: "" +title: "请输入特性提议标题 Please enter the title of the feature request" body: - type: textarea attributes: diff --git a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa.sy b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa.sy index 3360789a6..95354d743 100644 --- a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa.sy +++ b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa.sy @@ -529,8 +529,8 @@ { "Type": "NodeTextMark", "TextMarkType": "a", - "TextMarkAHref": "https://ld246.com/domain/siyuan", - "TextMarkTextContent": "链滴(中文讨论区)" + "TextMarkAHref": "https://ld246.com/article/1649901726096", + "TextMarkTextContent": "链滴(中文反馈)" } ] } diff --git a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq.sy b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq.sy index dbf447f6d..3565dad0c 100644 --- a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq.sy +++ b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq.sy @@ -530,8 +530,8 @@ { "Type": "NodeTextMark", "TextMarkType": "a", - "TextMarkAHref": "https://ld246.com/domain/siyuan", - "TextMarkTextContent": "鏈滴(中文討論區)" + "TextMarkAHref": "https://ld246.com/article/1649901726096", + "TextMarkTextContent": "鏈滴(中文反饋)" } ] } diff --git a/app/stage/auth.html b/app/stage/auth.html index 738eece78..38ddc65ba 100644 --- a/app/stage/auth.html +++ b/app/stage/auth.html @@ -153,7 +153,7 @@
- 如果你在使用中遇到问题,请到社区进行反馈
+ 如果你在使用中遇到问题,请到这里反馈
If you encounter problems, please report it on GitHub
diff --git a/kernel/cache/asset.go b/kernel/cache/asset.go index bf9d2368b..7c68e1118 100644 --- a/kernel/cache/asset.go +++ b/kernel/cache/asset.go @@ -33,9 +33,24 @@ type Asset struct { Updated int64 `json:"updated"` } -var Assets = map[string]*Asset{} +var assetsCache = map[string]*Asset{} var assetsLock = sync.Mutex{} +func GetAssets() (ret map[string]*Asset) { + assetsLock.Lock() + defer assetsLock.Unlock() + + ret = assetsCache + return +} + +func RemoveAsset(path string) { + assetsLock.Lock() + defer assetsLock.Unlock() + + delete(assetsCache, path) +} + func LoadAssets() { defer logging.Recover() @@ -43,6 +58,7 @@ func LoadAssets() { assetsLock.Lock() defer assetsLock.Unlock() + assetsCache = map[string]*Asset{} assets := util.GetDataAssetsAbsPath() filepath.Walk(assets, func(path string, info fs.FileInfo, err error) error { if nil == info { @@ -60,7 +76,7 @@ func LoadAssets() { hName := util.RemoveID(info.Name()) path = "assets" + filepath.ToSlash(strings.TrimPrefix(path, assets)) - Assets[path] = &Asset{ + assetsCache[path] = &Asset{ HName: hName, Path: path, Updated: info.ModTime().UnixMilli(), diff --git a/kernel/model/assets.go b/kernel/model/assets.go index d67fed919..f7c50786e 100644 --- a/kernel/model/assets.go +++ b/kernel/model/assets.go @@ -208,7 +208,7 @@ func SearchAssetsByName(keyword string) (ret []*cache.Asset) { ret = []*cache.Asset{} count := 0 - for _, asset := range cache.Assets { + for _, asset := range cache.GetAssets() { if !strings.Contains(strings.ToLower(asset.HName), strings.ToLower(keyword)) { continue } @@ -471,13 +471,14 @@ func RemoveUnusedAssets() (ret []string) { } indexHistoryDir(filepath.Base(historyDir), NewLute()) + cache.LoadAssets() return } func RemoveUnusedAsset(p string) (ret string) { - p = filepath.Join(util.DataDir, p) - if !gulu.File.IsExist(p) { - return p + absPath := filepath.Join(util.DataDir, p) + if !gulu.File.IsExist(absPath) { + return absPath } historyDir, err := GetHistoryDir(HistoryOpClean) @@ -486,24 +487,25 @@ func RemoveUnusedAsset(p string) (ret string) { return } - newP := strings.TrimPrefix(p, util.DataDir) + newP := strings.TrimPrefix(absPath, util.DataDir) historyPath := filepath.Join(historyDir, newP) - if gulu.File.IsExist(p) { - if err = gulu.File.Copy(p, historyPath); nil != err { + if gulu.File.IsExist(absPath) { + if err = gulu.File.Copy(absPath, historyPath); nil != err { return } - hash, _ := util.GetEtag(p) + hash, _ := util.GetEtag(absPath) sql.DeleteAssetsByHashes([]string{hash}) } - if err = os.RemoveAll(p); nil != err { - logging.LogErrorf("remove unused asset [%s] failed: %s", p, err) + if err = os.RemoveAll(absPath); nil != err { + logging.LogErrorf("remove unused asset [%s] failed: %s", absPath, err) } - ret = p + ret = absPath IncSync() indexHistoryDir(filepath.Base(historyDir), NewLute()) + cache.RemoveAsset(p) return }