Simplify search video channel
This commit is contained in:
parent
3455c2656e
commit
b3ed044ded
1 changed files with 3 additions and 3 deletions
|
@ -56,7 +56,7 @@ function searchVideoChannels (req: express.Request, res: express.Response) {
|
||||||
if (parts.length === 3 && parts[0].length === 0) parts.shift()
|
if (parts.length === 3 && parts[0].length === 0) parts.shift()
|
||||||
const isWebfingerSearch = parts.length === 2 && parts.every(p => p && !p.includes(' '))
|
const isWebfingerSearch = parts.length === 2 && parts.every(p => p && !p.includes(' '))
|
||||||
|
|
||||||
if (isURISearch(search) || isWebfingerSearch) return searchVideoChannelURI(search, isWebfingerSearch, res)
|
if (isURISearch(search) || isWebfingerSearch) return searchVideoChannelURI(search, res)
|
||||||
|
|
||||||
// @username -> username to search in DB
|
// @username -> username to search in DB
|
||||||
if (search.startsWith('@')) query.search = search.replace(/^@/, '')
|
if (search.startsWith('@')) query.search = search.replace(/^@/, '')
|
||||||
|
@ -110,11 +110,11 @@ async function searchVideoChannelsDB (query: VideoChannelsSearchQueryAfterSaniti
|
||||||
return res.json(getFormattedObjects(resultList.data, resultList.total))
|
return res.json(getFormattedObjects(resultList.data, resultList.total))
|
||||||
}
|
}
|
||||||
|
|
||||||
async function searchVideoChannelURI (search: string, isWebfingerSearch: boolean, res: express.Response) {
|
async function searchVideoChannelURI (search: string, res: express.Response) {
|
||||||
let videoChannel: MChannelAccountDefault
|
let videoChannel: MChannelAccountDefault
|
||||||
let uri = search
|
let uri = search
|
||||||
|
|
||||||
if (isWebfingerSearch) {
|
if (!isURISearch(search)) {
|
||||||
try {
|
try {
|
||||||
uri = await loadActorUrlOrGetFromWebfinger(search)
|
uri = await loadActorUrlOrGetFromWebfinger(search)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
Loading…
Reference in a new issue