rl.on('line', line => {
const log = JSON.parse(line)
- logLevels[log.level](log.message, log.stack)
+ const additionalInfo: any = {}
+
+ Object.keys(log).forEach(logKey => {
+ if (logKey !== 'message' && logKey !== 'level') additionalInfo[logKey] = log[logKey]
+ })
+
+ logLevels[log.level](log.message, additionalInfo)
})
// ----------- PeerTube modules -----------
import { migrate, installApplication } from './server/initializers'
-import { httpRequestJobScheduler, transcodingJobScheduler, VideosPreviewCache } from './server/lib'
+import { activitypubHttpJobScheduler, transcodingJobScheduler, VideosPreviewCache } from './server/lib'
import { apiRouter, clientsRouter, staticRouter, servicesRouter, webfingerRouter, activityPubRouter } from './server/controllers'
// ----------- Command line -----------
// ----------- Make the server listening -----------
server.listen(port, () => {
VideosPreviewCache.Instance.init(CONFIG.CACHE.PREVIEWS.SIZE)
- httpRequestJobScheduler.activate()
+ activitypubHttpJobScheduler.activate()
transcodingJobScheduler.activate()
logger.info('Server listening on port %d', port)
import * as Sequelize from 'sequelize'
import * as url from 'url'
import { ActivityIconObject } from '../../shared/index'
+import { Activity } from '../../shared/models/activitypub/activity'
import { ActivityPubActor } from '../../shared/models/activitypub/activitypub-actor'
import { VideoChannelObject } from '../../shared/models/activitypub/objects/video-channel-object'
import { ResultList } from '../../shared/models/result-list.model'
import { isRemoteAccountValid } from './custom-validators'
import { isVideoChannelObjectValid } from './custom-validators/activitypub/videos'
import { logger } from './logger'
+import { signObject } from './peertube-crypto'
import { doRequest, doRequestAndSaveToFile } from './requests'
import { getServerAccount } from './utils'
return activityPubContextify(obj)
}
+function buildSignedActivity (byAccount: AccountInstance, data: Object) {
+ const activity = activityPubContextify(data)
+
+ return signObject(byAccount, activity) as Promise<Activity>
+}
+
// ---------------------------------------------------------------------------
export {
fetchRemoteVideoDescription,
shareVideoChannelByServer,
shareVideoByServer,
- getOrCreateVideoChannel
+ getOrCreateVideoChannel,
+ buildSignedActivity
}
// ---------------------------------------------------------------------------
}
const JOB_CATEGORIES: { [ id: string ]: JobCategory } = {
TRANSCODING: 'transcoding',
- HTTP_REQUEST: 'http-request'
+ ACTIVITYPUB_HTTP: 'activitypub-http'
}
// How many maximum jobs we fetch from the database per cycle
const JOBS_FETCH_LIMIT_PER_CYCLE = {
-import * as Sequelize from 'sequelize'
-
-import { database as db } from '../../initializers'
+import { Transaction } from 'sequelize'
import {
- AccountInstance,
- VideoInstance,
- VideoChannelInstance
-} from '../../models'
-import { httpRequestJobScheduler } from '../jobs'
-import { signObject, activityPubContextify } from '../../helpers'
-import { Activity, VideoAbuseObject } from '../../../shared'
-import { VideoAbuseInstance } from '../../models/video/video-abuse-interface'
+ ActivityAccept,
+ ActivityAdd,
+ ActivityCreate,
+ ActivityDelete,
+ ActivityFollow,
+ ActivityUpdate
+} from '../../../shared/models/activitypub/activity'
import { getActivityPubUrl } from '../../helpers/activitypub'
import { logger } from '../../helpers/logger'
+import { database as db } from '../../initializers'
+import { AccountInstance, VideoChannelInstance, VideoInstance } from '../../models'
+import { VideoAbuseInstance } from '../../models/video/video-abuse-interface'
+import { activitypubHttpJobScheduler } from '../jobs'
+
+async function sendCreateVideoChannel (videoChannel: VideoChannelInstance, t: Transaction) {
+ const byAccount = videoChannel.Account
-async function sendCreateVideoChannel (videoChannel: VideoChannelInstance, t: Sequelize.Transaction) {
const videoChannelObject = videoChannel.toActivityPubObject()
- const data = await createActivityData(videoChannel.url, videoChannel.Account, videoChannelObject)
+ const data = await createActivityData(videoChannel.url, byAccount, videoChannelObject)
- return broadcastToFollowers(data, [ videoChannel.Account ], t)
+ return broadcastToFollowers(data, byAccount, [ byAccount ], t)
}
-async function sendUpdateVideoChannel (videoChannel: VideoChannelInstance, t: Sequelize.Transaction) {
+async function sendUpdateVideoChannel (videoChannel: VideoChannelInstance, t: Transaction) {
+ const byAccount = videoChannel.Account
+
const videoChannelObject = videoChannel.toActivityPubObject()
- const data = await updateActivityData(videoChannel.url, videoChannel.Account, videoChannelObject)
+ const data = await updateActivityData(videoChannel.url, byAccount, videoChannelObject)
const accountsInvolved = await db.VideoChannelShare.loadAccountsByShare(videoChannel.id)
- accountsInvolved.push(videoChannel.Account)
+ accountsInvolved.push(byAccount)
- return broadcastToFollowers(data, accountsInvolved, t)
+ return broadcastToFollowers(data, byAccount, accountsInvolved, t)
}
-async function sendDeleteVideoChannel (videoChannel: VideoChannelInstance, t: Sequelize.Transaction) {
- const data = await deleteActivityData(videoChannel.url, videoChannel.Account)
+async function sendDeleteVideoChannel (videoChannel: VideoChannelInstance, t: Transaction) {
+ const byAccount = videoChannel.Account
+
+ const data = await deleteActivityData(videoChannel.url, byAccount)
const accountsInvolved = await db.VideoChannelShare.loadAccountsByShare(videoChannel.id)
- accountsInvolved.push(videoChannel.Account)
+ accountsInvolved.push(byAccount)
- return broadcastToFollowers(data, accountsInvolved, t)
+ return broadcastToFollowers(data, byAccount, accountsInvolved, t)
}
-async function sendAddVideo (video: VideoInstance, t: Sequelize.Transaction) {
+async function sendAddVideo (video: VideoInstance, t: Transaction) {
+ const byAccount = video.VideoChannel.Account
+
const videoObject = video.toActivityPubObject()
- const data = await addActivityData(video.url, video.VideoChannel.Account, video.VideoChannel.url, videoObject)
+ const data = await addActivityData(video.url, byAccount, video.VideoChannel.url, videoObject)
- return broadcastToFollowers(data, [ video.VideoChannel.Account ], t)
+ return broadcastToFollowers(data, byAccount, [ byAccount ], t)
}
-async function sendUpdateVideo (video: VideoInstance, t: Sequelize.Transaction) {
+async function sendUpdateVideo (video: VideoInstance, t: Transaction) {
+ const byAccount = video.VideoChannel.Account
+
const videoObject = video.toActivityPubObject()
- const data = await updateActivityData(video.url, video.VideoChannel.Account, videoObject)
+ const data = await updateActivityData(video.url, byAccount, videoObject)
const accountsInvolved = await db.VideoShare.loadAccountsByShare(video.id)
- accountsInvolved.push(video.VideoChannel.Account)
+ accountsInvolved.push(byAccount)
- return broadcastToFollowers(data, accountsInvolved, t)
+ return broadcastToFollowers(data, byAccount, accountsInvolved, t)
}
-async function sendDeleteVideo (video: VideoInstance, t: Sequelize.Transaction) {
- const data = await deleteActivityData(video.url, video.VideoChannel.Account)
+async function sendDeleteVideo (video: VideoInstance, t: Transaction) {
+ const byAccount = video.VideoChannel.Account
+
+ const data = await deleteActivityData(video.url, byAccount)
const accountsInvolved = await db.VideoShare.loadAccountsByShare(video.id)
- accountsInvolved.push(video.VideoChannel.Account)
+ accountsInvolved.push(byAccount)
- return broadcastToFollowers(data, accountsInvolved, t)
+ return broadcastToFollowers(data, byAccount, accountsInvolved, t)
}
-async function sendDeleteAccount (account: AccountInstance, t: Sequelize.Transaction) {
+async function sendDeleteAccount (account: AccountInstance, t: Transaction) {
const data = await deleteActivityData(account.url, account)
- return broadcastToFollowers(data, [ account ], t)
+ return broadcastToFollowers(data, account, [ account ], t)
}
-async function sendVideoChannelAnnounce (byAccount: AccountInstance, videoChannel: VideoChannelInstance, t: Sequelize.Transaction) {
+async function sendVideoChannelAnnounce (byAccount: AccountInstance, videoChannel: VideoChannelInstance, t: Transaction) {
const url = getActivityPubUrl('videoChannel', videoChannel.uuid) + '#announce'
- const announcedActivity = await createActivityData(url, videoChannel.Account, videoChannel.toActivityPubObject(), true)
+ const announcedActivity = await createActivityData(url, videoChannel.Account, videoChannel.toActivityPubObject())
const data = await announceActivityData(url, byAccount, announcedActivity)
- return broadcastToFollowers(data, [ byAccount ], t)
+ return broadcastToFollowers(data, byAccount, [ byAccount ], t)
}
-async function sendVideoAnnounce (byAccount: AccountInstance, video: VideoInstance, t: Sequelize.Transaction) {
+async function sendVideoAnnounce (byAccount: AccountInstance, video: VideoInstance, t: Transaction) {
const url = getActivityPubUrl('video', video.uuid) + '#announce'
const videoChannel = video.VideoChannel
- const announcedActivity = await addActivityData(url, videoChannel.Account, videoChannel.url, video.toActivityPubObject(), true)
+ const announcedActivity = await addActivityData(url, videoChannel.Account, videoChannel.url, video.toActivityPubObject())
const data = await announceActivityData(url, byAccount, announcedActivity)
- return broadcastToFollowers(data, [ byAccount ], t)
+ return broadcastToFollowers(data, byAccount, [ byAccount ], t)
}
-async function sendVideoAbuse (
- fromAccount: AccountInstance,
- videoAbuse: VideoAbuseInstance,
- video: VideoInstance,
- t: Sequelize.Transaction
-) {
+async function sendVideoAbuse (byAccount: AccountInstance, videoAbuse: VideoAbuseInstance, video: VideoInstance, t: Transaction) {
const url = getActivityPubUrl('videoAbuse', videoAbuse.id.toString())
- const data = await createActivityData(url, fromAccount, videoAbuse.toActivityPubObject())
+ const data = await createActivityData(url, byAccount, videoAbuse.toActivityPubObject())
- return unicastTo(data, video.VideoChannel.Account.sharedInboxUrl, t)
+ return unicastTo(data, byAccount, video.VideoChannel.Account.sharedInboxUrl, t)
}
-async function sendAccept (fromAccount: AccountInstance, toAccount: AccountInstance, t: Sequelize.Transaction) {
- const data = await acceptActivityData(fromAccount)
+async function sendAccept (byAccount: AccountInstance, toAccount: AccountInstance, t: Transaction) {
+ const data = await acceptActivityData(byAccount)
- return unicastTo(data, toAccount.inboxUrl, t)
+ return unicastTo(data, byAccount, toAccount.inboxUrl, t)
}
-async function sendFollow (fromAccount: AccountInstance, toAccount: AccountInstance, t: Sequelize.Transaction) {
- const data = await followActivityData(toAccount.url, fromAccount)
+async function sendFollow (byAccount: AccountInstance, toAccount: AccountInstance, t: Transaction) {
+ const data = await followActivityData(toAccount.url, byAccount)
- return unicastTo(data, toAccount.inboxUrl, t)
+ return unicastTo(data, byAccount, toAccount.inboxUrl, t)
}
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
-async function broadcastToFollowers (data: any, toAccountFollowers: AccountInstance[], t: Sequelize.Transaction) {
+async function broadcastToFollowers (data: any, byAccount: AccountInstance, toAccountFollowers: AccountInstance[], t: Transaction) {
const toAccountFollowerIds = toAccountFollowers.map(a => a.id)
const result = await db.AccountFollow.listAcceptedFollowerSharedInboxUrls(toAccountFollowerIds)
if (result.data.length === 0) {
const jobPayload = {
uris: result.data,
+ signatureAccountId: byAccount.id,
body: data
}
- return httpRequestJobScheduler.createJob(t, 'httpRequestBroadcastHandler', jobPayload)
+ return activitypubHttpJobScheduler.createJob(t, 'activitypubHttpBroadcastHandler', jobPayload)
}
-async function unicastTo (data: any, toAccountUrl: string, t: Sequelize.Transaction) {
+async function unicastTo (data: any, byAccount: AccountInstance, toAccountUrl: string, t: Transaction) {
const jobPayload = {
uris: [ toAccountUrl ],
+ signatureAccountId: byAccount.id,
body: data
}
- return httpRequestJobScheduler.createJob(t, 'httpRequestUnicastHandler', jobPayload)
-}
-
-function buildSignedActivity (byAccount: AccountInstance, data: Object) {
- const activity = activityPubContextify(data)
-
- return signObject(byAccount, activity) as Promise<Activity>
+ return activitypubHttpJobScheduler.createJob(t, 'activitypubHttpUnicastHandler', jobPayload)
}
async function getPublicActivityTo (account: AccountInstance) {
return inboxUrls.concat('https://www.w3.org/ns/activitystreams#Public')
}
-async function createActivityData (url: string, byAccount: AccountInstance, object: any, raw = false) {
+async function createActivityData (url: string, byAccount: AccountInstance, object: any) {
const to = await getPublicActivityTo(byAccount)
- const base = {
+ const activity: ActivityCreate = {
type: 'Create',
id: url,
actor: byAccount.url,
object
}
- if (raw === true) return base
-
- return buildSignedActivity(byAccount, base)
+ return activity
}
async function updateActivityData (url: string, byAccount: AccountInstance, object: any) {
const to = await getPublicActivityTo(byAccount)
- const base = {
+ const activity: ActivityUpdate = {
type: 'Update',
id: url,
actor: byAccount.url,
object
}
- return buildSignedActivity(byAccount, base)
+ return activity
}
async function deleteActivityData (url: string, byAccount: AccountInstance) {
- const base = {
+ const activity: ActivityDelete = {
type: 'Delete',
id: url,
actor: byAccount.url
}
- return buildSignedActivity(byAccount, base)
+ return activity
}
-async function addActivityData (url: string, byAccount: AccountInstance, target: string, object: any, raw = false) {
+async function addActivityData (url: string, byAccount: AccountInstance, target: string, object: any) {
const to = await getPublicActivityTo(byAccount)
- const base = {
+ const activity: ActivityAdd = {
type: 'Add',
id: url,
actor: byAccount.url,
target
}
- if (raw === true) return base
-
- return buildSignedActivity(byAccount, base)
+ return activity
}
async function announceActivityData (url: string, byAccount: AccountInstance, object: any) {
- const base = {
+ const activity = {
type: 'Announce',
id: url,
actor: byAccount.url,
object
}
- return buildSignedActivity(byAccount, base)
+ return activity
}
async function followActivityData (url: string, byAccount: AccountInstance) {
- const base = {
+ const activity: ActivityFollow = {
type: 'Follow',
id: byAccount.url,
actor: byAccount.url,
object: url
}
- return buildSignedActivity(byAccount, base)
+ return activity
}
async function acceptActivityData (byAccount: AccountInstance) {
- const base = {
+ const activity: ActivityAccept = {
type: 'Accept',
id: byAccount.url,
actor: byAccount.url
}
- return buildSignedActivity(byAccount, base)
+ return activity
}
--- /dev/null
+import { logger } from '../../../helpers'
+import { buildSignedActivity } from '../../../helpers/activitypub'
+import { doRequest } from '../../../helpers/requests'
+import { database as db } from '../../../initializers'
+import { ActivityPubHttpPayload } from './activitypub-http-job-scheduler'
+
+async function process (payload: ActivityPubHttpPayload, jobId: number) {
+ logger.info('Processing ActivityPub broadcast in job %d.', jobId)
+
+ const accountSignature = await db.Account.load(payload.signatureAccountId)
+ if (!accountSignature) throw new Error('Unknown signature account id.')
+
+ const signedBody = await buildSignedActivity(accountSignature, payload.body)
+
+ const options = {
+ method: 'POST',
+ uri: '',
+ json: signedBody
+ }
+
+ for (const uri of payload.uris) {
+ options.uri = uri
+ await doRequest(options)
+ }
+}
+
+function onError (err: Error, jobId: number) {
+ logger.error('Error when broadcasting ActivityPub request in job %d.', jobId, err)
+ return Promise.resolve()
+}
+
+function onSuccess (jobId: number) {
+ logger.info('Job %d is a success.', jobId)
+ return Promise.resolve()
+}
+
+// ---------------------------------------------------------------------------
+
+export {
+ process,
+ onError,
+ onSuccess
+}
--- /dev/null
+import { JobScheduler, JobHandler } from '../job-scheduler'
+
+import * as activitypubHttpBroadcastHandler from './activitypub-http-broadcast-handler'
+import * as activitypubHttpUnicastHandler from './activitypub-http-unicast-handler'
+import { JobCategory } from '../../../../shared'
+
+type ActivityPubHttpPayload = {
+ uris: string[]
+ signatureAccountId: number
+ body: any
+}
+const jobHandlers: { [ handlerName: string ]: JobHandler<ActivityPubHttpPayload, void> } = {
+ activitypubHttpBroadcastHandler,
+ activitypubHttpUnicastHandler
+}
+const jobCategory: JobCategory = 'activitypub-http'
+
+const activitypubHttpJobScheduler = new JobScheduler(jobCategory, jobHandlers)
+
+export {
+ ActivityPubHttpPayload,
+ activitypubHttpJobScheduler
+}
--- /dev/null
+import { logger } from '../../../helpers'
+import { doRequest } from '../../../helpers/requests'
+import { ActivityPubHttpPayload } from './activitypub-http-job-scheduler'
+import { database as db } from '../../../initializers/database'
+import { buildSignedActivity } from '../../../helpers/activitypub'
+
+async function process (payload: ActivityPubHttpPayload, jobId: number) {
+ logger.info('Processing ActivityPub unicast in job %d.', jobId)
+
+ const accountSignature = await db.Account.load(payload.signatureAccountId)
+ if (!accountSignature) throw new Error('Unknown signature account id.')
+
+ const signedBody = await buildSignedActivity(accountSignature, payload.body)
+ const uri = payload.uris[0]
+ const options = {
+ method: 'POST',
+ uri,
+ json: signedBody
+ }
+
+ await doRequest(options)
+}
+
+function onError (err: Error, jobId: number) {
+ logger.error('Error when sending ActivityPub request in job %d.', jobId, err)
+ return Promise.resolve()
+}
+
+function onSuccess (jobId: number) {
+ logger.info('Job %d is a success.', jobId)
+ return Promise.resolve()
+}
+
+// ---------------------------------------------------------------------------
+
+export {
+ process,
+ onError,
+ onSuccess
+}
--- /dev/null
+export * from './activitypub-http-job-scheduler'
+++ /dev/null
-import { logger } from '../../../helpers'
-import { doRequest } from '../../../helpers/requests'
-import { HTTPRequestPayload } from './http-request-job-scheduler'
-
-async function process (payload: HTTPRequestPayload, jobId: number) {
- logger.info('Processing broadcast in job %d.', jobId)
-
- const options = {
- method: 'POST',
- uri: '',
- json: payload.body
- }
-
- for (const uri of payload.uris) {
- options.uri = uri
- await doRequest(options)
- }
-}
-
-function onError (err: Error, jobId: number) {
- logger.error('Error when broadcasting request in job %d.', jobId, err)
- return Promise.resolve()
-}
-
-function onSuccess (jobId: number) {
- logger.info('Job %d is a success.', jobId)
- return Promise.resolve()
-}
-
-// ---------------------------------------------------------------------------
-
-export {
- process,
- onError,
- onSuccess
-}
+++ /dev/null
-import { JobScheduler, JobHandler } from '../job-scheduler'
-
-import * as httpRequestBroadcastHandler from './http-request-broadcast-handler'
-import * as httpRequestUnicastHandler from './http-request-unicast-handler'
-import { JobCategory } from '../../../../shared'
-
-type HTTPRequestPayload = {
- uris: string[]
- body: any
-}
-const jobHandlers: { [ handlerName: string ]: JobHandler<HTTPRequestPayload, void> } = {
- httpRequestBroadcastHandler,
- httpRequestUnicastHandler
-}
-const jobCategory: JobCategory = 'http-request'
-
-const httpRequestJobScheduler = new JobScheduler(jobCategory, jobHandlers)
-
-export {
- HTTPRequestPayload,
- httpRequestJobScheduler
-}
+++ /dev/null
-import { logger } from '../../../helpers'
-import { doRequest } from '../../../helpers/requests'
-import { HTTPRequestPayload } from './http-request-job-scheduler'
-
-async function process (payload: HTTPRequestPayload, jobId: number) {
- logger.info('Processing unicast in job %d.', jobId)
-
- const uri = payload.uris[0]
- const options = {
- method: 'POST',
- uri,
- json: payload.body
- }
-
- await doRequest(options)
-}
-
-function onError (err: Error, jobId: number) {
- logger.error('Error when sending request in job %d.', jobId, err)
- return Promise.resolve()
-}
-
-function onSuccess (jobId: number) {
- logger.info('Job %d is a success.', jobId)
- return Promise.resolve()
-}
-
-// ---------------------------------------------------------------------------
-
-export {
- process,
- onError,
- onSuccess
-}
+++ /dev/null
-export * from './http-request-job-scheduler'
-export * from './http-request-job-scheduler'
+export * from './activitypub-http-job-scheduler'
export * from './transcoding-job-scheduler'
import './video-description'
import './video-privacy'
import './services'
-import './request-schedulers'
expect(video.tags).to.deep.equal([ 'tag1p1', 'tag2p1' ])
expect(dateIsValid(video.createdAt)).to.be.true
expect(dateIsValid(video.updatedAt)).to.be.true
- expect(video.author).to.equal('root')
+ expect(video.account).to.equal('root')
const res2 = await getVideo(server.url, video.uuid)
const videoDetails = res2.body
expect(video.tags).to.deep.equal([ 'tag1p2', 'tag2p2', 'tag3p2' ])
expect(dateIsValid(video.createdAt)).to.be.true
expect(dateIsValid(video.updatedAt)).to.be.true
- expect(video.author).to.equal('user1')
+ expect(video.account).to.equal('user1')
if (server.url !== 'http://localhost:9002') {
expect(video.isLocal).to.be.false
expect(baseVideo.licence).to.equal(video.licence)
expect(baseVideo.category).to.equal(video.category)
expect(baseVideo.nsfw).to.equal(video.nsfw)
- expect(baseVideo.author).to.equal(video.author)
+ expect(baseVideo.author).to.equal(video.account)
expect(baseVideo.tags).to.deep.equal(video.tags)
}
})
+++ /dev/null
-/* tslint:disable:no-unused-expression */
-
-import 'mocha'
-import * as chai from 'chai'
-const expect = chai.expect
-
-import {
- ServerInfo,
- flushTests,
- uploadVideo,
- makeFriends,
- wait,
- setAccessTokensToServers,
- flushAndRunMultipleServers,
- getRequestsStats,
- killallServers
-} from '../utils'
-
-describe('Test requests schedulers stats', function () {
- const requestSchedulerNames = [ 'requestScheduler', 'requestVideoQaduScheduler', 'requestVideoEventScheduler' ]
- let servers: ServerInfo[] = []
-
- function uploadVideoWrapper (server: ServerInfo) {
- const videoAttributes = {
- tags: [ 'tag1', 'tag2' ]
- }
-
- return uploadVideo(server.url, server.accessToken, videoAttributes)
- }
-
- // ---------------------------------------------------------------
-
- before(async function () {
- this.timeout(120000)
-
- servers = await flushAndRunMultipleServers(2)
-
- await setAccessTokensToServers(servers)
-
- await makeFriends(servers[0].url, servers[0].accessToken)
- })
-
- it('Should have a correct timer', async function () {
- const server = servers[0]
-
- const res = await getRequestsStats(server)
-
- const requestSchedulers = res.body
- for (const requestSchedulerName of requestSchedulerNames) {
- const requestScheduler = requestSchedulers[requestSchedulerName]
-
- expect(requestScheduler.remainingMilliSeconds).to.be.at.least(0)
- expect(requestScheduler.remainingMilliSeconds).to.be.at.most(10000)
- }
- })
-
- it('Should have the correct total request', async function () {
- this.timeout(15000)
-
- const server = servers[0]
- // Ensure the requests of pod 1 won't be made
- servers[1].app.kill()
-
- await uploadVideoWrapper(server)
-
- await wait(1000)
-
- const res = await getRequestsStats(server)
- const requestSchedulers = res.body
- const requestScheduler = requestSchedulers.requestScheduler
- expect(requestScheduler.totalRequests).to.equal(3)
- })
-
- after(async function () {
- // Server 1 has already been killed
- killallServers([ servers[0] ])
-
- if (this['ok']) {
- await flushTests()
- }
- })
-})
getOEmbed
} from '../utils'
import { runServer } from '../utils/servers'
+import { Video } from '../../../client/src/app/videos/shared/video.model'
describe('Test services', function () {
let server: ServerInfo = null
expect(res.body.html).to.equal(expectedHtml)
expect(res.body.title).to.equal(server.video.name)
- expect(res.body.author_name).to.equal(server.video.author)
+ expect(res.body.author_name).to.equal(server.video.account)
expect(res.body.width).to.equal(560)
expect(res.body.height).to.equal(315)
expect(res.body.thumbnail_url).to.equal(expectedThumbnailUrl)
expect(res.body.html).to.equal(expectedHtml)
expect(res.body.title).to.equal(server.video.name)
- expect(res.body.author_name).to.equal(server.video.author)
+ expect(res.body.author_name).to.equal(server.video.account)
expect(res.body.height).to.equal(50)
expect(res.body.width).to.equal(50)
expect(res.body).to.not.have.property('thumbnail_url')
expect(video.languageLabel).to.equal('Mandarin')
expect(video.nsfw).to.be.ok
expect(video.description).to.equal('my super description')
- expect(video.podHost).to.equal('localhost:9001')
- expect(video.author).to.equal('root')
+ expect(video.serverHost).to.equal('localhost:9001')
+ expect(video.account).to.equal('root')
expect(video.isLocal).to.be.true
expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ])
expect(dateIsValid(video.createdAt)).to.be.true
expect(video.languageLabel).to.equal('Mandarin')
expect(video.nsfw).to.be.ok
expect(video.description).to.equal('my super description')
- expect(video.podHost).to.equal('localhost:9001')
- expect(video.author).to.equal('root')
+ expect(video.serverHost).to.equal('localhost:9001')
+ expect(video.account).to.equal('root')
expect(video.isLocal).to.be.true
expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ])
expect(dateIsValid(video.createdAt)).to.be.true
expect(video.languageLabel).to.equal('Mandarin')
expect(video.nsfw).to.be.ok
expect(video.description).to.equal('my super description')
- expect(video.podHost).to.equal('localhost:9001')
- expect(video.author).to.equal('root')
+ expect(video.serverHost).to.equal('localhost:9001')
+ expect(video.account).to.equal('root')
expect(video.isLocal).to.be.true
expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ])
expect(dateIsValid(video.createdAt)).to.be.true
})
// Not implemented yet
- // it('Should search the video by podHost', async function () {
+ // it('Should search the video by serverHost', async function () {
// const res = await videosUtils.searchVideo(server.url, '9001', 'host')
// expect(res.body.total).to.equal(1)
// const video = res.body.data[0]
// expect(video.name).to.equal('my super name')
// expect(video.description).to.equal('my super description')
- // expect(video.podHost).to.equal('localhost:9001')
+ // expect(video.serverHost).to.equal('localhost:9001')
// expect(video.author).to.equal('root')
// expect(video.isLocal).to.be.true
// expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ])
expect(video.languageLabel).to.equal('Mandarin')
expect(video.nsfw).to.be.ok
expect(video.description).to.equal('my super description')
- expect(video.podHost).to.equal('localhost:9001')
- expect(video.author).to.equal('root')
+ expect(video.serverHost).to.equal('localhost:9001')
+ expect(video.account).to.equal('root')
expect(video.isLocal).to.be.true
expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ])
expect(dateIsValid(video.createdAt)).to.be.true
})
it('Should not find a search by author', async function () {
- const res = await searchVideo(server.url, 'hello', 'author')
+ const res = await searchVideo(server.url, 'hello', 'account')
expect(res.body.total).to.equal(0)
expect(res.body.data).to.be.an('array')
'video_short1.webm', 'video_short2.webm', 'video_short3.webm'
]
- const tasks: Promise<any>[] = []
+ // const tasks: Promise<any>[] = []
for (const video of videos) {
const videoAttributes = {
name: video + ' name',
}
const p = uploadVideo(server.url, server.accessToken, videoAttributes)
- tasks.push(p)
+ await p
}
-
- await Promise.all(tasks)
+ // FIXME: concurrent uploads does not work :(
+ // tasks.push(p)
+ // }
+ //
+ // await Promise.all(tasks)
})
it('Should have the correct durations', async function () {
})
it('Should search all the root author videos', async function () {
- const res = await searchVideoWithPagination(server.url, 'root', 'author', 0, 15)
+ const res = await searchVideoWithPagination(server.url, 'root', 'account', 0, 15)
const videos = res.body.data
expect(res.body.total).to.equal(6)
expect(video.languageLabel).to.equal('Arabic')
expect(video.nsfw).to.be.ok
expect(video.description).to.equal('my super description updated')
- expect(video.podHost).to.equal('localhost:9001')
- expect(video.author).to.equal('root')
+ expect(video.serverHost).to.equal('localhost:9001')
+ expect(video.account).to.equal('root')
expect(video.isLocal).to.be.true
expect(video.tags).to.deep.equal([ 'tagup1', 'tagup2' ])
expect(dateIsValid(video.createdAt)).to.be.true
expect(video.languageLabel).to.equal('Arabic')
expect(video.nsfw).to.be.ok
expect(video.description).to.equal('my super description updated')
- expect(video.podHost).to.equal('localhost:9001')
- expect(video.author).to.equal('root')
+ expect(video.serverHost).to.equal('localhost:9001')
+ expect(video.account).to.equal('root')
expect(video.isLocal).to.be.true
expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'supertag' ])
expect(dateIsValid(video.createdAt)).to.be.true
expect(video.languageLabel).to.equal('Arabic')
expect(video.nsfw).to.be.ok
expect(video.description).to.equal('hello everybody')
- expect(video.podHost).to.equal('localhost:9001')
- expect(video.author).to.equal('root')
+ expect(video.serverHost).to.equal('localhost:9001')
+ expect(video.account).to.equal('root')
expect(video.isLocal).to.be.true
expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'supertag' ])
expect(dateIsValid(video.createdAt)).to.be.true
/* tslint:disable:no-unused-expression */
-
-import 'mocha'
import * as chai from 'chai'
-const expect = chai.expect
-
+import 'mocha'
+import { UserRole } from '../../../shared'
import {
- ServerInfo,
- flushTests,
- runServer,
- login,
- uploadVideo,
- makeFriends,
- quitFriends,
- getVideosList,
- rateVideo,
- getUserVideoRating,
- removeVideo,
- makePutBodyRequest,
createUser,
- loginAndGetAccessToken,
+ flushTests,
+ getBlacklistedVideosList,
getMyUserInformation,
+ getUserInformation,
getUsersList,
getUsersListPaginationAndSort,
- updateUser,
- updateMyUser,
+ getUserVideoRating,
+ getVideosList,
+ killallServers,
+ login,
+ loginAndGetAccessToken,
+ makePutBodyRequest,
+ rateVideo,
registerUser,
removeUser,
- killallServers,
- getUserInformation,
- getBlacklistedVideosList
+ removeVideo,
+ runServer,
+ ServerInfo,
+ updateMyUser,
+ updateUser,
+ uploadVideo
} from '../utils'
-import { UserRole } from '../../../shared'
+import { follow } from '../utils/follows'
import { getMyVideos } from '../utils/videos'
+const expect = chai.expect
+
describe('Test users', function () {
let server: ServerInfo
let accessToken: string
const client = { id: 'client', secret: server.client.secret }
const res = await login(server.url, client, server.user, 400)
- expect(res.body.error).to.equal('invalid_client')
+ expect(res.body.error)
+ .to
+ .equal('invalid_client')
})
it('Should not login with an invalid client secret', async function () {
const client = { id: server.client.id, secret: 'coucou' }
const res = await login(server.url, client, server.user, 400)
- expect(res.body.error).to.equal('invalid_client')
+ expect(res.body.error)
+ .to
+ .equal('invalid_client')
})
it('Should not login with an invalid username', async function () {
const user = { username: 'captain crochet', password: server.user.password }
const res = await login(server.url, server.client, user, 400)
- expect(res.body.error).to.equal('invalid_grant')
+ expect(res.body.error)
+ .to
+ .equal('invalid_grant')
})
it('Should not login with an invalid password', async function () {
const user = { username: server.user.username, password: 'mew_three' }
const res = await login(server.url, server.client, user, 400)
- expect(res.body.error).to.equal('invalid_grant')
+ expect(res.body.error)
+ .to
+ .equal('invalid_grant')
})
it('Should not be able to upload a video', async function () {
await uploadVideo(server.url, accessToken, videoAttributes, 401)
})
- it('Should not be able to make friends', async function () {
+ it('Should not be able to follow', async function () {
accessToken = 'my_super_token'
- await makeFriends(server.url, accessToken, 401)
+ await follow(server.url, [ 'http://example.com' ], accessToken, 401)
})
- it('Should not be able to quit friends', async function () {
- accessToken = 'my_super_token'
- await quitFriends(server.url, accessToken, 401)
- })
+ it('Should not be able to unfollow')
it('Should be able to login', async function () {
const res = await login(server.url, server.client, server.user, 200)
const videoAttributes = {}
await uploadVideo(server.url, accessToken, videoAttributes, 204)
const res = await getVideosList(server.url)
- const video = res.body.data[0]
+ const video = res.body.data[ 0 ]
- expect(video.author).to.equal('root')
+ expect(video.account)
+ .to
+ .equal('root')
videoId = video.id
})
const res = await getUserVideoRating(server.url, accessToken, videoId)
const rating = res.body
- expect(rating.videoId).to.equal(videoId)
- expect(rating.rating).to.equal('like')
+ expect(rating.videoId)
+ .to
+ .equal(videoId)
+ expect(rating.rating)
+ .to
+ .equal('like')
})
it('Should not be able to remove the video with an incorrect token', async function () {
const res = await getMyUserInformation(server.url, accessTokenUser)
const user = res.body
- expect(user.username).to.equal('user_1')
- expect(user.email).to.equal('user_1@example.com')
+ expect(user.username)
+ .to
+ .equal('user_1')
+ expect(user.email)
+ .to
+ .equal('user_1@example.com')
expect(user.displayNSFW).to.be.false
- expect(user.videoQuota).to.equal(2 * 1024 * 1024)
- expect(user.roleLabel).to.equal('User')
- expect(user.id).to.be.a('number')
+ expect(user.videoQuota)
+ .to
+ .equal(2 * 1024 * 1024)
+ expect(user.roleLabel)
+ .to
+ .equal('User')
+ expect(user.id)
+ .to
+ .be
+ .a('number')
})
it('Should be able to upload a video with this user', async function () {
it('Should be able to list my videos', async function () {
const res = await getMyVideos(server.url, accessTokenUser, 0, 5)
- expect(res.body.total).to.equal(1)
+ expect(res.body.total)
+ .to
+ .equal(1)
const videos = res.body.data
- expect(videos).to.have.lengthOf(1)
+ expect(videos)
+ .to
+ .have
+ .lengthOf(1)
- expect(videos[0].name).to.equal('super user video')
+ expect(videos[ 0 ].name)
+ .to
+ .equal('super user video')
})
it('Should list all the users', async function () {
const total = result.total
const users = result.data
- expect(total).to.equal(2)
- expect(users).to.be.an('array')
- expect(users.length).to.equal(2)
-
- const user = users[0]
- expect(user.username).to.equal('user_1')
- expect(user.email).to.equal('user_1@example.com')
+ expect(total)
+ .to
+ .equal(2)
+ expect(users)
+ .to
+ .be
+ .an('array')
+ expect(users.length)
+ .to
+ .equal(2)
+
+ const user = users[ 0 ]
+ expect(user.username)
+ .to
+ .equal('user_1')
+ expect(user.email)
+ .to
+ .equal('user_1@example.com')
expect(user.displayNSFW).to.be.false
- const rootUser = users[1]
- expect(rootUser.username).to.equal('root')
- expect(rootUser.email).to.equal('admin1@example.com')
+ const rootUser = users[ 1 ]
+ expect(rootUser.username)
+ .to
+ .equal('root')
+ expect(rootUser.email)
+ .to
+ .equal('admin1@example.com')
expect(rootUser.displayNSFW).to.be.false
userId = user.id
const total = result.total
const users = result.data
- expect(total).to.equal(2)
- expect(users.length).to.equal(1)
-
- const user = users[0]
- expect(user.username).to.equal('root')
- expect(user.email).to.equal('admin1@example.com')
- expect(user.roleLabel).to.equal('Administrator')
+ expect(total)
+ .to
+ .equal(2)
+ expect(users.length)
+ .to
+ .equal(1)
+
+ const user = users[ 0 ]
+ expect(user.username)
+ .to
+ .equal('root')
+ expect(user.email)
+ .to
+ .equal('admin1@example.com')
+ expect(user.roleLabel)
+ .to
+ .equal('Administrator')
expect(user.displayNSFW).to.be.false
})
const total = result.total
const users = result.data
- expect(total).to.equal(2)
- expect(users.length).to.equal(1)
-
- const user = users[0]
- expect(user.username).to.equal('user_1')
- expect(user.email).to.equal('user_1@example.com')
+ expect(total)
+ .to
+ .equal(2)
+ expect(users.length)
+ .to
+ .equal(1)
+
+ const user = users[ 0 ]
+ expect(user.username)
+ .to
+ .equal('user_1')
+ expect(user.email)
+ .to
+ .equal('user_1@example.com')
expect(user.displayNSFW).to.be.false
})
const total = result.total
const users = result.data
- expect(total).to.equal(2)
- expect(users.length).to.equal(1)
-
- const user = users[0]
- expect(user.username).to.equal('user_1')
- expect(user.email).to.equal('user_1@example.com')
+ expect(total)
+ .to
+ .equal(2)
+ expect(users.length)
+ .to
+ .equal(1)
+
+ const user = users[ 0 ]
+ expect(user.username)
+ .to
+ .equal('user_1')
+ expect(user.email)
+ .to
+ .equal('user_1@example.com')
expect(user.displayNSFW).to.be.false
})
const total = result.total
const users = result.data
- expect(total).to.equal(2)
- expect(users.length).to.equal(2)
-
- expect(users[0].username).to.equal('root')
- expect(users[0].email).to.equal('admin1@example.com')
- expect(users[0].displayNSFW).to.be.false
-
- expect(users[1].username).to.equal('user_1')
- expect(users[1].email).to.equal('user_1@example.com')
- expect(users[1].displayNSFW).to.be.false
+ expect(total)
+ .to
+ .equal(2)
+ expect(users.length)
+ .to
+ .equal(2)
+
+ expect(users[ 0 ].username)
+ .to
+ .equal('root')
+ expect(users[ 0 ].email)
+ .to
+ .equal('admin1@example.com')
+ expect(users[ 0 ].displayNSFW).to.be.false
+
+ expect(users[ 1 ].username)
+ .to
+ .equal('user_1')
+ expect(users[ 1 ].email)
+ .to
+ .equal('user_1@example.com')
+ expect(users[ 1 ].displayNSFW).to.be.false
})
it('Should update my password', async function () {
const res = await getMyUserInformation(server.url, accessTokenUser)
const user = res.body
- expect(user.username).to.equal('user_1')
- expect(user.email).to.equal('user_1@example.com')
+ expect(user.username)
+ .to
+ .equal('user_1')
+ expect(user.email)
+ .to
+ .equal('user_1@example.com')
expect(user.displayNSFW).to.be.ok
- expect(user.videoQuota).to.equal(2 * 1024 * 1024)
- expect(user.id).to.be.a('number')
+ expect(user.videoQuota)
+ .to
+ .equal(2 * 1024 * 1024)
+ expect(user.id)
+ .to
+ .be
+ .a('number')
})
it('Should be able to change the email display attribute', async function () {
const res = await getMyUserInformation(server.url, accessTokenUser)
const user = res.body
- expect(user.username).to.equal('user_1')
- expect(user.email).to.equal('updated@example.com')
+ expect(user.username)
+ .to
+ .equal('user_1')
+ expect(user.email)
+ .to
+ .equal('updated@example.com')
expect(user.displayNSFW).to.be.ok
- expect(user.videoQuota).to.equal(2 * 1024 * 1024)
- expect(user.id).to.be.a('number')
+ expect(user.videoQuota)
+ .to
+ .equal(2 * 1024 * 1024)
+ expect(user.id)
+ .to
+ .be
+ .a('number')
})
it('Should be able to update another user', async function () {
const res = await getUserInformation(server.url, accessToken, userId)
const user = res.body
- expect(user.username).to.equal('user_1')
- expect(user.email).to.equal('updated2@example.com')
+ expect(user.username)
+ .to
+ .equal('user_1')
+ expect(user.email)
+ .to
+ .equal('updated2@example.com')
expect(user.displayNSFW).to.be.ok
- expect(user.videoQuota).to.equal(42)
- expect(user.roleLabel).to.equal('Moderator')
- expect(user.id).to.be.a('number')
+ expect(user.videoQuota)
+ .to
+ .equal(42)
+ expect(user.roleLabel)
+ .to
+ .equal('Moderator')
+ expect(user.id)
+ .to
+ .be
+ .a('number')
})
it('Should not be able to delete a user by a moderator', async function () {
it('Should not have videos of this user', async function () {
const res = await getVideosList(server.url)
- expect(res.body.total).to.equal(1)
+ expect(res.body.total)
+ .to
+ .equal(1)
- const video = res.body.data[0]
- expect(video.author).to.equal('root')
+ const video = res.body.data[ 0 ]
+ expect(video.account)
+ .to
+ .equal('root')
})
it('Should register a new user', async function () {
const res = await getMyUserInformation(server.url, accessToken)
const user = res.body
- expect(user.videoQuota).to.equal(5 * 1024 * 1024)
+ expect(user.videoQuota)
+ .to
+ .equal(5 * 1024 * 1024)
})
after(async function () {
killallServers([ server ])
// Keep the logs if the test failed
- if (this['ok']) {
+ if (this[ 'ok' ]) {
await flushTests()
}
})
/* tslint:disable:no-unused-expression */
-import 'mocha'
import * as chai from 'chai'
-const expect = chai.expect
-
+import 'mocha'
import {
- ServerInfo,
flushAndRunMultipleServers,
- uploadVideo,
- makeFriends,
- getVideosList,
- wait,
- setAccessTokensToServers,
+ flushTests,
getVideoAbusesList,
- reportVideoAbuse,
+ getVideosList,
killallServers,
- flushTests
+ reportVideoAbuse,
+ ServerInfo,
+ setAccessTokensToServers,
+ uploadVideo,
+ wait
} from '../utils'
+import { doubleFollow } from '../utils/follows'
+
+const expect = chai.expect
describe('Test video abuses', function () {
let servers: ServerInfo[] = []
// Get the access tokens
await setAccessTokensToServers(servers)
- // Pod 1 makes friend with pod 2
- await makeFriends(servers[0].url, servers[0].accessToken)
+ // Server 1 and server 2 follow each other
+ await doubleFollow(servers[0], servers[1])
- // Upload some videos on each pods
+ // Upload some videos on each servers
const video1Attributes = {
- name: 'my super name for pod 1',
- description: 'my super description for pod 1'
+ name: 'my super name for server 1',
+ description: 'my super description for server 1'
}
await uploadVideo(servers[0].url, servers[0].accessToken, video1Attributes)
const video2Attributes = {
- name: 'my super name for pod 2',
- description: 'my super description for pod 2'
+ name: 'my super name for server 2',
+ description: 'my super description for server 2'
}
await uploadVideo(servers[1].url, servers[1].accessToken, video2Attributes)
// Wait videos propagation
- await wait(22000)
+ await wait(25000)
const res = await getVideosList(servers[0].url)
const videos = res.body.data
expect(videos.length).to.equal(2)
- servers[0].video = videos.find(video => video.name === 'my super name for pod 1')
- servers[1].video = videos.find(video => video.name === 'my super name for pod 2')
+ servers[0].video = videos.find(video => video.name === 'my super name for server 1')
+ servers[1].video = videos.find(video => video.name === 'my super name for server 2')
})
it('Should not have video abuses', async function () {
const reason = 'my super bad reason'
await reportVideoAbuse(servers[0].url, servers[0].accessToken, servers[0].video.id, reason)
- // We wait requests propagation, even if the pod 1 is not supposed to make a request to pod 2
+ // We wait requests propagation, even if the server 1 is not supposed to make a request to server 2
await wait(11000)
})
- it('Should have 1 video abuses on pod 1 and 0 on pod 2', async function () {
+ it('Should have 1 video abuses on server 1 and 0 on server 2', async function () {
const res1 = await getVideoAbusesList(servers[0].url, servers[0].accessToken)
expect(res1.body.total).to.equal(1)
const abuse = res1.body.data[0]
expect(abuse.reason).to.equal('my super bad reason')
expect(abuse.reporterUsername).to.equal('root')
- expect(abuse.reporterPodHost).to.equal('localhost:9001')
+ expect(abuse.reporterServerHost).to.equal('localhost:9001')
expect(abuse.videoId).to.equal(servers[0].video.id)
const res2 = await getVideoAbusesList(servers[1].url, servers[1].accessToken)
})
it('Should report abuse on a remote video', async function () {
- this.timeout(15000)
+ this.timeout(25000)
const reason = 'my super bad reason 2'
await reportVideoAbuse(servers[0].url, servers[0].accessToken, servers[1].video.id, reason)
// We wait requests propagation
- await wait(11000)
+ await wait(15000)
})
- it('Should have 2 video abuse on pod 1 and 1 on pod 2', async function () {
+ it('Should have 2 video abuse on server 1 and 1 on server 2', async function () {
const res1 = await getVideoAbusesList(servers[0].url, servers[0].accessToken)
expect(res1.body.total).to.equal(2)
expect(res1.body.data).to.be.an('array')
const abuse1 = res1.body.data[0]
expect(abuse1.reason).to.equal('my super bad reason')
expect(abuse1.reporterUsername).to.equal('root')
- expect(abuse1.reporterPodHost).to.equal('localhost:9001')
+ expect(abuse1.reporterServerHost).to.equal('localhost:9001')
expect(abuse1.videoId).to.equal(servers[0].video.id)
const abuse2 = res1.body.data[1]
expect(abuse2.reason).to.equal('my super bad reason 2')
expect(abuse2.reporterUsername).to.equal('root')
- expect(abuse2.reporterPodHost).to.equal('localhost:9001')
+ expect(abuse2.reporterServerHost).to.equal('localhost:9001')
expect(abuse2.videoId).to.equal(servers[1].video.id)
const res2 = await getVideoAbusesList(servers[1].url, servers[1].accessToken)
const abuse3 = res2.body.data[0]
expect(abuse3.reason).to.equal('my super bad reason 2')
expect(abuse3.reporterUsername).to.equal('root')
- expect(abuse3.reporterPodHost).to.equal('localhost:9001')
+ expect(abuse3.reporterServerHost).to.equal('localhost:9001')
})
after(async function () {
import * as request from 'supertest'
-
import { wait } from './miscs'
+import { ServerInfo } from './servers'
function getFollowersListPaginationAndSort (url: string, start: number, count: number, sort: string) {
- const path = '/api/v1/servers/followers'
+ const path = '/api/v1/server/followers'
return request(url)
.get(path)
}
function getFollowingListPaginationAndSort (url: string, start: number, count: number, sort: string) {
- const path = '/api/v1/servers/following'
+ const path = '/api/v1/server/following'
return request(url)
.get(path)
}
async function follow (follower: string, following: string[], accessToken: string, expectedStatus = 204) {
- const path = '/api/v1/servers/follow'
+ const path = '/api/v1/server/follow'
+ const followingHosts = following.map(f => f.replace(/^http:\/\//, ''))
const res = await request(follower)
.post(path)
.set('Accept', 'application/json')
.set('Authorization', 'Bearer ' + accessToken)
- .send({ 'hosts': following })
+ .send({ 'hosts': followingHosts })
.expect(expectedStatus)
// Wait request propagation
- await wait(1000)
+ await wait(20000)
return res
}
+async function doubleFollow (server1: ServerInfo, server2: ServerInfo) {
+ await Promise.all([
+ follow(server1.url, [ server2.url ], server1.accessToken),
+ follow(server2.url, [ server1.url ], server2.accessToken)
+ ])
+
+ return true
+}
+
// ---------------------------------------------------------------------------
export {
getFollowersListPaginationAndSort,
getFollowingListPaginationAndSort,
- follow
+ follow,
+ doubleFollow
}
id: number
uuid: string
name: string
- author: string
+ account: string
}
remoteVideo?: {
export interface BaseActivity {
'@context'?: any[]
id: string
- to: string[]
+ to?: string[]
actor: string
type: ActivityType
- signature: ActivityPubSignature
+ signature?: ActivityPubSignature
}
export interface ActivityCreate extends BaseActivity {
export type JobState = 'pending' | 'processing' | 'error' | 'success'
-export type JobCategory = 'transcoding' | 'http-request'
+export type JobCategory = 'transcoding' | 'activitypub-http'
dependencies:
"@types/express" "*"
-"@types/node@*", "@types/node@^8.0.3":
+"@types/node@*":
+ version "8.0.53"
+ resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.53.tgz#396b35af826fa66aad472c8cb7b8d5e277f4e6d8"
+
+"@types/node@^8.0.3":
version "8.0.47"
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.47.tgz#968e596f91acd59069054558a00708c445ca30c2"
moment ">= 2.9.0"
"moment@>= 2.9.0", moment@^2.13.0:
- version "2.19.1"
- resolved "https://registry.yarnpkg.com/moment/-/moment-2.19.1.tgz#56da1a2d1cbf01d38b7e1afc31c10bcfa1929167"
+ version "2.19.2"
+ resolved "https://registry.yarnpkg.com/moment/-/moment-2.19.2.tgz#8a7f774c95a64550b4c7ebd496683908f9419dbe"
morgan@^1.5.3:
version "1.9.0"
statuses "~1.3.1"
sequelize@^4.7.5:
- version "4.22.5"
- resolved "https://registry.yarnpkg.com/sequelize/-/sequelize-4.22.5.tgz#5771f8dc2173c61366d77b9fb89aeb34b0522435"
+ version "4.22.7"
+ resolved "https://registry.yarnpkg.com/sequelize/-/sequelize-4.22.7.tgz#9425ad640f9813455cdc49cbeaf54aece141d76e"
dependencies:
bluebird "^3.4.6"
cls-bluebird "^2.0.1"