aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared
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
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')
-rw-r--r--shared/core-utils/common/object.ts5
-rw-r--r--shared/core-utils/videos/bitrate.ts2
-rw-r--r--shared/core-utils/videos/index.ts1
-rw-r--r--shared/extra-utils/index.ts1
-rw-r--r--shared/extra-utils/uuid.ts (renamed from shared/core-utils/videos/uuid.ts)0
-rw-r--r--shared/server-commands/videos/videos-command.ts3
6 files changed, 9 insertions, 3 deletions
diff --git a/shared/core-utils/common/object.ts b/shared/core-utils/common/object.ts
index 88d6b7514..49d209819 100644
--- a/shared/core-utils/common/object.ts
+++ b/shared/core-utils/common/object.ts
@@ -10,6 +10,10 @@ function pick <O extends object, K extends keyof O> (object: O, keys: K[]): Pick
10 return result 10 return result
11} 11}
12 12
13function getKeys <O extends object, K extends keyof O> (object: O, keys: K[]): K[] {
14 return (Object.keys(object) as K[]).filter(k => keys.includes(k))
15}
16
13function sortObjectComparator (key: string, order: 'asc' | 'desc') { 17function sortObjectComparator (key: string, order: 'asc' | 'desc') {
14 return (a: any, b: any) => { 18 return (a: any, b: any) => {
15 if (a[key] < b[key]) { 19 if (a[key] < b[key]) {
@@ -26,5 +30,6 @@ function sortObjectComparator (key: string, order: 'asc' | 'desc') {
26 30
27export { 31export {
28 pick, 32 pick,
33 getKeys,
29 sortObjectComparator 34 sortObjectComparator
30} 35}
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/extra-utils/index.ts b/shared/extra-utils/index.ts
index 373d27cb4..e2e161a7b 100644
--- a/shared/extra-utils/index.ts
+++ b/shared/extra-utils/index.ts
@@ -1,3 +1,4 @@
1export * from './crypto' 1export * from './crypto'
2export * from './ffprobe' 2export * from './ffprobe'
3export * from './file' 3export * from './file'
4export * from './uuid'
diff --git a/shared/core-utils/videos/uuid.ts b/shared/extra-utils/uuid.ts
index f3c80e046..f3c80e046 100644
--- a/shared/core-utils/videos/uuid.ts
+++ b/shared/extra-utils/uuid.ts
diff --git a/shared/server-commands/videos/videos-command.ts b/shared/server-commands/videos/videos-command.ts
index ead57b9aa..21753ddc4 100644
--- a/shared/server-commands/videos/videos-command.ts
+++ b/shared/server-commands/videos/videos-command.ts
@@ -5,7 +5,8 @@ import { createReadStream, stat } from 'fs-extra'
5import got, { Response as GotResponse } from 'got' 5import got, { Response as GotResponse } from 'got'
6import { omit } from 'lodash' 6import { omit } from 'lodash'
7import validator from 'validator' 7import validator from 'validator'
8import { buildAbsoluteFixturePath, buildUUID, pick, wait } from '@shared/core-utils' 8import { buildAbsoluteFixturePath, pick, wait } from '@shared/core-utils'
9import { buildUUID } from '@shared/extra-utils'
9import { 10import {
10 HttpStatusCode, 11 HttpStatusCode,
11 ResultList, 12 ResultList,