aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/search.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-08-24 15:36:50 +0200
committerChocobozzz <me@florianbigard.com>2018-08-27 09:41:54 +0200
commit687d638c2bee0d223f206168173b1b95adbad983 (patch)
tree957741b0ba704562a233181510bb8fda0102c8a5 /server/controllers/api/search.ts
parentf5b0af50c85e2f8b6b2b054ac1f47123cacbe08d (diff)
downloadPeerTube-687d638c2bee0d223f206168173b1b95adbad983.tar.gz
PeerTube-687d638c2bee0d223f206168173b1b95adbad983.tar.zst
PeerTube-687d638c2bee0d223f206168173b1b95adbad983.zip
Fetch outbox when searching an actor
Diffstat (limited to 'server/controllers/api/search.ts')
-rw-r--r--server/controllers/api/search.ts11
1 files changed, 2 insertions, 9 deletions
diff --git a/server/controllers/api/search.ts b/server/controllers/api/search.ts
index 959d79855..bb7174891 100644
--- a/server/controllers/api/search.ts
+++ b/server/controllers/api/search.ts
@@ -1,5 +1,5 @@
1import * as express from 'express' 1import * as express from 'express'
2import { buildNSFWFilter } from '../../helpers/express-utils' 2import { buildNSFWFilter, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils'
3import { getFormattedObjects, getServerActor } from '../../helpers/utils' 3import { getFormattedObjects, getServerActor } from '../../helpers/utils'
4import { VideoModel } from '../../models/video/video' 4import { VideoModel } from '../../models/video/video'
5import { 5import {
@@ -88,7 +88,7 @@ async function searchVideoChannelURI (search: string, isWebfingerSearch: boolean
88 88
89 if (isUserAbleToSearchRemoteURI(res)) { 89 if (isUserAbleToSearchRemoteURI(res)) {
90 try { 90 try {
91 const actor = await getOrCreateActorAndServerAndModel(uri) 91 const actor = await getOrCreateActorAndServerAndModel(uri, true, true)
92 videoChannel = actor.VideoChannel 92 videoChannel = actor.VideoChannel
93 } catch (err) { 93 } catch (err) {
94 logger.info('Cannot search remote video channel %s.', uri, { err }) 94 logger.info('Cannot search remote video channel %s.', uri, { err })
@@ -152,10 +152,3 @@ async function searchVideoURI (url: string, res: express.Response) {
152 data: video ? [ video.toFormattedJSON() ] : [] 152 data: video ? [ video.toFormattedJSON() ] : []
153 }) 153 })
154} 154}
155
156function isUserAbleToSearchRemoteURI (res: express.Response) {
157 const user: User = res.locals.oauth ? res.locals.oauth.token.User : undefined
158
159 return CONFIG.SEARCH.REMOTE_URI.ANONYMOUS === true ||
160 (CONFIG.SEARCH.REMOTE_URI.USERS === true && user !== undefined)
161}