aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/core-utils/videos
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-12-29 14:44:58 +0100
committerChocobozzz <me@florianbigard.com>2021-12-29 14:44:58 +0100
commit0628157fe9662fdb2b6fa658b8b53fe684c013ce (patch)
tree52bf9dc16d9e30cb716a6df76ce12fd7d34cff7f /shared/core-utils/videos
parentfb3c9e2bf5b45d6d283cea4d55cc0d49eb58e3cb (diff)
downloadPeerTube-0628157fe9662fdb2b6fa658b8b53fe684c013ce.tar.gz
PeerTube-0628157fe9662fdb2b6fa658b8b53fe684c013ce.tar.zst
PeerTube-0628157fe9662fdb2b6fa658b8b53fe684c013ce.zip
Move uuid stuff in extra utils
Since it requires an external dependency
Diffstat (limited to 'shared/core-utils/videos')
-rw-r--r--shared/core-utils/videos/bitrate.ts2
-rw-r--r--shared/core-utils/videos/index.ts1
-rw-r--r--shared/core-utils/videos/uuid.ts32
3 files changed, 1 insertions, 34 deletions
diff --git a/shared/core-utils/videos/bitrate.ts b/shared/core-utils/videos/bitrate.ts
index c1891188f..30d22df09 100644
--- a/shared/core-utils/videos/bitrate.ts
+++ b/shared/core-utils/videos/bitrate.ts
@@ -1,4 +1,4 @@
1import { VideoResolution } from "@shared/models" 1import { VideoResolution } from '@shared/models'
2 2
3type BitPerPixel = { [ id in VideoResolution ]: number } 3type BitPerPixel = { [ id in VideoResolution ]: number }
4 4
diff --git a/shared/core-utils/videos/index.ts b/shared/core-utils/videos/index.ts
index 8f6736d39..620e3a716 100644
--- a/shared/core-utils/videos/index.ts
+++ b/shared/core-utils/videos/index.ts
@@ -1,3 +1,2 @@
1export * from './bitrate' 1export * from './bitrate'
2export * from './privacy' 2export * from './privacy'
3export * from './uuid'
diff --git a/shared/core-utils/videos/uuid.ts b/shared/core-utils/videos/uuid.ts
deleted file mode 100644
index f3c80e046..000000000
--- a/shared/core-utils/videos/uuid.ts
+++ /dev/null
@@ -1,32 +0,0 @@
1import short, { uuid } from 'short-uuid'
2
3const translator = short()
4
5function buildUUID () {
6 return uuid()
7}
8
9function uuidToShort (uuid: string) {
10 if (!uuid) return uuid
11
12 return translator.fromUUID(uuid)
13}
14
15function shortToUUID (shortUUID: string) {
16 if (!shortUUID) return shortUUID
17
18 return translator.toUUID(shortUUID)
19}
20
21function isShortUUID (value: string) {
22 if (!value) return false
23
24 return value.length === translator.maxLength
25}
26
27export {
28 buildUUID,
29 uuidToShort,
30 shortToUUID,
31 isShortUUID
32}