X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fcontrollers%2Fapi%2Fsearch.ts;h=35d94d747e4a2c3164cb2e558b50f0d2077fe6e7;hb=e1c5503114deef954731904695cd40dccfcef555;hp=349650aca65e290c53b33794cb895a550dd60da3;hpb=282e61e6c11f79e919c543871783fe1a00298d18;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/controllers/api/search.ts b/server/controllers/api/search.ts index 349650aca..35d94d747 100644 --- a/server/controllers/api/search.ts +++ b/server/controllers/api/search.ts @@ -1,6 +1,6 @@ import * as express from 'express' import { buildNSFWFilter, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils' -import { getFormattedObjects, getServerActor } from '../../helpers/utils' +import { getFormattedObjects } from '../../helpers/utils' import { VideoModel } from '../../models/video/video' import { asyncMiddleware, @@ -15,11 +15,13 @@ import { videosSearchValidator } from '../../middlewares' import { VideoChannelsSearchQuery, VideosSearchQuery } from '../../../shared/models/search' -import { getOrCreateActorAndServerAndModel, getOrCreateVideoAndAccountAndChannel } from '../../lib/activitypub' +import { getOrCreateActorAndServerAndModel } from '../../lib/activitypub/actor' import { logger } from '../../helpers/logger' import { VideoChannelModel } from '../../models/video/video-channel' import { loadActorUrlOrGetFromWebfinger } from '../../helpers/webfinger' import { MChannelAccountDefault, MVideoAccountLightBlacklistAllFiles } from '../../typings/models' +import { getServerActor } from '@server/models/application/application' +import { getOrCreateVideoAndAccountAndChannel } from '@server/lib/activitypub/videos' const searchRouter = express.Router() @@ -60,7 +62,7 @@ function searchVideoChannels (req: express.Request, res: express.Response) { // Handle strings like @toto@example.com if (parts.length === 3 && parts[0].length === 0) parts.shift() - const isWebfingerSearch = parts.length === 2 && parts.every(p => p && p.indexOf(' ') === -1) + const isWebfingerSearch = parts.length === 2 && parts.every(p => p && !p.includes(' ')) if (isURISearch || isWebfingerSearch) return searchVideoChannelURI(search, isWebfingerSearch, res)