diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/controllers/api/videos/index.ts | 2 | ||||
-rw-r--r-- | server/helpers/activitypub.ts | 4 | ||||
-rw-r--r-- | server/helpers/custom-jsonld-signature.ts | 6 | ||||
-rw-r--r-- | server/helpers/custom-validators/activitypub/signature.ts | 2 | ||||
-rw-r--r-- | server/helpers/peertube-crypto.ts | 3 | ||||
-rw-r--r-- | server/lib/jobs/transcoding-job-scheduler/video-file-optimizer-handler.ts | 1 | ||||
-rw-r--r-- | server/models/activitypub/actor.ts | 14 |
7 files changed, 21 insertions, 11 deletions
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts index 3e65e844b..8283f2e4e 100644 --- a/server/controllers/api/videos/index.ts +++ b/server/controllers/api/videos/index.ts | |||
@@ -252,7 +252,6 @@ async function addVideo (req: express.Request, res: express.Response, videoPhysi | |||
252 | if (video.privacy === VideoPrivacy.PRIVATE) return videoCreated | 252 | if (video.privacy === VideoPrivacy.PRIVATE) return videoCreated |
253 | 253 | ||
254 | await sendCreateVideo(video, t) | 254 | await sendCreateVideo(video, t) |
255 | // TODO: share by video channel | ||
256 | await shareVideoByServerAndChannel(video, t) | 255 | await shareVideoByServerAndChannel(video, t) |
257 | 256 | ||
258 | logger.info('Video with name %s and uuid %s created.', videoInfo.name, videoCreated.uuid) | 257 | logger.info('Video with name %s and uuid %s created.', videoInfo.name, videoCreated.uuid) |
@@ -309,7 +308,6 @@ async function updateVideo (req: express.Request, res: express.Response) { | |||
309 | // Video is not private anymore, send a create action to remote servers | 308 | // Video is not private anymore, send a create action to remote servers |
310 | if (wasPrivateVideo === true && videoInstanceUpdated.privacy !== VideoPrivacy.PRIVATE) { | 309 | if (wasPrivateVideo === true && videoInstanceUpdated.privacy !== VideoPrivacy.PRIVATE) { |
311 | await sendCreateVideo(videoInstanceUpdated, t) | 310 | await sendCreateVideo(videoInstanceUpdated, t) |
312 | // TODO: Send by video channel | ||
313 | await shareVideoByServerAndChannel(videoInstanceUpdated, t) | 311 | await shareVideoByServerAndChannel(videoInstanceUpdated, t) |
314 | } | 312 | } |
315 | }) | 313 | }) |
diff --git a/server/helpers/activitypub.ts b/server/helpers/activitypub.ts index 5850fc19f..b6207c915 100644 --- a/server/helpers/activitypub.ts +++ b/server/helpers/activitypub.ts | |||
@@ -10,6 +10,7 @@ function activityPubContextify <T> (data: T) { | |||
10 | 'https://www.w3.org/ns/activitystreams', | 10 | 'https://www.w3.org/ns/activitystreams', |
11 | 'https://w3id.org/security/v1', | 11 | 'https://w3id.org/security/v1', |
12 | { | 12 | { |
13 | 'RsaSignature2017': 'https://w3id.org/security#RsaSignature2017', | ||
13 | 'Hashtag': 'as:Hashtag', | 14 | 'Hashtag': 'as:Hashtag', |
14 | 'uuid': 'http://schema.org/identifier', | 15 | 'uuid': 'http://schema.org/identifier', |
15 | 'category': 'http://schema.org/category', | 16 | 'category': 'http://schema.org/category', |
@@ -17,8 +18,7 @@ function activityPubContextify <T> (data: T) { | |||
17 | 'nsfw': 'as:sensitive', | 18 | 'nsfw': 'as:sensitive', |
18 | 'language': 'http://schema.org/inLanguage', | 19 | 'language': 'http://schema.org/inLanguage', |
19 | 'views': 'http://schema.org/Number', | 20 | 'views': 'http://schema.org/Number', |
20 | 'size': 'http://schema.org/Number', | 21 | 'size': 'http://schema.org/Number' |
21 | 'VideoChannel': 'https://peertu.be/ns/VideoChannel' | ||
22 | } | 22 | } |
23 | ] | 23 | ] |
24 | }) | 24 | }) |
diff --git a/server/helpers/custom-jsonld-signature.ts b/server/helpers/custom-jsonld-signature.ts index afb960618..e4f28018e 100644 --- a/server/helpers/custom-jsonld-signature.ts +++ b/server/helpers/custom-jsonld-signature.ts | |||
@@ -1,9 +1,7 @@ | |||
1 | import * as AsyncLRU from 'async-lru' | 1 | import * as AsyncLRU from 'async-lru' |
2 | import * as jsonld from 'jsonld' | 2 | import * as jsonld from 'jsonld/' |
3 | import * as jsig from 'jsonld-signatures' | 3 | import * as jsig from 'jsonld-signatures' |
4 | 4 | ||
5 | jsig.use('jsonld', jsonld) | ||
6 | |||
7 | const nodeDocumentLoader = jsonld.documentLoaders.node() | 5 | const nodeDocumentLoader = jsonld.documentLoaders.node() |
8 | 6 | ||
9 | const lru = new AsyncLRU({ | 7 | const lru = new AsyncLRU({ |
@@ -17,4 +15,6 @@ jsonld.documentLoader = (url, cb) => { | |||
17 | lru.get(url, cb) | 15 | lru.get(url, cb) |
18 | } | 16 | } |
19 | 17 | ||
18 | jsig.use('jsonld', jsonld) | ||
19 | |||
20 | export { jsig } | 20 | export { jsig } |
diff --git a/server/helpers/custom-validators/activitypub/signature.ts b/server/helpers/custom-validators/activitypub/signature.ts index 683ed2b1c..cfb65361e 100644 --- a/server/helpers/custom-validators/activitypub/signature.ts +++ b/server/helpers/custom-validators/activitypub/signature.ts | |||
@@ -2,7 +2,7 @@ import { exists } from '../misc' | |||
2 | import { isActivityPubUrlValid } from './misc' | 2 | import { isActivityPubUrlValid } from './misc' |
3 | 3 | ||
4 | function isSignatureTypeValid (signatureType: string) { | 4 | function isSignatureTypeValid (signatureType: string) { |
5 | return exists(signatureType) && signatureType === 'GraphSignature2012' | 5 | return exists(signatureType) && signatureType === 'RsaSignature2017' |
6 | } | 6 | } |
7 | 7 | ||
8 | function isSignatureCreatorValid (signatureCreator: string) { | 8 | function isSignatureCreatorValid (signatureCreator: string) { |
diff --git a/server/helpers/peertube-crypto.ts b/server/helpers/peertube-crypto.ts index a0c9112b9..313c12e26 100644 --- a/server/helpers/peertube-crypto.ts +++ b/server/helpers/peertube-crypto.ts | |||
@@ -43,7 +43,8 @@ function isSignatureVerified (fromActor: ActorModel, signedDocument: object) { | |||
43 | function signObject (byActor: ActorModel, data: any) { | 43 | function signObject (byActor: ActorModel, data: any) { |
44 | const options = { | 44 | const options = { |
45 | privateKeyPem: byActor.privateKey, | 45 | privateKeyPem: byActor.privateKey, |
46 | creator: byActor.url | 46 | creator: byActor.url, |
47 | algorithm: 'RsaSignature2017' | ||
47 | } | 48 | } |
48 | 49 | ||
49 | return jsig.promises.sign(data, options) | 50 | return jsig.promises.sign(data, options) |
diff --git a/server/lib/jobs/transcoding-job-scheduler/video-file-optimizer-handler.ts b/server/lib/jobs/transcoding-job-scheduler/video-file-optimizer-handler.ts index cde4948de..47b12e66f 100644 --- a/server/lib/jobs/transcoding-job-scheduler/video-file-optimizer-handler.ts +++ b/server/lib/jobs/transcoding-job-scheduler/video-file-optimizer-handler.ts | |||
@@ -37,7 +37,6 @@ async function onSuccess (jobId: number, video: VideoModel, jobScheduler: JobSch | |||
37 | 37 | ||
38 | // Now we'll add the video's meta data to our followers | 38 | // Now we'll add the video's meta data to our followers |
39 | await sendCreateVideo(video, undefined) | 39 | await sendCreateVideo(video, undefined) |
40 | // TODO: share by channel | ||
41 | await shareVideoByServerAndChannel(video, undefined) | 40 | await shareVideoByServerAndChannel(video, undefined) |
42 | 41 | ||
43 | const originalFileHeight = await videoDatabase.getOriginalFileHeight() | 42 | const originalFileHeight = await videoDatabase.getOriginalFileHeight() |
diff --git a/server/models/activitypub/actor.ts b/server/models/activitypub/actor.ts index ecaa43dcf..8cedcc2bc 100644 --- a/server/models/activitypub/actor.ts +++ b/server/models/activitypub/actor.ts | |||
@@ -7,7 +7,7 @@ import { | |||
7 | Column, | 7 | Column, |
8 | CreatedAt, | 8 | CreatedAt, |
9 | DataType, | 9 | DataType, |
10 | Default, | 10 | Default, DefaultScope, |
11 | ForeignKey, | 11 | ForeignKey, |
12 | HasMany, | 12 | HasMany, |
13 | HasOne, | 13 | HasOne, |
@@ -41,6 +41,14 @@ enum ScopeNames { | |||
41 | FULL = 'FULL' | 41 | FULL = 'FULL' |
42 | } | 42 | } |
43 | 43 | ||
44 | @DefaultScope({ | ||
45 | include: [ | ||
46 | { | ||
47 | model: () => ServerModel, | ||
48 | required: false | ||
49 | } | ||
50 | ] | ||
51 | }) | ||
44 | @Scopes({ | 52 | @Scopes({ |
45 | [ScopeNames.FULL]: { | 53 | [ScopeNames.FULL]: { |
46 | include: [ | 54 | include: [ |
@@ -51,6 +59,10 @@ enum ScopeNames { | |||
51 | { | 59 | { |
52 | model: () => VideoChannelModel, | 60 | model: () => VideoChannelModel, |
53 | required: false | 61 | required: false |
62 | }, | ||
63 | { | ||
64 | model: () => ServerModel, | ||
65 | required: false | ||
54 | } | 66 | } |
55 | ] | 67 | ] |
56 | } | 68 | } |