From f8054b23eac2e3fde291db7809f28aa2ed28a0d1 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Mon, 30 Oct 2023 11:48:18 +0800 Subject: [PATCH 1/4] :art: Upgrade kernel dpes --- kernel/go.mod | 4 ++-- kernel/go.sum | 14 ++++---------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/kernel/go.mod b/kernel/go.mod index 20bbaddd5..38be379bb 100644 --- a/kernel/go.mod +++ b/kernel/go.mod @@ -47,12 +47,12 @@ require ( github.com/radovskyb/watcher v1.0.7 github.com/sashabaranov/go-openai v1.15.4 github.com/shirou/gopsutil/v3 v3.23.9 - github.com/siyuan-note/dejavu v0.0.0-20231029013956-be65f6fb8afe + github.com/siyuan-note/dejavu v0.0.0-20231030033735-e1159566cf1f github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75 github.com/siyuan-note/eventbus v0.0.0-20230804030110-cf250f838c80 github.com/siyuan-note/filelock v0.0.0-20230615140405-d05a21d49524 github.com/siyuan-note/httpclient v0.0.0-20231028070852-3c2c5a151c13 - github.com/siyuan-note/logging v0.0.0-20230327073243-ebe83aec1493 + github.com/siyuan-note/logging v0.0.0-20231030034701-8265764f00ff github.com/siyuan-note/riff v0.0.0-20230928143458-ffd178c7e0fc github.com/steambap/captcha v1.4.1 github.com/studio-b12/gowebdav v0.9.0 diff --git a/kernel/go.sum b/kernel/go.sum index b3a56e20f..39cbd5fea 100644 --- a/kernel/go.sum +++ b/kernel/go.sum @@ -10,10 +10,6 @@ github.com/88250/go-sqlite3 v1.14.13-0.20220714142610-fbbda1ee84f5 h1:8HdZozCsXS github.com/88250/go-sqlite3 v1.14.13-0.20220714142610-fbbda1ee84f5/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= github.com/88250/gulu v1.2.3-0.20231023172823-f152fc5d93ef h1:LVJO3aj18v63T2whGGt3gL5imkJk+7ujPfFv38X7Oi8= github.com/88250/gulu v1.2.3-0.20231023172823-f152fc5d93ef/go.mod h1:pTWnjt+6qUqNnP9xltswsJxgCBVu3C7eW09u48LWX0k= -github.com/88250/lute v1.7.6-0.20231025033833-375686999503 h1:2NnFQ3MzYoWulvt6o6p7FNJUey1llu/1dbfIEytMf0A= -github.com/88250/lute v1.7.6-0.20231025033833-375686999503/go.mod h1:+wUqx/1kdFDbWtxn9LYJlaCOAeol2pjSO6w+WJTVQsg= -github.com/88250/lute v1.7.6-0.20231028154609-ac16015d5941 h1:aivU1+5XHmzLNPHY/ZdTbDnWWr15+JEBB5FjwjsIt3A= -github.com/88250/lute v1.7.6-0.20231028154609-ac16015d5941/go.mod h1:+wUqx/1kdFDbWtxn9LYJlaCOAeol2pjSO6w+WJTVQsg= github.com/88250/lute v1.7.6-0.20231028162145-1bc5cc6e689a h1:H1WaOyTfyvjFS95XabKa1YtvBoedywqH5PJw/QLnt3Y= github.com/88250/lute v1.7.6-0.20231028162145-1bc5cc6e689a/go.mod h1:+wUqx/1kdFDbWtxn9LYJlaCOAeol2pjSO6w+WJTVQsg= github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720c h1:Dl/8S9iLyPMTElnWIBxmjaLiWrkI5P4a21ivwAn5pU0= @@ -342,10 +338,8 @@ github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFR github.com/shurcooL/gofontwoff v0.0.0-20181114050219-180f79e6909d h1:lvCTyBbr36+tqMccdGMwuEU+hjux/zL6xSmf5S9ITaA= github.com/shurcooL/gofontwoff v0.0.0-20181114050219-180f79e6909d/go.mod h1:05UtEgK5zq39gLST6uB0cf3NEHjETfB4Fgr3Gx5R9Vw= github.com/simplereach/timeutils v1.2.0/go.mod h1:VVbQDfN/FHRZa1LSqcwo4kNZ62OOyqLLGQKYB3pB0Q8= -github.com/siyuan-note/dejavu v0.0.0-20231028150225-cfb485a4235d h1:olisJ1eg3rrAMSM2QXCQKxLVBHRRCn8M0+sld7B9Jgc= -github.com/siyuan-note/dejavu v0.0.0-20231028150225-cfb485a4235d/go.mod h1:sI8koptyofmnE4zcS6/HhOCHmxUcOSvr8ZYF0EqOku4= -github.com/siyuan-note/dejavu v0.0.0-20231029013956-be65f6fb8afe h1:igKhT3NXQVhs4pB7hElii10Fjsd1mYo7qqo+OLNiqaA= -github.com/siyuan-note/dejavu v0.0.0-20231029013956-be65f6fb8afe/go.mod h1:sI8koptyofmnE4zcS6/HhOCHmxUcOSvr8ZYF0EqOku4= +github.com/siyuan-note/dejavu v0.0.0-20231030033735-e1159566cf1f h1:qcnlaDdl74QBBJcTts4g46Fjoo2bftHQZe63DN91/lc= +github.com/siyuan-note/dejavu v0.0.0-20231030033735-e1159566cf1f/go.mod h1:sI8koptyofmnE4zcS6/HhOCHmxUcOSvr8ZYF0EqOku4= github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75 h1:Bi7/7f29LW+Fm0cHc0J1NO1cZqyJwljSWVmfOqVZgaE= github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75/go.mod h1:H8fyqqAbp9XreANjeSbc72zEdFfKTXYN34tc1TjZwtw= github.com/siyuan-note/eventbus v0.0.0-20230804030110-cf250f838c80 h1:XghjHKJd+SiL0DkGYFVC+UGUDFtnR4v9gkAbPeh9Eq8= @@ -354,8 +348,8 @@ github.com/siyuan-note/filelock v0.0.0-20230615140405-d05a21d49524 h1:ZuxN5gwqtU github.com/siyuan-note/filelock v0.0.0-20230615140405-d05a21d49524/go.mod h1:jK5lCYfPbFOrW23/HMeU7kmpLdEd5GkennF+kUpy7Vs= github.com/siyuan-note/httpclient v0.0.0-20231028070852-3c2c5a151c13 h1:DQwiRQa63wsjSKQN5TvTWI2Dd5XSulhnXvxIdOG8/x8= github.com/siyuan-note/httpclient v0.0.0-20231028070852-3c2c5a151c13/go.mod h1:mS0nX5fX99R/5HLnKqG40kpbathSCXxL/oxe88rURNI= -github.com/siyuan-note/logging v0.0.0-20230327073243-ebe83aec1493 h1:oaN5b0WDFkjdBgGxmmBnMrtZxaJ76LZLwhQSZnznJMI= -github.com/siyuan-note/logging v0.0.0-20230327073243-ebe83aec1493/go.mod h1:6mRFtAAvYPn3cDzqvyv+t8BVPGqpONDMMb5ywOhY1D4= +github.com/siyuan-note/logging v0.0.0-20231030034701-8265764f00ff h1:5GcxrTOJTsusXOLhg4GuHWbEa4M5gu+CNfL0giwNjDM= +github.com/siyuan-note/logging v0.0.0-20231030034701-8265764f00ff/go.mod h1:6mRFtAAvYPn3cDzqvyv+t8BVPGqpONDMMb5ywOhY1D4= github.com/siyuan-note/riff v0.0.0-20230928143458-ffd178c7e0fc h1:EDbkzdLfR+gMYyU4h/xUiwxngz75d3L5M0IN0NTqdVU= github.com/siyuan-note/riff v0.0.0-20230928143458-ffd178c7e0fc/go.mod h1:WxG165xAPeGok0Q/15KMhnNbesoU5ZG+/zikTyWzZi8= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= From 50921eb97d505af4604319f75a042e87d8cebc24 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Mon, 30 Oct 2023 11:51:21 +0800 Subject: [PATCH 2/4] :art: Upgrade kernel dpes --- kernel/go.mod | 2 +- kernel/go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/kernel/go.mod b/kernel/go.mod index 38be379bb..a012bd5d7 100644 --- a/kernel/go.mod +++ b/kernel/go.mod @@ -47,7 +47,7 @@ require ( github.com/radovskyb/watcher v1.0.7 github.com/sashabaranov/go-openai v1.15.4 github.com/shirou/gopsutil/v3 v3.23.9 - github.com/siyuan-note/dejavu v0.0.0-20231030033735-e1159566cf1f + github.com/siyuan-note/dejavu v0.0.0-20231030035026-e16dd926f8aa github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75 github.com/siyuan-note/eventbus v0.0.0-20230804030110-cf250f838c80 github.com/siyuan-note/filelock v0.0.0-20230615140405-d05a21d49524 diff --git a/kernel/go.sum b/kernel/go.sum index 39cbd5fea..0547d1dd6 100644 --- a/kernel/go.sum +++ b/kernel/go.sum @@ -340,6 +340,8 @@ github.com/shurcooL/gofontwoff v0.0.0-20181114050219-180f79e6909d/go.mod h1:05Ut github.com/simplereach/timeutils v1.2.0/go.mod h1:VVbQDfN/FHRZa1LSqcwo4kNZ62OOyqLLGQKYB3pB0Q8= github.com/siyuan-note/dejavu v0.0.0-20231030033735-e1159566cf1f h1:qcnlaDdl74QBBJcTts4g46Fjoo2bftHQZe63DN91/lc= github.com/siyuan-note/dejavu v0.0.0-20231030033735-e1159566cf1f/go.mod h1:sI8koptyofmnE4zcS6/HhOCHmxUcOSvr8ZYF0EqOku4= +github.com/siyuan-note/dejavu v0.0.0-20231030035026-e16dd926f8aa h1:jNdF6vITlStzrVaJVT05hsT5ItZiJWlAbQt2hJu+E8A= +github.com/siyuan-note/dejavu v0.0.0-20231030035026-e16dd926f8aa/go.mod h1:sI8koptyofmnE4zcS6/HhOCHmxUcOSvr8ZYF0EqOku4= github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75 h1:Bi7/7f29LW+Fm0cHc0J1NO1cZqyJwljSWVmfOqVZgaE= github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75/go.mod h1:H8fyqqAbp9XreANjeSbc72zEdFfKTXYN34tc1TjZwtw= github.com/siyuan-note/eventbus v0.0.0-20230804030110-cf250f838c80 h1:XghjHKJd+SiL0DkGYFVC+UGUDFtnR4v9gkAbPeh9Eq8= From ed117fd5774c906d645a8327c1aa4d86acc4de0c Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Mon, 30 Oct 2023 15:21:05 +0800 Subject: [PATCH 3/4] :art: Upgrade kernel dpes --- kernel/go.mod | 2 +- kernel/go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/kernel/go.mod b/kernel/go.mod index a012bd5d7..566606612 100644 --- a/kernel/go.mod +++ b/kernel/go.mod @@ -47,7 +47,7 @@ require ( github.com/radovskyb/watcher v1.0.7 github.com/sashabaranov/go-openai v1.15.4 github.com/shirou/gopsutil/v3 v3.23.9 - github.com/siyuan-note/dejavu v0.0.0-20231030035026-e16dd926f8aa + github.com/siyuan-note/dejavu v0.0.0-20231030071534-4dce9cc8d9af github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75 github.com/siyuan-note/eventbus v0.0.0-20230804030110-cf250f838c80 github.com/siyuan-note/filelock v0.0.0-20230615140405-d05a21d49524 diff --git a/kernel/go.sum b/kernel/go.sum index 0547d1dd6..c3937bdfe 100644 --- a/kernel/go.sum +++ b/kernel/go.sum @@ -342,6 +342,8 @@ github.com/siyuan-note/dejavu v0.0.0-20231030033735-e1159566cf1f h1:qcnlaDdl74QB github.com/siyuan-note/dejavu v0.0.0-20231030033735-e1159566cf1f/go.mod h1:sI8koptyofmnE4zcS6/HhOCHmxUcOSvr8ZYF0EqOku4= github.com/siyuan-note/dejavu v0.0.0-20231030035026-e16dd926f8aa h1:jNdF6vITlStzrVaJVT05hsT5ItZiJWlAbQt2hJu+E8A= github.com/siyuan-note/dejavu v0.0.0-20231030035026-e16dd926f8aa/go.mod h1:sI8koptyofmnE4zcS6/HhOCHmxUcOSvr8ZYF0EqOku4= +github.com/siyuan-note/dejavu v0.0.0-20231030071534-4dce9cc8d9af h1:C2vF0KJUODTW9Q06NcmP2zPfTDz0plOyDRoIAePKZD4= +github.com/siyuan-note/dejavu v0.0.0-20231030071534-4dce9cc8d9af/go.mod h1:l/akstKweKTdzTZ3FxFH2d49ekEbs9dAFmzDiM7tBik= github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75 h1:Bi7/7f29LW+Fm0cHc0J1NO1cZqyJwljSWVmfOqVZgaE= github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75/go.mod h1:H8fyqqAbp9XreANjeSbc72zEdFfKTXYN34tc1TjZwtw= github.com/siyuan-note/eventbus v0.0.0-20230804030110-cf250f838c80 h1:XghjHKJd+SiL0DkGYFVC+UGUDFtnR4v9gkAbPeh9Eq8= From eba283d8b26d6c55bdbe9190309d560d8dc84b59 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Mon, 30 Oct 2023 15:25:46 +0800 Subject: [PATCH 4/4] =?UTF-8?q?:art:=20=E9=A2=98=E5=A4=B4=E5=9B=BE?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E8=B5=84=E6=BA=90=E6=96=87=E4=BB=B6=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=20https://github.com/siyuan-note/siyuan/issues/9524?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/api/search.go | 10 +++++++++- kernel/model/assets.go | 17 ++++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/kernel/api/search.go b/kernel/api/search.go index 0b4feab8e..0c29d130e 100644 --- a/kernel/api/search.go +++ b/kernel/api/search.go @@ -101,7 +101,15 @@ func searchAsset(c *gin.Context) { } k := arg["k"].(string) - ret.Data = model.SearchAssetsByName(k) + + var exts []string + if extsArg := arg["exts"]; nil != extsArg { + for _, ext := range extsArg.([]interface{}) { + exts = append(exts, ext.(string)) + } + } + + ret.Data = model.SearchAssetsByName(k, exts) return } diff --git a/kernel/model/assets.go b/kernel/model/assets.go index 709171a53..72f29aebd 100644 --- a/kernel/model/assets.go +++ b/kernel/model/assets.go @@ -220,11 +220,26 @@ func NetImg2LocalAssets(rootID, originalURL string) (err error) { return } -func SearchAssetsByName(keyword string) (ret []*cache.Asset) { +func SearchAssetsByName(keyword string, exts []string) (ret []*cache.Asset) { ret = []*cache.Asset{} count := 0 + filterByExt := 0 < len(exts) for _, asset := range cache.GetAssets() { + if filterByExt { + ext := filepath.Ext(asset.HName) + includeExt := false + for _, e := range exts { + if strings.ToLower(ext) == strings.ToLower(e) { + includeExt = true + break + } + } + if !includeExt { + continue + } + } + if !strings.Contains(strings.ToLower(asset.HName), strings.ToLower(keyword)) { continue }