matrix:
include:
- - env: TEST_SUITE=client
+ - env: TEST_SUITE=misc
- env: TEST_SUITE=api-fast
- env: TEST_SUITE=api-slow
- env: TEST_SUITE=cli
exit -1
fi
-if [ "$1" = "client" ]; then
+if [ "$1" = "misc" ]; then
npm run build
- mocha --exit --require ts-node/register --bail server/tests/client.ts
+ mocha --exit --require ts-node/register --bail server/tests/client.ts server/tests/activitypub.ts
elif [ "$1" = "api" ]; then
npm run build:server
mocha --exit --require ts-node/register --bail server/tests/api/index.ts
return getServerAccount()
})
.then(serverAccount => {
- return db.AccountFollow.listAcceptedFollowingUrlsForApi([ serverAccount.id ])
+ return db.AccountFollow.listAcceptedFollowingUrlsForApi([ serverAccount.id ], undefined)
})
.then(res => {
return res.total > 0
// Always serve index client page (the client is a single page application, let it handle routing)
app.use('/*', function (req, res) {
- res.sendFile(path.join(__dirname, '../client/dist/index.html'))
+ if (req.accepts('html')) {
+ return res.sendFile(path.join(__dirname, '../client/dist/index.html'))
+ }
+
+ return res.status(404).end()
})
// ----------- Errors -----------
const page = req.query.page || 1
const { start, count } = pageToStartAndCount(page, ACTIVITY_PUB.COLLECTION_ITEMS_PER_PAGE)
- const result = await db.AccountFollow.listAcceptedFollowerUrlsForApi([ account.id ], start, count)
+ const result = await db.AccountFollow.listAcceptedFollowerUrlsForApi([ account.id ], undefined, start, count)
const activityPubResult = activityPubCollectionPagination(CONFIG.WEBSERVER.URL + req.url, page, result)
return res.json(activityPubResult)
const page = req.query.page || 1
const { start, count } = pageToStartAndCount(page, ACTIVITY_PUB.COLLECTION_ITEMS_PER_PAGE)
- const result = await db.AccountFollow.listAcceptedFollowingUrlsForApi([ account.id ], start, count)
+ const result = await db.AccountFollow.listAcceptedFollowingUrlsForApi([ account.id ], undefined, start, count)
const activityPubResult = activityPubCollectionPagination(CONFIG.WEBSERVER.URL + req.url, page, result)
return res.json(activityPubResult)
const videoObject = video.toActivityPubObject()
// This is a shared video
+ const videoChannel = video.VideoChannel
if (video.VideoShares !== undefined && video.VideoShares.length !== 0) {
- const addActivity = await addActivityData(video.url, video.VideoChannel.Account, video, video.VideoChannel.url, videoObject)
+ const addActivity = await addActivityData(video.url, videoChannel.Account, video, videoChannel.url, videoObject, undefined)
const url = getAnnounceActivityPubUrl(video.url, account)
- const announceActivity = await announceActivityData(url, account, addActivity)
+ const announceActivity = await announceActivityData(url, account, addActivity, undefined)
activities.push(announceActivity)
} else {
- const addActivity = await addActivityData(video.url, account, video, video.VideoChannel.url, videoObject)
+ const addActivity = await addActivityData(video.url, account, video, videoChannel.url, videoObject, undefined)
activities.push(addActivity)
}
}
async function sendDeleteAccount (account: AccountInstance, t: Transaction) {
- const data = await deleteActivityData(account.url, account)
+ const data = deleteActivityData(account.url, account)
return broadcastToFollowers(data, account, [ account ], t)
}
if (areValidationErrors(req, res)) return
if (!await isVideoChannelExist(req.params.id, res)) return
- const share = await db.VideoChannelShare.load(res.locals.video.id, req.params.accountId)
+ const share = await db.VideoChannelShare.load(res.locals.video.id, req.params.accountId, undefined)
if (!share) {
return res.status(404)
.end()
if (areValidationErrors(req, res)) return
if (!await isVideoExist(req.params.id, res)) return
- const share = await db.VideoShare.load(req.params.accountId, res.locals.video.id)
+ const share = await db.VideoShare.load(req.params.accountId, res.locals.video.id, undefined)
if (!share) {
return res.status(404)
.end()
import * as Bluebird from 'bluebird'
import * as Sequelize from 'sequelize'
-import { Transaction } from 'sequelize'
import { AccountInstance } from '../account/account-interface'
import { VideoChannelInstance } from './video-channel-interface'
export namespace VideoChannelShareMethods {
- export type LoadAccountsByShare = (videoChannelId: number, t: Transaction) => Bluebird<AccountInstance[]>
- export type Load = (accountId: number, videoId: number, t: Transaction) => Bluebird<VideoChannelShareInstance>
+ export type LoadAccountsByShare = (videoChannelId: number, t: Sequelize.Transaction) => Bluebird<AccountInstance[]>
+ export type Load = (accountId: number, videoId: number, t: Sequelize.Transaction) => Bluebird<VideoChannelShareInstance>
}
export interface VideoChannelShareClass {
import * as Bluebird from 'bluebird'
import * as Sequelize from 'sequelize'
-import { Transaction } from 'sequelize'
import { AccountInstance } from '../account/account-interface'
import { VideoInstance } from './video-interface'
export namespace VideoShareMethods {
- export type LoadAccountsByShare = (videoId: number, t: Transaction) => Bluebird<AccountInstance[]>
- export type Load = (accountId: number, videoId: number, t: Transaction) => Bluebird<VideoShareInstance>
+ export type LoadAccountsByShare = (videoId: number, t: Sequelize.Transaction) => Bluebird<AccountInstance[]>
+ export type Load = (accountId: number, videoId: number, t: Sequelize.Transaction) => Bluebird<VideoShareInstance>
}
export interface VideoShareClass {
it('Should have valid Open Graph tags on the watch page with video id', async function () {
const res = await request(server.url)
- .get('/videos/watch/' + server.video.id)
- .expect(200)
+ .get('/videos/watch/' + server.video.id)
+ .set('Accept', 'text/html')
+ .expect(200)
expect(res.text).to.contain('<meta property="og:title" content="my super name for server 1" />')
expect(res.text).to.contain('<meta property="og:description" content="my super description for server 1" />')
it('Should have valid Open Graph tags on the watch page with video uuid', async function () {
const res = await request(server.url)
- .get('/videos/watch/' + server.video.uuid)
- .expect(200)
+ .get('/videos/watch/' + server.video.uuid)
+ .set('Accept', 'text/html')
+ .expect(200)
expect(res.text).to.contain('<meta property="og:title" content="my super name for server 1" />')
expect(res.text).to.contain('<meta property="og:description" content="my super description for server 1" />')
const path = '/videos/watch/' + server.video.uuid
const res = await request(server.url)
.get(path)
+ .set('Accept', 'text/html')
.expect(200)
const expectedLink = '<link rel="alternate" type="application/json+oembed" href="http://localhost:9001/services/oembed?' +
// Order of the tests we want to execute
import './client'
+import './activitypub'
import './api/'
import './cli/'
+export * from './activitypub'
export * from './cli'
export * from './clients'
export * from './config'