function searchVideos (req: express.Request, res: express.Response) {
const query: VideosSearchQuery = req.query
- if (query.search.startsWith('http://') || query.search.startsWith('https://')) {
- return searchVideoUrl(query.search, res)
+ const search = query.search
+ if (search && (search.startsWith('http://') || search.startsWith('https://'))) {
+ return searchVideoUrl(search, res)
}
return searchVideosDB(query, res)
'email': 60000 * 10 // 10 minutes
}
const BROADCAST_CONCURRENCY = 10 // How many requests in parallel we do in activitypub-http-broadcast job
-const CRAWL_REQUEST_CONCURRENCY = 5 // How many requests in parallel to fetch remote data (likes, shares...)
+const CRAWL_REQUEST_CONCURRENCY = 1 // How many requests in parallel to fetch remote data (likes, shares...)
const JOB_REQUEST_TIMEOUT = 3000 // 3 seconds
const JOB_COMPLETED_LIFETIME = 60000 * 60 * 24 * 2 // 2 days
import 'multer'
-import * as uuidv4 from 'uuid'
import { sendUpdateActor } from './activitypub/send'
import { AVATARS_SIZE, CONFIG, sequelizeTypescript } from '../initializers'
import { updateActorAvatarInstance } from './activitypub'
accountOrChannel: AccountModel | VideoChannelModel
) {
const extension = extname(avatarPhysicalFile.filename)
- const avatarName = uuidv4() + extension
+ const avatarName = actor.uuid + extension
const destination = join(CONFIG.STORAGE.AVATARS_DIR, avatarName)
await processImage(avatarPhysicalFile, destination, AVATARS_SIZE)
let userAccessToken = ''
let accountName: string
let channelId: number
- let channelUUID: string
// ---------------------------------------------------------------
{
const res = await getMyUserInformation(server.url, server.accessToken)
channelId = res.body.videoChannels[ 0 ].id
- channelUUID = res.body.videoChannels[ 0 ].uuid
accountName = res.body.account.name + '@' + res.body.account.host
}
})
let servers: ServerInfo[] = []
let user: User
let userAccountName: string
+ let userAccountUUID: string
let userVideoChannelUUID: string
let userId: number
let videoUUID: string
{
const res = await getMyUserInformation(servers[0].url, userAccessToken)
- userAccountName = res.body.account.name + '@' + res.body.account.host
+ const account: Account = res.body.account
+ userAccountName = account.name + '@' + account.host
+ userAccountUUID = account.uuid
}
{
it('Should not have actor files', async () => {
for (const server of servers) {
- await checkActorFilesWereRemoved(userAccountName, server.serverNumber)
+ await checkActorFilesWereRemoved(userAccountUUID, server.serverNumber)
await checkActorFilesWereRemoved(userVideoChannelUUID, server.serverNumber)
}
})
return getMyUserInformation(server.url, server.accessToken)
.then(res => {
const user: User = res.body
- const videoChannelUUID = user.videoChannels[0].uuid
+ const videoChannelName = user.videoChannels[0].name
const accountName = user.account.name + '@' + user.account.host
if (token) {
getVideosListWithToken(server.url, token, query),
searchVideoWithToken(server.url, 'n', token, query),
getAccountVideos(server.url, token, accountName, 0, 5, undefined, query),
- getVideoChannelVideos(server.url, token, videoChannelUUID, 0, 5, undefined, query)
+ getVideoChannelVideos(server.url, token, videoChannelName, 0, 5, undefined, query)
])
}
getVideosList(server.url),
searchVideo(server.url, 'n'),
getAccountVideos(server.url, undefined, accountName, 0, 5),
- getVideoChannelVideos(server.url, undefined, videoChannelUUID, 0, 5)
+ getVideoChannelVideos(server.url, undefined, videoChannelName, 0, 5)
])
})
}
expect(res.body.total).to.equal(3)
for (const channel of res.body.data) {
- const { body } = await makeActivityPubGetRequest(server.url, '/video-channels/' + channel.uuid)
+ const { body } = await makeActivityPubGetRequest(server.url, '/video-channels/' + channel.name)
- expect(body.id).to.equal('http://localhost:9002/video-channels/' + channel.uuid)
+ expect(body.id).to.equal('http://localhost:9002/video-channels/' + channel.name)
}
})