aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/video')
-rw-r--r--server/models/video/formatter/video-format-utils.ts3
-rw-r--r--server/models/video/video-caption.ts4
-rw-r--r--server/models/video/video-playlist.ts6
3 files changed, 9 insertions, 4 deletions
diff --git a/server/models/video/formatter/video-format-utils.ts b/server/models/video/formatter/video-format-utils.ts
index 8880c0450..672c671b8 100644
--- a/server/models/video/formatter/video-format-utils.ts
+++ b/server/models/video/formatter/video-format-utils.ts
@@ -1,3 +1,4 @@
1import { uuidToShort } from '@server/helpers/uuid'
1import { generateMagnetUri } from '@server/helpers/webtorrent' 2import { generateMagnetUri } from '@server/helpers/webtorrent'
2import { getLocalVideoFileMetadataUrl } from '@server/lib/video-paths' 3import { getLocalVideoFileMetadataUrl } from '@server/lib/video-paths'
3import { VideoFile } from '@shared/models/videos/video-file.model' 4import { VideoFile } from '@shared/models/videos/video-file.model'
@@ -47,6 +48,8 @@ function videoModelToFormattedJSON (video: MVideoFormattable, options?: VideoFor
47 const videoObject: Video = { 48 const videoObject: Video = {
48 id: video.id, 49 id: video.id,
49 uuid: video.uuid, 50 uuid: video.uuid,
51 shortUUID: uuidToShort(video.uuid),
52
50 name: video.name, 53 name: video.name,
51 category: { 54 category: {
52 id: video.category, 55 id: video.category,
diff --git a/server/models/video/video-caption.ts b/server/models/video/video-caption.ts
index 5ec944b9e..d24be56c3 100644
--- a/server/models/video/video-caption.ts
+++ b/server/models/video/video-caption.ts
@@ -15,7 +15,7 @@ import {
15 Table, 15 Table,
16 UpdatedAt 16 UpdatedAt
17} from 'sequelize-typescript' 17} from 'sequelize-typescript'
18import { v4 as uuidv4 } from 'uuid' 18import { buildUUID } from '@server/helpers/uuid'
19import { MVideo, MVideoCaption, MVideoCaptionFormattable, MVideoCaptionVideo } from '@server/types/models' 19import { MVideo, MVideoCaption, MVideoCaptionFormattable, MVideoCaptionVideo } from '@server/types/models'
20import { AttributesOnly } from '@shared/core-utils' 20import { AttributesOnly } from '@shared/core-utils'
21import { VideoCaption } from '../../../shared/models/videos/caption/video-caption.model' 21import { VideoCaption } from '../../../shared/models/videos/caption/video-caption.model'
@@ -182,7 +182,7 @@ export class VideoCaptionModel extends Model<Partial<AttributesOnly<VideoCaption
182 } 182 }
183 183
184 static generateCaptionName (language: string) { 184 static generateCaptionName (language: string) {
185 return `${uuidv4()}-${language}.vtt` 185 return `${buildUUID()}-${language}.vtt`
186 } 186 }
187 187
188 isOwned () { 188 isOwned () {
diff --git a/server/models/video/video-playlist.ts b/server/models/video/video-playlist.ts
index 7aa6b6c6e..af81c9906 100644
--- a/server/models/video/video-playlist.ts
+++ b/server/models/video/video-playlist.ts
@@ -17,8 +17,8 @@ import {
17 Table, 17 Table,
18 UpdatedAt 18 UpdatedAt
19} from 'sequelize-typescript' 19} from 'sequelize-typescript'
20import { v4 as uuidv4 } from 'uuid'
21import { setAsUpdated } from '@server/helpers/database-utils' 20import { setAsUpdated } from '@server/helpers/database-utils'
21import { buildUUID, uuidToShort } from '@server/helpers/uuid'
22import { MAccountId, MChannelId } from '@server/types/models' 22import { MAccountId, MChannelId } from '@server/types/models'
23import { AttributesOnly } from '@shared/core-utils' 23import { AttributesOnly } from '@shared/core-utils'
24import { ActivityIconObject } from '../../../shared/models/activitypub/objects' 24import { ActivityIconObject } from '../../../shared/models/activitypub/objects'
@@ -545,7 +545,7 @@ export class VideoPlaylistModel extends Model<Partial<AttributesOnly<VideoPlayli
545 generateThumbnailName () { 545 generateThumbnailName () {
546 const extension = '.jpg' 546 const extension = '.jpg'
547 547
548 return 'playlist-' + uuidv4() + extension 548 return 'playlist-' + buildUUID() + extension
549 } 549 }
550 550
551 getThumbnailUrl () { 551 getThumbnailUrl () {
@@ -617,6 +617,8 @@ export class VideoPlaylistModel extends Model<Partial<AttributesOnly<VideoPlayli
617 return { 617 return {
618 id: this.id, 618 id: this.id,
619 uuid: this.uuid, 619 uuid: this.uuid,
620 shortUUID: uuidToShort(this.uuid),
621
620 isLocal: this.isOwned(), 622 isLocal: this.isOwned(),
621 623
622 url: this.url, 624 url: this.url,