aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/video-share.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-01-26 15:49:57 +0100
committerChocobozzz <me@florianbigard.com>2018-01-26 15:49:57 +0100
commit4ba3b8ea1be85d95a508ac479f26b96ceea15971 (patch)
treef76de3c6ec591cf885e5000f0e369aab883f3d95 /server/models/video/video-share.ts
parent7859b5800c08c15f3380fb3a7e267ce1b3f2df9f (diff)
downloadPeerTube-4ba3b8ea1be85d95a508ac479f26b96ceea15971.tar.gz
PeerTube-4ba3b8ea1be85d95a508ac479f26b96ceea15971.tar.zst
PeerTube-4ba3b8ea1be85d95a508ac479f26b96ceea15971.zip
Don't rehost announced video activities
Diffstat (limited to 'server/models/video/video-share.ts')
-rw-r--r--server/models/video/video-share.ts15
1 files changed, 14 insertions, 1 deletions
diff --git a/server/models/video/video-share.ts b/server/models/video/video-share.ts
index 56576f98c..48ba68a4a 100644
--- a/server/models/video/video-share.ts
+++ b/server/models/video/video-share.ts
@@ -1,7 +1,10 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2import { BelongsTo, Column, CreatedAt, ForeignKey, Model, Scopes, Table, UpdatedAt } from 'sequelize-typescript' 2import { AllowNull, BelongsTo, Column, CreatedAt, DataType, ForeignKey, Is, Model, Scopes, Table, UpdatedAt } from 'sequelize-typescript'
3import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc'
4import { CONSTRAINTS_FIELDS } from '../../initializers'
3import { AccountModel } from '../account/account' 5import { AccountModel } from '../account/account'
4import { ActorModel } from '../activitypub/actor' 6import { ActorModel } from '../activitypub/actor'
7import { throwIfNotValid } from '../utils'
5import { VideoModel } from './video' 8import { VideoModel } from './video'
6import { VideoChannelModel } from './video-channel' 9import { VideoChannelModel } from './video-channel'
7 10
@@ -40,10 +43,20 @@ enum ScopeNames {
40 }, 43 },
41 { 44 {
42 fields: [ 'videoId' ] 45 fields: [ 'videoId' ]
46 },
47 {
48 fields: [ 'url' ],
49 unique: true
43 } 50 }
44 ] 51 ]
45}) 52})
46export class VideoShareModel extends Model<VideoShareModel> { 53export class VideoShareModel extends Model<VideoShareModel> {
54
55 @AllowNull(false)
56 @Is('VideoShareUrl', value => throwIfNotValid(value, isActivityPubUrlValid, 'url'))
57 @Column(DataType.STRING(CONSTRAINTS_FIELDS.VIDEO_SHARE.URL.max))
58 url: string
59
47 @CreatedAt 60 @CreatedAt
48 createdAt: Date 61 createdAt: Date
49 62