aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/search
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-28 16:40:21 +0200
committerChocobozzz <me@florianbigard.com>2021-07-28 16:40:21 +0200
commitfbd67e7f386504e50f2504cb6386700a58906f16 (patch)
tree1a7143aaea76ce4e195fb9d6214a0cd769c556ea /server/controllers/api/search
parent164c8d46cf5c948a28b4ac0e596fad9b83b2c229 (diff)
downloadPeerTube-fbd67e7f386504e50f2504cb6386700a58906f16.tar.gz
PeerTube-fbd67e7f386504e50f2504cb6386700a58906f16.tar.zst
PeerTube-fbd67e7f386504e50f2504cb6386700a58906f16.zip
Add ability to search by uuids/actor names
Diffstat (limited to 'server/controllers/api/search')
-rw-r--r--server/controllers/api/search/search-video-channels.ts7
-rw-r--r--server/controllers/api/search/search-video-playlists.ts3
2 files changed, 6 insertions, 4 deletions
diff --git a/server/controllers/api/search/search-video-channels.ts b/server/controllers/api/search/search-video-channels.ts
index be0b6b9a2..9fc2d53a5 100644
--- a/server/controllers/api/search/search-video-channels.ts
+++ b/server/controllers/api/search/search-video-channels.ts
@@ -46,7 +46,7 @@ export { searchChannelsRouter }
46 46
47function searchVideoChannels (req: express.Request, res: express.Response) { 47function searchVideoChannels (req: express.Request, res: express.Response) {
48 const query: VideoChannelsSearchQuery = req.query 48 const query: VideoChannelsSearchQuery = req.query
49 const search = query.search 49 let search = query.search || ''
50 50
51 const parts = search.split('@') 51 const parts = search.split('@')
52 52
@@ -57,7 +57,7 @@ function searchVideoChannels (req: express.Request, res: express.Response) {
57 if (isURISearch(search) || isWebfingerSearch) return searchVideoChannelURI(search, isWebfingerSearch, res) 57 if (isURISearch(search) || isWebfingerSearch) return searchVideoChannelURI(search, isWebfingerSearch, res)
58 58
59 // @username -> username to search in DB 59 // @username -> username to search in DB
60 if (query.search.startsWith('@')) query.search = query.search.replace(/^@/, '') 60 if (search.startsWith('@')) search = search.replace(/^@/, '')
61 61
62 if (isSearchIndexSearch(query)) { 62 if (isSearchIndexSearch(query)) {
63 return searchVideoChannelsIndex(query, res) 63 return searchVideoChannelsIndex(query, res)
@@ -99,7 +99,8 @@ async function searchVideoChannelsDB (query: VideoChannelsSearchQuery, res: expr
99 start: query.start, 99 start: query.start,
100 count: query.count, 100 count: query.count,
101 sort: query.sort, 101 sort: query.sort,
102 host: query.host 102 host: query.host,
103 names: query.names
103 }, 'filter:api.search.video-channels.local.list.params') 104 }, 'filter:api.search.video-channels.local.list.params')
104 105
105 const resultList = await Hooks.wrapPromiseFun( 106 const resultList = await Hooks.wrapPromiseFun(
diff --git a/server/controllers/api/search/search-video-playlists.ts b/server/controllers/api/search/search-video-playlists.ts
index 60d1a44f7..bd6a2a564 100644
--- a/server/controllers/api/search/search-video-playlists.ts
+++ b/server/controllers/api/search/search-video-playlists.ts
@@ -89,7 +89,8 @@ async function searchVideoPlaylistsDB (query: VideoPlaylistsSearchQuery, res: ex
89 start: query.start, 89 start: query.start,
90 count: query.count, 90 count: query.count,
91 sort: query.sort, 91 sort: query.sort,
92 host: query.host 92 host: query.host,
93 uuids: query.uuids
93 }, 'filter:api.search.video-playlists.local.list.params') 94 }, 'filter:api.search.video-playlists.local.list.params')
94 95
95 const resultList = await Hooks.wrapPromiseFun( 96 const resultList = await Hooks.wrapPromiseFun(