mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-02-25 18:55:32 -06:00
Support short uuid for GET video/playlist
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { uuidToShort } from '@server/helpers/uuid'
|
||||
import { generateMagnetUri } from '@server/helpers/webtorrent'
|
||||
import { getLocalVideoFileMetadataUrl } from '@server/lib/video-paths'
|
||||
import { VideoFile } from '@shared/models/videos/video-file.model'
|
||||
@@ -47,6 +48,8 @@ function videoModelToFormattedJSON (video: MVideoFormattable, options?: VideoFor
|
||||
const videoObject: Video = {
|
||||
id: video.id,
|
||||
uuid: video.uuid,
|
||||
shortUUID: uuidToShort(video.uuid),
|
||||
|
||||
name: video.name,
|
||||
category: {
|
||||
id: video.category,
|
||||
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
Table,
|
||||
UpdatedAt
|
||||
} from 'sequelize-typescript'
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
import { buildUUID } from '@server/helpers/uuid'
|
||||
import { MVideo, MVideoCaption, MVideoCaptionFormattable, MVideoCaptionVideo } from '@server/types/models'
|
||||
import { AttributesOnly } from '@shared/core-utils'
|
||||
import { VideoCaption } from '../../../shared/models/videos/caption/video-caption.model'
|
||||
@@ -182,7 +182,7 @@ export class VideoCaptionModel extends Model<Partial<AttributesOnly<VideoCaption
|
||||
}
|
||||
|
||||
static generateCaptionName (language: string) {
|
||||
return `${uuidv4()}-${language}.vtt`
|
||||
return `${buildUUID()}-${language}.vtt`
|
||||
}
|
||||
|
||||
isOwned () {
|
||||
|
||||
@@ -17,8 +17,8 @@ import {
|
||||
Table,
|
||||
UpdatedAt
|
||||
} from 'sequelize-typescript'
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
import { setAsUpdated } from '@server/helpers/database-utils'
|
||||
import { buildUUID, uuidToShort } from '@server/helpers/uuid'
|
||||
import { MAccountId, MChannelId } from '@server/types/models'
|
||||
import { AttributesOnly } from '@shared/core-utils'
|
||||
import { ActivityIconObject } from '../../../shared/models/activitypub/objects'
|
||||
@@ -545,7 +545,7 @@ export class VideoPlaylistModel extends Model<Partial<AttributesOnly<VideoPlayli
|
||||
generateThumbnailName () {
|
||||
const extension = '.jpg'
|
||||
|
||||
return 'playlist-' + uuidv4() + extension
|
||||
return 'playlist-' + buildUUID() + extension
|
||||
}
|
||||
|
||||
getThumbnailUrl () {
|
||||
@@ -617,6 +617,8 @@ export class VideoPlaylistModel extends Model<Partial<AttributesOnly<VideoPlayli
|
||||
return {
|
||||
id: this.id,
|
||||
uuid: this.uuid,
|
||||
shortUUID: uuidToShort(this.uuid),
|
||||
|
||||
isLocal: this.isOwned(),
|
||||
|
||||
url: this.url,
|
||||
|
||||
Reference in New Issue
Block a user