aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-11-16 13:52:46 +0100
committerChocobozzz <me@florianbigard.com>2021-11-16 13:52:46 +0100
commitb3ed044ded4ed3108a3ff459e6600b71fa53568a (patch)
treebea4a446b98fe8558efa1d4065d6f7702857d12e /server/controllers/api
parent3455c2656e257ae3d9b4169af58b6889d9904148 (diff)
downloadPeerTube-b3ed044ded4ed3108a3ff459e6600b71fa53568a.tar.gz
PeerTube-b3ed044ded4ed3108a3ff459e6600b71fa53568a.tar.zst
PeerTube-b3ed044ded4ed3108a3ff459e6600b71fa53568a.zip
Simplify search video channel
Diffstat (limited to 'server/controllers/api')
-rw-r--r--server/controllers/api/search/search-video-channels.ts6
1 files changed, 3 insertions, 3 deletions
diff --git a/server/controllers/api/search/search-video-channels.ts b/server/controllers/api/search/search-video-channels.ts
index aa5afb46e..d615ff9ed 100644
--- a/server/controllers/api/search/search-video-channels.ts
+++ b/server/controllers/api/search/search-video-channels.ts
@@ -56,7 +56,7 @@ function searchVideoChannels (req: express.Request, res: express.Response) {
56 if (parts.length === 3 && parts[0].length === 0) parts.shift() 56 if (parts.length === 3 && parts[0].length === 0) parts.shift()
57 const isWebfingerSearch = parts.length === 2 && parts.every(p => p && !p.includes(' ')) 57 const isWebfingerSearch = parts.length === 2 && parts.every(p => p && !p.includes(' '))
58 58
59 if (isURISearch(search) || isWebfingerSearch) return searchVideoChannelURI(search, isWebfingerSearch, res) 59 if (isURISearch(search) || isWebfingerSearch) return searchVideoChannelURI(search, res)
60 60
61 // @username -> username to search in DB 61 // @username -> username to search in DB
62 if (search.startsWith('@')) query.search = search.replace(/^@/, '') 62 if (search.startsWith('@')) query.search = search.replace(/^@/, '')
@@ -110,11 +110,11 @@ async function searchVideoChannelsDB (query: VideoChannelsSearchQueryAfterSaniti
110 return res.json(getFormattedObjects(resultList.data, resultList.total)) 110 return res.json(getFormattedObjects(resultList.data, resultList.total))
111} 111}
112 112
113async function searchVideoChannelURI (search: string, isWebfingerSearch: boolean, res: express.Response) { 113async function searchVideoChannelURI (search: string, res: express.Response) {
114 let videoChannel: MChannelAccountDefault 114 let videoChannel: MChannelAccountDefault
115 let uri = search 115 let uri = search
116 116
117 if (isWebfingerSearch) { 117 if (!isURISearch(search)) {
118 try { 118 try {
119 uri = await loadActorUrlOrGetFromWebfinger(search) 119 uri = await loadActorUrlOrGetFromWebfinger(search)
120 } catch (err) { 120 } catch (err) {