mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-03 20:12:56 +08:00

* 🎨 bazaar resource directories support symlink * 🎨 bazaar resource directories support symlink * Squashed commit of the following: commita335101d49
Author: Liang Ding <d@b3log.org> Date: Tue May 16 12:53:33 2023 +0800 🔖 Release v2.8.8 commit6a6dec05f3
Author: Liang Ding <d@b3log.org> Date: Tue May 16 11:30:33 2023 +0800 📝 Update changelogs commita819656c0a
Author: Liang Ding <d@b3log.org> Date: Tue May 16 11:15:53 2023 +0800 📝 Update changelogs commit56a2c368d9
Author: Liang Ding <d@b3log.org> Date: Tue May 16 11:11:54 2023 +0800 🐛 Remove inconsistent scroll IAL commit8b6abec8e9
Author: Liang Ding <d@b3log.org> Date: Tue May 16 10:39:48 2023 +0800 🎨 Bazaar resource directories support symlink https://github.com/siyuan-note/siyuan/pull/8263 commit9455086820
Author: Liang Ding <d@b3log.org> Date: Tue May 16 10:35:46 2023 +0800 📝 Update changelogs commitfdbfe6b848
Author: 颖逸 <49649786+Zuoqiu-Yingyi@users.noreply.github.com> Date: Tue May 16 10:34:38 2023 +0800 Bazaar resource directories support symlink (#8263) * 🎨 bazaar resource directories support symlink * 🎨 bazaar resource directories support symlink commit85496345ef
Author: Vanessa <lly219@gmail.com> Date: Tue May 16 10:31:01 2023 +0800 ✨ enable plugin commitf3d1acd166
Author: Liang Ding <d@b3log.org> Date: Tue May 16 09:39:01 2023 +0800 📝 Update changelogs commitbf4b88a007
Author: Liang Ding <d@b3log.org> Date: Tue May 16 09:38:50 2023 +0800 🎨 Plugin hot load commit516276db49
Author: Liang Ding <d@b3log.org> Date: Tue May 16 09:09:31 2023 +0800 🎨 Data sync connectivity check supports redirection Fix https://github.com/siyuan-note/siyuan/issues/8264 commitd24f5ae3cf
Author: Vanessa <lly219@gmail.com> Date: Tue May 16 00:05:18 2023 +0800 🚨 commit1ac623ebb1
Author: Vanessa <lly219@gmail.com> Date: Tue May 16 00:04:25 2023 +0800 🎨 fix https://github.com/siyuan-note/siyuan/issues/8258 commitfdf9f0d9e4
Author: Vanessa <lly219@gmail.com> Date: Mon May 15 22:33:36 2023 +0800 🎨 https://github.com/siyuan-note/siyuan/issues/5066 removeData commit7c7f3db0b8
Author: Vanessa <lly219@gmail.com> Date: Mon May 15 22:26:11 2023 +0800 🐛 fix https://github.com/siyuan-note/siyuan/issues/8259 commitba4e5e8eed
Author: Vanessa <lly219@gmail.com> Date: Mon May 15 19:59:13 2023 +0800 💄 fix https://github.com/siyuan-note/siyuan/issues/8260 commit4f099bd990
Merge:b892fadd
856c7e09
Author: Vanessa <lly219@gmail.com> Date: Mon May 15 19:35:33 2023 +0800 Merge remote-tracking branch 'origin/dev' into dev commitb892fadd19
Author: Vanessa <lly219@gmail.com> Date: Mon May 15 19:35:19 2023 +0800 💄 commit856c7e0973
Author: Liang Ding <d@b3log.org> Date: Mon May 15 18:48:33 2023 +0800 📝 Improve initialization data sync interaction https://github.com/siyuan-note/siyuan/issues/8220 commitab6cb335e4
Author: Liang Ding <d@b3log.org> Date: Mon May 15 18:41:51 2023 +0800 📝 Improve initialization data sync interaction https://github.com/siyuan-note/siyuan/issues/8220 commita759936208
Author: Liang Ding <d@b3log.org> Date: Mon May 15 16:02:58 2023 +0800 📝 Improve initialization data sync interaction https://github.com/siyuan-note/siyuan/issues/8220 commit2513cbc31d
Author: Liang Ding <d@b3log.org> Date: Mon May 15 15:53:46 2023 +0800 📝 Improve initialization data sync interaction https://github.com/siyuan-note/siyuan/issues/8220 commit9a03f1e736
Author: Liang Ding <d@b3log.org> Date: Mon May 15 15:52:00 2023 +0800 📝 Update changelogs commit4cb952361e
Author: Vanessa <lly219@gmail.com> Date: Mon May 15 15:51:31 2023 +0800 🎨 https://github.com/siyuan-note/siyuan/issues/8220 commit7d58ab0607
Merge:6ca68174
0a102851
Author: Vanessa <lly219@gmail.com> Date: Mon May 15 15:43:33 2023 +0800 Merge remote-tracking branch 'origin/dev' into dev commit6ca6817465
Author: Vanessa <lly219@gmail.com> Date: Mon May 15 15:43:16 2023 +0800 🎨 https://github.com/siyuan-note/siyuan/issues/8220 commit0a10285167
Author: Liang Ding <d@b3log.org> Date: Mon May 15 14:56:12 2023 +0800 🎨 Escape the notification message https://github.com/siyuan-note/siyuan/issues/7811 commit7dbfa43de4
Author: Vanessa <lly219@gmail.com> Date: Mon May 15 13:59:50 2023 +0800 🎨 https://github.com/siyuan-note/siyuan/issues/8220 commit15141dde1f
Author: Vanessa <lly219@gmail.com> Date: Mon May 15 13:54:30 2023 +0800 🎨 https://github.com/siyuan-note/siyuan/issues/8220 commitdc1941da3c
Author: Vanessa <lly219@gmail.com> Date: Mon May 15 12:11:45 2023 +0800 🎨 catch plugin load commite7288185be
Author: Vanessa <lly219@gmail.com> Date: Mon May 15 12:04:22 2023 +0800 🎨 catch plugin load commit6690084caa
Author: Vanessa <lly219@gmail.com> Date: Mon May 15 11:46:51 2023 +0800 🎨 fix https://github.com/siyuan-note/siyuan/issues/8256 commit53a95ffbf7
Author: Vanessa <lly219@gmail.com> Date: Mon May 15 00:27:27 2023 +0800 💄 account commit4c7fe248e4
Merge:3674e834
2cf8a819
Author: Vanessa <lly219@gmail.com> Date: Mon May 15 00:11:08 2023 +0800 Merge remote-tracking branch 'origin/dev' into dev commit3674e83428
Author: Vanessa <lly219@gmail.com> Date: Mon May 15 00:10:46 2023 +0800 💄 account commit2cf8a8191a
Author: Liang Ding <d@b3log.org> Date: Sun May 14 23:21:32 2023 +0800 🎨 Improve images render in the marketplace package https://github.com/siyuan-note/bazaar/issues/1119 commit7572db4012
Author: Vanessa <lly219@gmail.com> Date: Sun May 14 12:10:47 2023 +0800 🎨 fix https://github.com/siyuan-note/siyuan/issues/8216 commit18071638cf
Author: Vanessa <lly219@gmail.com> Date: Sun May 14 12:09:52 2023 +0800 🎨 fix https://github.com/siyuan-note/siyuan/issues/8216 commit300a60aa45
Merge:0b001595
a6ecb981
Author: Vanessa <lly219@gmail.com> Date: Sun May 14 11:50:55 2023 +0800 Merge remote-tracking branch 'origin/dev' into dev commit0b00159511
Author: Vanessa <lly219@gmail.com> Date: Sun May 14 11:50:41 2023 +0800 🐛 open new window commita6ecb981b2
Author: Liang Ding <d@b3log.org> Date: Sun May 14 11:43:54 2023 +0800 🎨 Sponsorship through the Open Collective is no longer supported commit6c3c8d44ad
Author: Liang Ding <d@b3log.org> Date: Sun May 14 10:44:39 2023 +0800 🎨 When multiple windows exist, each window should be isolated using the `Optimize Typesetting` https://github.com/siyuan-note/siyuan/issues/8216 commit3edd8230d3
Author: Vanessa <lly219@gmail.com> Date: Sun May 14 10:34:48 2023 +0800 🎨 https://github.com/siyuan-note/siyuan/issues/8216 commitf8412a49c4
Author: Vanessa <lly219@gmail.com> Date: Sun May 14 10:27:16 2023 +0800 🐛 fix https://github.com/siyuan-note/siyuan/issues/8187 commita74ee348f7
Author: Vanessa <lly219@gmail.com> Date: Sun May 14 10:17:43 2023 +0800 🎨 fix https://github.com/siyuan-note/siyuan/issues/8242 commit518ce94912
Author: Vanessa <lly219@gmail.com> Date: Sun May 14 10:09:11 2023 +0800 💄 bazaar commite6923bdebc
Author: Vanessa <lly219@gmail.com> Date: Sun May 14 09:55:50 2023 +0800 🎨 https://github.com/siyuan-note/siyuan/issues/8245?utm_source=ld246.com * 🎨 widgets search support symlink directory * 🎨 templates directory support symlink * Update template.go
76 lines
2.0 KiB
Go
76 lines
2.0 KiB
Go
// SiYuan - Build Your Eternal Digital Garden
|
|
// Copyright (c) 2020-present, b3log.org
|
|
//
|
|
// This program is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU Affero General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// This program is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU Affero General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU Affero General Public License
|
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
package model
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"strings"
|
|
|
|
"github.com/siyuan-note/logging"
|
|
"github.com/siyuan-note/siyuan/kernel/search"
|
|
"github.com/siyuan-note/siyuan/kernel/util"
|
|
)
|
|
|
|
func SearchWidget(keyword string) (ret []*Block) {
|
|
ret = []*Block{}
|
|
widgets := filepath.Join(util.DataDir, "widgets")
|
|
entries, err := os.ReadDir(widgets)
|
|
if nil != err {
|
|
logging.LogErrorf("read dir [%s] failed: %s", widgets, err)
|
|
return
|
|
}
|
|
|
|
k := strings.ToLower(keyword)
|
|
for _, entry := range entries {
|
|
if !util.IsDirRegularOrSymlink(entry) {
|
|
continue
|
|
}
|
|
|
|
isWidgetDir := false
|
|
subEntries, readErr := os.ReadDir(filepath.Join(widgets, entry.Name()))
|
|
if nil != readErr {
|
|
logging.LogWarnf("read dir [%s] failed: %s", filepath.Join(widgets, entry.Name()), readErr)
|
|
continue
|
|
}
|
|
for _, subEntry := range subEntries {
|
|
if !subEntry.IsDir() && "widget.json" == subEntry.Name() {
|
|
isWidgetDir = true
|
|
break
|
|
}
|
|
}
|
|
if !isWidgetDir {
|
|
continue
|
|
}
|
|
|
|
name := strings.ToLower(entry.Name())
|
|
if strings.HasPrefix(name, ".") {
|
|
continue
|
|
}
|
|
|
|
if strings.Contains(name, k) {
|
|
name = entry.Name()
|
|
if "" != keyword {
|
|
_, name = search.MarkText(entry.Name(), keyword, 32, Conf.Search.CaseSensitive)
|
|
}
|
|
b := &Block{Content: name}
|
|
ret = append(ret, b)
|
|
}
|
|
}
|
|
return
|
|
}
|