diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-11-20 09:43:39 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-11-27 19:40:52 +0100 |
commit | 54141398354e6e7b94aa3065a705a1251390111c (patch) | |
tree | 8d30d1b9ea8acbe04f6d404125b04fc0c9897b70 /server/models/video | |
parent | eb8b27c93e61a896a08923dc1ca3c87ba8cf4948 (diff) | |
download | PeerTube-54141398354e6e7b94aa3065a705a1251390111c.tar.gz PeerTube-54141398354e6e7b94aa3065a705a1251390111c.tar.zst PeerTube-54141398354e6e7b94aa3065a705a1251390111c.zip |
Refractor activity pub lib/helpers
Diffstat (limited to 'server/models/video')
-rw-r--r-- | server/models/video/video-channel.ts | 16 | ||||
-rw-r--r-- | server/models/video/video.ts | 7 |
2 files changed, 8 insertions, 15 deletions
diff --git a/server/models/video/video-channel.ts b/server/models/video/video-channel.ts index f8414d4a8..93566a5c6 100644 --- a/server/models/video/video-channel.ts +++ b/server/models/video/video-channel.ts | |||
@@ -1,17 +1,11 @@ | |||
1 | import * as Sequelize from 'sequelize' | 1 | import * as Sequelize from 'sequelize' |
2 | 2 | import { isVideoChannelDescriptionValid, isVideoChannelNameValid } from '../../helpers' | |
3 | import { isVideoChannelNameValid, isVideoChannelDescriptionValid } from '../../helpers' | ||
4 | |||
5 | import { addMethodsToModel, getSort } from '../utils' | ||
6 | import { | ||
7 | VideoChannelInstance, | ||
8 | VideoChannelAttributes, | ||
9 | |||
10 | VideoChannelMethods | ||
11 | } from './video-channel-interface' | ||
12 | import { sendDeleteVideoChannel } from '../../lib/activitypub/send-request' | ||
13 | import { isVideoChannelUrlValid } from '../../helpers/custom-validators/video-channels' | 3 | import { isVideoChannelUrlValid } from '../../helpers/custom-validators/video-channels' |
14 | import { CONSTRAINTS_FIELDS } from '../../initializers/constants' | 4 | import { CONSTRAINTS_FIELDS } from '../../initializers/constants' |
5 | import { sendDeleteVideoChannel } from '../../lib/activitypub/send/send-delete' | ||
6 | |||
7 | import { addMethodsToModel, getSort } from '../utils' | ||
8 | import { VideoChannelAttributes, VideoChannelInstance, VideoChannelMethods } from './video-channel-interface' | ||
15 | 9 | ||
16 | let VideoChannel: Sequelize.Model<VideoChannelInstance, VideoChannelAttributes> | 10 | let VideoChannel: Sequelize.Model<VideoChannelInstance, VideoChannelAttributes> |
17 | let toFormattedJSON: VideoChannelMethods.ToFormattedJSON | 11 | let toFormattedJSON: VideoChannelMethods.ToFormattedJSON |
diff --git a/server/models/video/video.ts b/server/models/video/video.ts index dc10aca1a..e2069eb0c 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts | |||
@@ -9,7 +9,6 @@ import { VideoTorrentObject } from '../../../shared/models/activitypub/objects/v | |||
9 | import { | 9 | import { |
10 | createTorrentPromise, | 10 | createTorrentPromise, |
11 | generateImageFromVideoFile, | 11 | generateImageFromVideoFile, |
12 | getActivityPubUrl, | ||
13 | getVideoFileHeight, | 12 | getVideoFileHeight, |
14 | isVideoCategoryValid, | 13 | isVideoCategoryValid, |
15 | isVideoDescriptionValid, | 14 | isVideoDescriptionValid, |
@@ -40,13 +39,13 @@ import { | |||
40 | VIDEO_LICENCES, | 39 | VIDEO_LICENCES, |
41 | VIDEO_PRIVACIES | 40 | VIDEO_PRIVACIES |
42 | } from '../../initializers' | 41 | } from '../../initializers' |
43 | import { sendDeleteVideo } from '../../lib/activitypub/send-request' | ||
44 | 42 | ||
45 | import { addMethodsToModel, getSort } from '../utils' | 43 | import { addMethodsToModel, getSort } from '../utils' |
46 | 44 | ||
47 | import { TagInstance } from './tag-interface' | 45 | import { TagInstance } from './tag-interface' |
48 | import { VideoFileInstance, VideoFileModel } from './video-file-interface' | 46 | import { VideoFileInstance, VideoFileModel } from './video-file-interface' |
49 | import { VideoAttributes, VideoInstance, VideoMethods } from './video-interface' | 47 | import { VideoAttributes, VideoInstance, VideoMethods } from './video-interface' |
48 | import { sendDeleteVideo } from '../../lib/index' | ||
50 | 49 | ||
51 | const Buffer = safeBuffer.Buffer | 50 | const Buffer = safeBuffer.Buffer |
52 | 51 | ||
@@ -584,7 +583,7 @@ toActivityPubObject = function (this: VideoInstance) { | |||
584 | 583 | ||
585 | const videoObject: VideoTorrentObject = { | 584 | const videoObject: VideoTorrentObject = { |
586 | type: 'Video' as 'Video', | 585 | type: 'Video' as 'Video', |
587 | id: getActivityPubUrl('video', this.uuid), | 586 | id: this.url, |
588 | name: this.name, | 587 | name: this.name, |
589 | // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-duration | 588 | // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-duration |
590 | duration: 'PT' + this.duration + 'S', | 589 | duration: 'PT' + this.duration + 'S', |
@@ -615,7 +614,7 @@ toActivityPubObject = function (this: VideoInstance) { | |||
615 | width: THUMBNAILS_SIZE.width, | 614 | width: THUMBNAILS_SIZE.width, |
616 | height: THUMBNAILS_SIZE.height | 615 | height: THUMBNAILS_SIZE.height |
617 | }, | 616 | }, |
618 | url | 617 | url // FIXME: needed? |
619 | } | 618 | } |
620 | 619 | ||
621 | return videoObject | 620 | return videoObject |