aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/controllers/activitypub/client.ts4
-rw-r--r--server/controllers/activitypub/outbox.ts7
-rw-r--r--server/lib/activitypub/send/send-delete.ts2
-rw-r--r--server/middlewares/validators/video-channels.ts2
-rw-r--r--server/middlewares/validators/videos.ts2
-rw-r--r--server/models/video/video-channel-share-interface.ts5
-rw-r--r--server/models/video/video-share-interface.ts5
-rw-r--r--server/tests/client.ts11
-rw-r--r--server/tests/index.ts1
-rw-r--r--server/tests/utils/index.ts1
10 files changed, 22 insertions, 18 deletions
diff --git a/server/controllers/activitypub/client.ts b/server/controllers/activitypub/client.ts
index 62cde1fc7..a478acd14 100644
--- a/server/controllers/activitypub/client.ts
+++ b/server/controllers/activitypub/client.ts
@@ -73,7 +73,7 @@ async function accountFollowersController (req: express.Request, res: express.Re
73 const page = req.query.page || 1 73 const page = req.query.page || 1
74 const { start, count } = pageToStartAndCount(page, ACTIVITY_PUB.COLLECTION_ITEMS_PER_PAGE) 74 const { start, count } = pageToStartAndCount(page, ACTIVITY_PUB.COLLECTION_ITEMS_PER_PAGE)
75 75
76 const result = await db.AccountFollow.listAcceptedFollowerUrlsForApi([ account.id ], start, count) 76 const result = await db.AccountFollow.listAcceptedFollowerUrlsForApi([ account.id ], undefined, start, count)
77 const activityPubResult = activityPubCollectionPagination(CONFIG.WEBSERVER.URL + req.url, page, result) 77 const activityPubResult = activityPubCollectionPagination(CONFIG.WEBSERVER.URL + req.url, page, result)
78 78
79 return res.json(activityPubResult) 79 return res.json(activityPubResult)
@@ -85,7 +85,7 @@ async function accountFollowingController (req: express.Request, res: express.Re
85 const page = req.query.page || 1 85 const page = req.query.page || 1
86 const { start, count } = pageToStartAndCount(page, ACTIVITY_PUB.COLLECTION_ITEMS_PER_PAGE) 86 const { start, count } = pageToStartAndCount(page, ACTIVITY_PUB.COLLECTION_ITEMS_PER_PAGE)
87 87
88 const result = await db.AccountFollow.listAcceptedFollowingUrlsForApi([ account.id ], start, count) 88 const result = await db.AccountFollow.listAcceptedFollowingUrlsForApi([ account.id ], undefined, start, count)
89 const activityPubResult = activityPubCollectionPagination(CONFIG.WEBSERVER.URL + req.url, page, result) 89 const activityPubResult = activityPubCollectionPagination(CONFIG.WEBSERVER.URL + req.url, page, result)
90 90
91 return res.json(activityPubResult) 91 return res.json(activityPubResult)
diff --git a/server/controllers/activitypub/outbox.ts b/server/controllers/activitypub/outbox.ts
index e2c4e9b1e..5a2d43f3d 100644
--- a/server/controllers/activitypub/outbox.ts
+++ b/server/controllers/activitypub/outbox.ts
@@ -38,15 +38,16 @@ async function outboxController (req: express.Request, res: express.Response, ne
38 const videoObject = video.toActivityPubObject() 38 const videoObject = video.toActivityPubObject()
39 39
40 // This is a shared video 40 // This is a shared video
41 const videoChannel = video.VideoChannel
41 if (video.VideoShares !== undefined && video.VideoShares.length !== 0) { 42 if (video.VideoShares !== undefined && video.VideoShares.length !== 0) {
42 const addActivity = await addActivityData(video.url, video.VideoChannel.Account, video, video.VideoChannel.url, videoObject) 43 const addActivity = await addActivityData(video.url, videoChannel.Account, video, videoChannel.url, videoObject, undefined)
43 44
44 const url = getAnnounceActivityPubUrl(video.url, account) 45 const url = getAnnounceActivityPubUrl(video.url, account)
45 const announceActivity = await announceActivityData(url, account, addActivity) 46 const announceActivity = await announceActivityData(url, account, addActivity, undefined)
46 47
47 activities.push(announceActivity) 48 activities.push(announceActivity)
48 } else { 49 } else {
49 const addActivity = await addActivityData(video.url, account, video, video.VideoChannel.url, videoObject) 50 const addActivity = await addActivityData(video.url, account, video, videoChannel.url, videoObject, undefined)
50 51
51 activities.push(addActivity) 52 activities.push(addActivity)
52 } 53 }
diff --git a/server/lib/activitypub/send/send-delete.ts b/server/lib/activitypub/send/send-delete.ts
index c49cda04f..8193790b3 100644
--- a/server/lib/activitypub/send/send-delete.ts
+++ b/server/lib/activitypub/send/send-delete.ts
@@ -27,7 +27,7 @@ async function sendDeleteVideo (video: VideoInstance, t: Transaction) {
27} 27}
28 28
29async function sendDeleteAccount (account: AccountInstance, t: Transaction) { 29async function sendDeleteAccount (account: AccountInstance, t: Transaction) {
30 const data = await deleteActivityData(account.url, account) 30 const data = deleteActivityData(account.url, account)
31 31
32 return broadcastToFollowers(data, account, [ account ], t) 32 return broadcastToFollowers(data, account, [ account ], t)
33} 33}
diff --git a/server/middlewares/validators/video-channels.ts b/server/middlewares/validators/video-channels.ts
index 4683c91e1..3d31a7e52 100644
--- a/server/middlewares/validators/video-channels.ts
+++ b/server/middlewares/validators/video-channels.ts
@@ -109,7 +109,7 @@ const videoChannelsShareValidator = [
109 if (areValidationErrors(req, res)) return 109 if (areValidationErrors(req, res)) return
110 if (!await isVideoChannelExist(req.params.id, res)) return 110 if (!await isVideoChannelExist(req.params.id, res)) return
111 111
112 const share = await db.VideoChannelShare.load(res.locals.video.id, req.params.accountId) 112 const share = await db.VideoChannelShare.load(res.locals.video.id, req.params.accountId, undefined)
113 if (!share) { 113 if (!share) {
114 return res.status(404) 114 return res.status(404)
115 .end() 115 .end()
diff --git a/server/middlewares/validators/videos.ts b/server/middlewares/validators/videos.ts
index 52b4475ce..f21680aa0 100644
--- a/server/middlewares/validators/videos.ts
+++ b/server/middlewares/validators/videos.ts
@@ -222,7 +222,7 @@ const videosShareValidator = [
222 if (areValidationErrors(req, res)) return 222 if (areValidationErrors(req, res)) return
223 if (!await isVideoExist(req.params.id, res)) return 223 if (!await isVideoExist(req.params.id, res)) return
224 224
225 const share = await db.VideoShare.load(req.params.accountId, res.locals.video.id) 225 const share = await db.VideoShare.load(req.params.accountId, res.locals.video.id, undefined)
226 if (!share) { 226 if (!share) {
227 return res.status(404) 227 return res.status(404)
228 .end() 228 .end()
diff --git a/server/models/video/video-channel-share-interface.ts b/server/models/video/video-channel-share-interface.ts
index 0482e8297..2fff41a1b 100644
--- a/server/models/video/video-channel-share-interface.ts
+++ b/server/models/video/video-channel-share-interface.ts
@@ -1,12 +1,11 @@
1import * as Bluebird from 'bluebird' 1import * as Bluebird from 'bluebird'
2import * as Sequelize from 'sequelize' 2import * as Sequelize from 'sequelize'
3import { Transaction } from 'sequelize'
4import { AccountInstance } from '../account/account-interface' 3import { AccountInstance } from '../account/account-interface'
5import { VideoChannelInstance } from './video-channel-interface' 4import { VideoChannelInstance } from './video-channel-interface'
6 5
7export namespace VideoChannelShareMethods { 6export namespace VideoChannelShareMethods {
8 export type LoadAccountsByShare = (videoChannelId: number, t: Transaction) => Bluebird<AccountInstance[]> 7 export type LoadAccountsByShare = (videoChannelId: number, t: Sequelize.Transaction) => Bluebird<AccountInstance[]>
9 export type Load = (accountId: number, videoId: number, t: Transaction) => Bluebird<VideoChannelShareInstance> 8 export type Load = (accountId: number, videoId: number, t: Sequelize.Transaction) => Bluebird<VideoChannelShareInstance>
10} 9}
11 10
12export interface VideoChannelShareClass { 11export interface VideoChannelShareClass {
diff --git a/server/models/video/video-share-interface.ts b/server/models/video/video-share-interface.ts
index 8ad10e095..3946303f1 100644
--- a/server/models/video/video-share-interface.ts
+++ b/server/models/video/video-share-interface.ts
@@ -1,12 +1,11 @@
1import * as Bluebird from 'bluebird' 1import * as Bluebird from 'bluebird'
2import * as Sequelize from 'sequelize' 2import * as Sequelize from 'sequelize'
3import { Transaction } from 'sequelize'
4import { AccountInstance } from '../account/account-interface' 3import { AccountInstance } from '../account/account-interface'
5import { VideoInstance } from './video-interface' 4import { VideoInstance } from './video-interface'
6 5
7export namespace VideoShareMethods { 6export namespace VideoShareMethods {
8 export type LoadAccountsByShare = (videoId: number, t: Transaction) => Bluebird<AccountInstance[]> 7 export type LoadAccountsByShare = (videoId: number, t: Sequelize.Transaction) => Bluebird<AccountInstance[]>
9 export type Load = (accountId: number, videoId: number, t: Transaction) => Bluebird<VideoShareInstance> 8 export type Load = (accountId: number, videoId: number, t: Sequelize.Transaction) => Bluebird<VideoShareInstance>
10} 9}
11 10
12export interface VideoShareClass { 11export interface VideoShareClass {
diff --git a/server/tests/client.ts b/server/tests/client.ts
index 0d70e3451..8c4334c53 100644
--- a/server/tests/client.ts
+++ b/server/tests/client.ts
@@ -41,8 +41,9 @@ describe('Test a client controllers', function () {
41 41
42 it('Should have valid Open Graph tags on the watch page with video id', async function () { 42 it('Should have valid Open Graph tags on the watch page with video id', async function () {
43 const res = await request(server.url) 43 const res = await request(server.url)
44 .get('/videos/watch/' + server.video.id) 44 .get('/videos/watch/' + server.video.id)
45 .expect(200) 45 .set('Accept', 'text/html')
46 .expect(200)
46 47
47 expect(res.text).to.contain('<meta property="og:title" content="my super name for server 1" />') 48 expect(res.text).to.contain('<meta property="og:title" content="my super name for server 1" />')
48 expect(res.text).to.contain('<meta property="og:description" content="my super description for server 1" />') 49 expect(res.text).to.contain('<meta property="og:description" content="my super description for server 1" />')
@@ -50,8 +51,9 @@ describe('Test a client controllers', function () {
50 51
51 it('Should have valid Open Graph tags on the watch page with video uuid', async function () { 52 it('Should have valid Open Graph tags on the watch page with video uuid', async function () {
52 const res = await request(server.url) 53 const res = await request(server.url)
53 .get('/videos/watch/' + server.video.uuid) 54 .get('/videos/watch/' + server.video.uuid)
54 .expect(200) 55 .set('Accept', 'text/html')
56 .expect(200)
55 57
56 expect(res.text).to.contain('<meta property="og:title" content="my super name for server 1" />') 58 expect(res.text).to.contain('<meta property="og:title" content="my super name for server 1" />')
57 expect(res.text).to.contain('<meta property="og:description" content="my super description for server 1" />') 59 expect(res.text).to.contain('<meta property="og:description" content="my super description for server 1" />')
@@ -61,6 +63,7 @@ describe('Test a client controllers', function () {
61 const path = '/videos/watch/' + server.video.uuid 63 const path = '/videos/watch/' + server.video.uuid
62 const res = await request(server.url) 64 const res = await request(server.url)
63 .get(path) 65 .get(path)
66 .set('Accept', 'text/html')
64 .expect(200) 67 .expect(200)
65 68
66 const expectedLink = '<link rel="alternate" type="application/json+oembed" href="http://localhost:9001/services/oembed?' + 69 const expectedLink = '<link rel="alternate" type="application/json+oembed" href="http://localhost:9001/services/oembed?' +
diff --git a/server/tests/index.ts b/server/tests/index.ts
index a7dd0d824..755fb2604 100644
--- a/server/tests/index.ts
+++ b/server/tests/index.ts
@@ -1,4 +1,5 @@
1// Order of the tests we want to execute 1// Order of the tests we want to execute
2import './client' 2import './client'
3import './activitypub'
3import './api/' 4import './api/'
4import './cli/' 5import './cli/'
diff --git a/server/tests/utils/index.ts b/server/tests/utils/index.ts
index 4308fd49a..b918ee83d 100644
--- a/server/tests/utils/index.ts
+++ b/server/tests/utils/index.ts
@@ -1,3 +1,4 @@
1export * from './activitypub'
1export * from './cli' 2export * from './cli'
2export * from './clients' 3export * from './clients'
3export * from './config' 4export * from './config'