aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-08-06 17:13:39 +0200
committerChocobozzz <me@florianbigard.com>2018-08-08 09:30:31 +0200
commitce33919c24e7402d92d81f3cd8e545df52d98240 (patch)
tree7e131a2f8df649899d0a71294665cf386ffb50d4 /server/models/video
parent788487140c500abeb69ca44daf3a9e26efa8d36f (diff)
downloadPeerTube-ce33919c24e7402d92d81f3cd8e545df52d98240.tar.gz
PeerTube-ce33919c24e7402d92d81f3cd8e545df52d98240.tar.zst
PeerTube-ce33919c24e7402d92d81f3cd8e545df52d98240.zip
Import magnets with webtorrent
Diffstat (limited to 'server/models/video')
-rw-r--r--server/models/video/video-import.ts15
1 files changed, 14 insertions, 1 deletions
diff --git a/server/models/video/video-import.ts b/server/models/video/video-import.ts
index eca87163d..55fca28b8 100644
--- a/server/models/video/video-import.ts
+++ b/server/models/video/video-import.ts
@@ -21,6 +21,7 @@ import { VideoImport, VideoImportState } from '../../../shared'
21import { VideoChannelModel } from './video-channel' 21import { VideoChannelModel } from './video-channel'
22import { AccountModel } from '../account/account' 22import { AccountModel } from '../account/account'
23import { TagModel } from './tag' 23import { TagModel } from './tag'
24import { isVideoMagnetUriValid } from '../../helpers/custom-validators/videos'
24 25
25@DefaultScope({ 26@DefaultScope({
26 include: [ 27 include: [
@@ -62,11 +63,23 @@ export class VideoImportModel extends Model<VideoImportModel> {
62 @UpdatedAt 63 @UpdatedAt
63 updatedAt: Date 64 updatedAt: Date
64 65
65 @AllowNull(false) 66 @AllowNull(true)
67 @Default(null)
66 @Is('VideoImportTargetUrl', value => throwIfNotValid(value, isVideoImportTargetUrlValid, 'targetUrl')) 68 @Is('VideoImportTargetUrl', value => throwIfNotValid(value, isVideoImportTargetUrlValid, 'targetUrl'))
67 @Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_IMPORTS.URL.max)) 69 @Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_IMPORTS.URL.max))
68 targetUrl: string 70 targetUrl: string
69 71
72 @AllowNull(true)
73 @Default(null)
74 @Is('VideoImportMagnetUri', value => throwIfNotValid(value, isVideoMagnetUriValid, 'magnetUri'))
75 @Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_IMPORTS.URL.max)) // Use the same constraints than URLs
76 magnetUri: string
77
78 @AllowNull(true)
79 @Default(null)
80 @Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_IMPORTS.TORRENT_NAME.max))
81 torrentName: string
82
70 @AllowNull(false) 83 @AllowNull(false)
71 @Default(null) 84 @Default(null)
72 @Is('VideoImportState', value => throwIfNotValid(value, isVideoImportStateValid, 'state')) 85 @Is('VideoImportState', value => throwIfNotValid(value, isVideoImportStateValid, 'state'))