diff options
author | Chocobozzz <me@florianbigard.com> | 2021-06-28 17:30:59 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2021-06-29 14:56:35 +0200 |
commit | d4a8e7a65f97bb3257facc13e1ae8ffdbad61ddb (patch) | |
tree | a4cb07318100031951c3dffc61f4f2cb95d2cbd0 /shared/extra-utils/videos | |
parent | 62ddc31a9e4b92d7d27898ccfc363f68ab044139 (diff) | |
download | PeerTube-d4a8e7a65f97bb3257facc13e1ae8ffdbad61ddb.tar.gz PeerTube-d4a8e7a65f97bb3257facc13e1ae8ffdbad61ddb.tar.zst PeerTube-d4a8e7a65f97bb3257facc13e1ae8ffdbad61ddb.zip |
Support short uuid for GET video/playlist
Diffstat (limited to 'shared/extra-utils/videos')
-rw-r--r-- | shared/extra-utils/videos/videos.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/shared/extra-utils/videos/videos.ts b/shared/extra-utils/videos/videos.ts index a3a276188..469ea4d63 100644 --- a/shared/extra-utils/videos/videos.ts +++ b/shared/extra-utils/videos/videos.ts | |||
@@ -6,9 +6,9 @@ import got, { Response as GotResponse } from 'got/dist/source' | |||
6 | import * as parseTorrent from 'parse-torrent' | 6 | import * as parseTorrent from 'parse-torrent' |
7 | import { join } from 'path' | 7 | import { join } from 'path' |
8 | import * as request from 'supertest' | 8 | import * as request from 'supertest' |
9 | import { v4 as uuidv4 } from 'uuid' | ||
10 | import validator from 'validator' | 9 | import validator from 'validator' |
11 | import { getLowercaseExtension } from '@server/helpers/core-utils' | 10 | import { getLowercaseExtension } from '@server/helpers/core-utils' |
11 | import { buildUUID } from '@server/helpers/uuid' | ||
12 | import { HttpStatusCode } from '@shared/core-utils' | 12 | import { HttpStatusCode } from '@shared/core-utils' |
13 | import { VideosCommonQuery } from '@shared/models' | 13 | import { VideosCommonQuery } from '@shared/models' |
14 | import { loadLanguages, VIDEO_CATEGORIES, VIDEO_LANGUAGES, VIDEO_LICENCES, VIDEO_PRIVACIES } from '../../../server/initializers/constants' | 14 | import { loadLanguages, VIDEO_CATEGORIES, VIDEO_LANGUAGES, VIDEO_LICENCES, VIDEO_PRIVACIES } from '../../../server/initializers/constants' |
@@ -806,7 +806,7 @@ async function uploadVideoAndGetId (options: { | |||
806 | 806 | ||
807 | const res = await uploadVideo(options.server.url, options.token || options.server.accessToken, videoAttrs) | 807 | const res = await uploadVideo(options.server.url, options.token || options.server.accessToken, videoAttrs) |
808 | 808 | ||
809 | return { id: res.body.video.id, uuid: res.body.video.uuid } | 809 | return res.body.video as { id: number, uuid: string, shortUUID: string } |
810 | } | 810 | } |
811 | 811 | ||
812 | async function getLocalIdByUUID (url: string, uuid: string) { | 812 | async function getLocalIdByUUID (url: string, uuid: string) { |
@@ -827,7 +827,7 @@ async function uploadRandomVideoOnServers (servers: ServerInfo[], serverNumber: | |||
827 | 827 | ||
828 | async function uploadRandomVideo (server: ServerInfo, wait = true, additionalParams: any = {}) { | 828 | async function uploadRandomVideo (server: ServerInfo, wait = true, additionalParams: any = {}) { |
829 | const prefixName = additionalParams.prefixName || '' | 829 | const prefixName = additionalParams.prefixName || '' |
830 | const name = prefixName + uuidv4() | 830 | const name = prefixName + buildUUID() |
831 | 831 | ||
832 | const data = Object.assign({ name }, additionalParams) | 832 | const data = Object.assign({ name }, additionalParams) |
833 | const res = await uploadVideo(server.url, server.accessToken, data) | 833 | const res = await uploadVideo(server.url, server.accessToken, data) |