aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/video')
-rw-r--r--server/models/video/video-channel.ts4
-rw-r--r--server/models/video/video.ts23
2 files changed, 16 insertions, 11 deletions
diff --git a/server/models/video/video-channel.ts b/server/models/video/video-channel.ts
index e11268b2c..54f12dce3 100644
--- a/server/models/video/video-channel.ts
+++ b/server/models/video/video-channel.ts
@@ -1,6 +1,5 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2import { isVideoChannelDescriptionValid, isVideoChannelNameValid } from '../../helpers' 2import { isVideoChannelDescriptionValid, isVideoChannelNameValid } from '../../helpers'
3import { isVideoChannelUrlValid } from '../../helpers/custom-validators/video-channels'
4import { CONSTRAINTS_FIELDS } from '../../initializers/constants' 3import { CONSTRAINTS_FIELDS } from '../../initializers/constants'
5import { sendDeleteVideoChannel } from '../../lib/activitypub/send/send-delete' 4import { sendDeleteVideoChannel } from '../../lib/activitypub/send/send-delete'
6 5
@@ -8,6 +7,7 @@ import { addMethodsToModel, getSort } from '../utils'
8import { VideoChannelAttributes, VideoChannelInstance, VideoChannelMethods } from './video-channel-interface' 7import { VideoChannelAttributes, VideoChannelInstance, VideoChannelMethods } from './video-channel-interface'
9import { getAnnounceActivityPubUrl } from '../../lib/activitypub/url' 8import { getAnnounceActivityPubUrl } from '../../lib/activitypub/url'
10import { activityPubCollection } from '../../helpers/activitypub' 9import { activityPubCollection } from '../../helpers/activitypub'
10import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc'
11 11
12let VideoChannel: Sequelize.Model<VideoChannelInstance, VideoChannelAttributes> 12let VideoChannel: Sequelize.Model<VideoChannelInstance, VideoChannelAttributes>
13let toFormattedJSON: VideoChannelMethods.ToFormattedJSON 13let toFormattedJSON: VideoChannelMethods.ToFormattedJSON
@@ -66,7 +66,7 @@ export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.Da
66 allowNull: false, 66 allowNull: false,
67 validate: { 67 validate: {
68 urlValid: value => { 68 urlValid: value => {
69 const res = isVideoChannelUrlValid(value) 69 const res = isActivityPubUrlValid(value)
70 if (res === false) throw new Error('Video channel URL is not valid.') 70 if (res === false) throw new Error('Video channel URL is not valid.')
71 } 71 }
72 } 72 }
diff --git a/server/models/video/video.ts b/server/models/video/video.ts
index 4956b57ee..3f416d04c 100644
--- a/server/models/video/video.ts
+++ b/server/models/video/video.ts
@@ -7,7 +7,18 @@ import * as Sequelize from 'sequelize'
7import { VideoPrivacy, VideoResolution } from '../../../shared' 7import { VideoPrivacy, VideoResolution } from '../../../shared'
8import { VideoTorrentObject } from '../../../shared/models/activitypub/objects/video-torrent-object' 8import { VideoTorrentObject } from '../../../shared/models/activitypub/objects/video-torrent-object'
9import { activityPubCollection } from '../../helpers/activitypub' 9import { activityPubCollection } from '../../helpers/activitypub'
10import { isVideoCategoryValid, isVideoLanguageValid, isVideoPrivacyValid, isVideoUrlValid } from '../../helpers/custom-validators/videos' 10import { createTorrentPromise, renamePromise, statPromise, unlinkPromise, writeFilePromise } from '../../helpers/core-utils'
11import { isVideoCategoryValid, isVideoLanguageValid, isVideoPrivacyValid } from '../../helpers/custom-validators/videos'
12import { generateImageFromVideoFile, getVideoFileHeight, transcode } from '../../helpers/ffmpeg-utils'
13import {
14 isActivityPubUrlValid,
15 isVideoDescriptionValid,
16 isVideoDurationValid,
17 isVideoLicenceValid,
18 isVideoNameValid,
19 isVideoNSFWValid
20} from '../../helpers/index'
21import { logger } from '../../helpers/logger'
11import { 22import {
12 API_VERSION, 23 API_VERSION,
13 CONFIG, 24 CONFIG,
@@ -21,18 +32,12 @@ import {
21 VIDEO_LICENCES, 32 VIDEO_LICENCES,
22 VIDEO_PRIVACIES 33 VIDEO_PRIVACIES
23} from '../../initializers/constants' 34} from '../../initializers/constants'
35import { getAnnounceActivityPubUrl } from '../../lib/activitypub/url'
24import { sendDeleteVideo } from '../../lib/index' 36import { sendDeleteVideo } from '../../lib/index'
25
26import { addMethodsToModel, getSort } from '../utils' 37import { addMethodsToModel, getSort } from '../utils'
27
28import { TagInstance } from './tag-interface' 38import { TagInstance } from './tag-interface'
29import { VideoFileInstance, VideoFileModel } from './video-file-interface' 39import { VideoFileInstance, VideoFileModel } from './video-file-interface'
30import { VideoAttributes, VideoInstance, VideoMethods } from './video-interface' 40import { VideoAttributes, VideoInstance, VideoMethods } from './video-interface'
31import { isVideoNameValid, isVideoLicenceValid, isVideoNSFWValid, isVideoDescriptionValid, isVideoDurationValid } from '../../helpers/index'
32import { logger } from '../../helpers/logger'
33import { generateImageFromVideoFile, transcode, getVideoFileHeight } from '../../helpers/ffmpeg-utils'
34import { createTorrentPromise, writeFilePromise, unlinkPromise, renamePromise, statPromise } from '../../helpers/core-utils'
35import { getAnnounceActivityPubUrl } from '../../lib/activitypub/url'
36 41
37let Video: Sequelize.Model<VideoInstance, VideoAttributes> 42let Video: Sequelize.Model<VideoInstance, VideoAttributes>
38let getOriginalFile: VideoMethods.GetOriginalFile 43let getOriginalFile: VideoMethods.GetOriginalFile
@@ -205,7 +210,7 @@ export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.Da
205 allowNull: false, 210 allowNull: false,
206 validate: { 211 validate: {
207 urlValid: value => { 212 urlValid: value => {
208 const res = isVideoUrlValid(value) 213 const res = isActivityPubUrlValid(value)
209 if (res === false) throw new Error('Video URL is not valid.') 214 if (res === false) throw new Error('Video URL is not valid.')
210 } 215 }
211 } 216 }