diff options
author | Chocobozzz <me@florianbigard.com> | 2018-01-26 15:49:57 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-01-26 15:49:57 +0100 |
commit | 4ba3b8ea1be85d95a508ac479f26b96ceea15971 (patch) | |
tree | f76de3c6ec591cf885e5000f0e369aab883f3d95 /server/models/video/video-share.ts | |
parent | 7859b5800c08c15f3380fb3a7e267ce1b3f2df9f (diff) | |
download | PeerTube-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.ts | 15 |
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 @@ | |||
1 | import * as Sequelize from 'sequelize' | 1 | import * as Sequelize from 'sequelize' |
2 | import { BelongsTo, Column, CreatedAt, ForeignKey, Model, Scopes, Table, UpdatedAt } from 'sequelize-typescript' | 2 | import { AllowNull, BelongsTo, Column, CreatedAt, DataType, ForeignKey, Is, Model, Scopes, Table, UpdatedAt } from 'sequelize-typescript' |
3 | import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc' | ||
4 | import { CONSTRAINTS_FIELDS } from '../../initializers' | ||
3 | import { AccountModel } from '../account/account' | 5 | import { AccountModel } from '../account/account' |
4 | import { ActorModel } from '../activitypub/actor' | 6 | import { ActorModel } from '../activitypub/actor' |
7 | import { throwIfNotValid } from '../utils' | ||
5 | import { VideoModel } from './video' | 8 | import { VideoModel } from './video' |
6 | import { VideoChannelModel } from './video-channel' | 9 | import { 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 | }) |
46 | export class VideoShareModel extends Model<VideoShareModel> { | 53 | export 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 | ||