aboutsummaryrefslogtreecommitdiffhomepage
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
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
-rw-r--r--client/src/app/core/plugins/plugin.service.ts3
-rw-r--r--client/src/app/shared/shared-forms/dynamic-form-field.component.html2
-rw-r--r--server/controllers/api/users/token.ts2
-rw-r--r--server/controllers/api/video-playlist.ts2
-rw-r--r--server/controllers/api/videos/live.ts2
-rw-r--r--server/controllers/api/videos/upload.ts4
-rw-r--r--server/helpers/custom-validators/misc.ts2
-rw-r--r--server/helpers/image-utils.ts3
-rw-r--r--server/initializers/migrations/0080-video-channels.ts2
-rw-r--r--server/initializers/migrations/0345-video-playlists.ts2
-rw-r--r--server/initializers/migrations/0560-user-feed-token.ts2
-rw-r--r--server/lib/activitypub/actors/shared/object-to-model-attributes.ts3
-rw-r--r--server/lib/local-actor.ts3
-rw-r--r--server/lib/paths.ts3
-rw-r--r--server/lib/user.ts2
-rw-r--r--server/lib/video-path-manager.ts2
-rw-r--r--server/models/user/user-notification.ts2
-rw-r--r--server/models/video/formatter/video-format-utils.ts2
-rw-r--r--server/models/video/video-caption.ts2
-rw-r--r--server/models/video/video-playlist.ts3
-rw-r--r--server/models/video/video.ts3
-rw-r--r--server/tests/api/notifications/moderation-notifications.ts3
-rw-r--r--server/tests/api/notifications/user-notifications.ts3
-rw-r--r--server/tests/cli/prune-storage.ts3
-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
30 files changed, 44 insertions, 28 deletions
diff --git a/client/src/app/core/plugins/plugin.service.ts b/client/src/app/core/plugins/plugin.service.ts
index bb9125fe1..dadc2a41d 100644
--- a/client/src/app/core/plugins/plugin.service.ts
+++ b/client/src/app/core/plugins/plugin.service.ts
@@ -11,6 +11,7 @@ import { ServerService } from '@app/core/server/server.service'
11import { getDevLocale, isOnDevLocale } from '@app/helpers' 11import { getDevLocale, isOnDevLocale } from '@app/helpers'
12import { CustomModalComponent } from '@app/modal/custom-modal.component' 12import { CustomModalComponent } from '@app/modal/custom-modal.component'
13import { PluginInfo, PluginsManager } from '@root-helpers/plugins-manager' 13import { PluginInfo, PluginsManager } from '@root-helpers/plugins-manager'
14import { getKeys } from '@shared/core-utils'
14import { getCompleteLocale, isDefaultLocale, peertubeTranslate } from '@shared/core-utils/i18n' 15import { getCompleteLocale, isDefaultLocale, peertubeTranslate } from '@shared/core-utils/i18n'
15import { 16import {
16 ClientHook, 17 ClientHook,
@@ -134,7 +135,7 @@ export class PluginService implements ClientHook {
134 } 135 }
135 136
136 async translateSetting (npmName: string, setting: RegisterClientFormFieldOptions) { 137 async translateSetting (npmName: string, setting: RegisterClientFormFieldOptions) {
137 for (const key of [ 'label', 'html', 'descriptionHTML' ]) { 138 for (const key of getKeys(setting, [ 'label', 'html', 'descriptionHTML' ])) {
138 if (setting[key]) setting[key] = await this.translateBy(npmName, setting[key]) 139 if (setting[key]) setting[key] = await this.translateBy(npmName, setting[key])
139 } 140 }
140 141
diff --git a/client/src/app/shared/shared-forms/dynamic-form-field.component.html b/client/src/app/shared/shared-forms/dynamic-form-field.component.html
index c228069b5..2ef61ecfc 100644
--- a/client/src/app/shared/shared-forms/dynamic-form-field.component.html
+++ b/client/src/app/shared/shared-forms/dynamic-form-field.component.html
@@ -1,4 +1,4 @@
1<div [formGroup]="form"> 1<div *ngIf="form" [formGroup]="form">
2 <label *ngIf="setting.label && setting.type !== 'input-checkbox'" [attr.for]="setting.name" [innerHTML]="setting.label"></label> 2 <label *ngIf="setting.label && setting.type !== 'input-checkbox'" [attr.for]="setting.name" [innerHTML]="setting.label"></label>
3 3
4 <my-peertube-checkbox 4 <my-peertube-checkbox
diff --git a/server/controllers/api/users/token.ts b/server/controllers/api/users/token.ts
index 5ada4a805..258b50fe9 100644
--- a/server/controllers/api/users/token.ts
+++ b/server/controllers/api/users/token.ts
@@ -7,7 +7,7 @@ import { handleOAuthToken } from '@server/lib/auth/oauth'
7import { BypassLogin, revokeToken } from '@server/lib/auth/oauth-model' 7import { BypassLogin, revokeToken } from '@server/lib/auth/oauth-model'
8import { Hooks } from '@server/lib/plugins/hooks' 8import { Hooks } from '@server/lib/plugins/hooks'
9import { asyncMiddleware, authenticate, openapiOperationDoc } from '@server/middlewares' 9import { asyncMiddleware, authenticate, openapiOperationDoc } from '@server/middlewares'
10import { buildUUID } from '@shared/core-utils' 10import { buildUUID } from '@shared/extra-utils'
11import { ScopedToken } from '@shared/models/users/user-scoped-token' 11import { ScopedToken } from '@shared/models/users/user-scoped-token'
12 12
13const tokensRouter = express.Router() 13const tokensRouter = express.Router()
diff --git a/server/controllers/api/video-playlist.ts b/server/controllers/api/video-playlist.ts
index dc1947764..795e14e73 100644
--- a/server/controllers/api/video-playlist.ts
+++ b/server/controllers/api/video-playlist.ts
@@ -4,7 +4,7 @@ import { scheduleRefreshIfNeeded } from '@server/lib/activitypub/playlists'
4import { Hooks } from '@server/lib/plugins/hooks' 4import { Hooks } from '@server/lib/plugins/hooks'
5import { getServerActor } from '@server/models/application/application' 5import { getServerActor } from '@server/models/application/application'
6import { MVideoPlaylistFull, MVideoPlaylistThumbnail, MVideoThumbnail } from '@server/types/models' 6import { MVideoPlaylistFull, MVideoPlaylistThumbnail, MVideoThumbnail } from '@server/types/models'
7import { uuidToShort } from '@shared/core-utils' 7import { uuidToShort } from '@shared/extra-utils'
8import { VideoPlaylistCreateResult, VideoPlaylistElementCreateResult } from '@shared/models' 8import { VideoPlaylistCreateResult, VideoPlaylistElementCreateResult } from '@shared/models'
9import { HttpStatusCode } from '../../../shared/models/http/http-error-codes' 9import { HttpStatusCode } from '../../../shared/models/http/http-error-codes'
10import { VideoPlaylistCreate } from '../../../shared/models/videos/playlist/video-playlist-create.model' 10import { VideoPlaylistCreate } from '../../../shared/models/videos/playlist/video-playlist-create.model'
diff --git a/server/controllers/api/videos/live.ts b/server/controllers/api/videos/live.ts
index 80ecbfef1..8b8cacff9 100644
--- a/server/controllers/api/videos/live.ts
+++ b/server/controllers/api/videos/live.ts
@@ -9,7 +9,7 @@ import { buildLocalVideoFromReq, buildVideoThumbnailsFromReq, setVideoTags } fro
9import { videoLiveAddValidator, videoLiveGetValidator, videoLiveUpdateValidator } from '@server/middlewares/validators/videos/video-live' 9import { videoLiveAddValidator, videoLiveGetValidator, videoLiveUpdateValidator } from '@server/middlewares/validators/videos/video-live'
10import { VideoLiveModel } from '@server/models/video/video-live' 10import { VideoLiveModel } from '@server/models/video/video-live'
11import { MVideoDetails, MVideoFullLight } from '@server/types/models' 11import { MVideoDetails, MVideoFullLight } from '@server/types/models'
12import { buildUUID, uuidToShort } from '@shared/core-utils' 12import { buildUUID, uuidToShort } from '@shared/extra-utils'
13import { HttpStatusCode, LiveVideoCreate, LiveVideoUpdate, VideoState } from '@shared/models' 13import { HttpStatusCode, LiveVideoCreate, LiveVideoUpdate, VideoState } from '@shared/models'
14import { logger } from '../../../helpers/logger' 14import { logger } from '../../../helpers/logger'
15import { sequelizeTypescript } from '../../../initializers/database' 15import { sequelizeTypescript } from '../../../initializers/database'
diff --git a/server/controllers/api/videos/upload.ts b/server/controllers/api/videos/upload.ts
index e8f400cff..89787f20b 100644
--- a/server/controllers/api/videos/upload.ts
+++ b/server/controllers/api/videos/upload.ts
@@ -18,8 +18,8 @@ import { VideoPathManager } from '@server/lib/video-path-manager'
18import { buildNextVideoState } from '@server/lib/video-state' 18import { buildNextVideoState } from '@server/lib/video-state'
19import { openapiOperationDoc } from '@server/middlewares/doc' 19import { openapiOperationDoc } from '@server/middlewares/doc'
20import { MVideo, MVideoFile, MVideoFullLight } from '@server/types/models' 20import { MVideo, MVideoFile, MVideoFullLight } from '@server/types/models'
21import { getLowercaseExtension, uuidToShort } from '@shared/core-utils' 21import { getLowercaseExtension } from '@shared/core-utils'
22import { isAudioFile } from '@shared/extra-utils' 22import { isAudioFile, uuidToShort } from '@shared/extra-utils'
23import { HttpStatusCode, VideoCreate, VideoResolution, VideoState } from '@shared/models' 23import { HttpStatusCode, VideoCreate, VideoResolution, VideoState } from '@shared/models'
24import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../helpers/audit-logger' 24import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../helpers/audit-logger'
25import { retryTransactionWrapper } from '../../../helpers/database-utils' 25import { retryTransactionWrapper } from '../../../helpers/database-utils'
diff --git a/server/helpers/custom-validators/misc.ts b/server/helpers/custom-validators/misc.ts
index 65578c143..81a60ee66 100644
--- a/server/helpers/custom-validators/misc.ts
+++ b/server/helpers/custom-validators/misc.ts
@@ -2,7 +2,7 @@ import 'multer'
2import { UploadFilesForCheck } from 'express' 2import { UploadFilesForCheck } from 'express'
3import { sep } from 'path' 3import { sep } from 'path'
4import validator from 'validator' 4import validator from 'validator'
5import { isShortUUID, shortToUUID } from '@shared/core-utils' 5import { isShortUUID, shortToUUID } from '@shared/extra-utils'
6 6
7function exists (value: any) { 7function exists (value: any) {
8 return value !== undefined && value !== null 8 return value !== undefined && value !== null
diff --git a/server/helpers/image-utils.ts b/server/helpers/image-utils.ts
index c4704b189..b174ae436 100644
--- a/server/helpers/image-utils.ts
+++ b/server/helpers/image-utils.ts
@@ -1,6 +1,7 @@
1import { copy, readFile, remove, rename } from 'fs-extra' 1import { copy, readFile, remove, rename } from 'fs-extra'
2import Jimp, { read } from 'jimp' 2import Jimp, { read } from 'jimp'
3import { buildUUID, getLowercaseExtension } from '@shared/core-utils' 3import { getLowercaseExtension } from '@shared/core-utils'
4import { buildUUID } from '@shared/extra-utils'
4import { convertWebPToJPG, processGIF } from './ffmpeg-utils' 5import { convertWebPToJPG, processGIF } from './ffmpeg-utils'
5import { logger } from './logger' 6import { logger } from './logger'
6 7
diff --git a/server/initializers/migrations/0080-video-channels.ts b/server/initializers/migrations/0080-video-channels.ts
index 221475bb1..ef3e15968 100644
--- a/server/initializers/migrations/0080-video-channels.ts
+++ b/server/initializers/migrations/0080-video-channels.ts
@@ -1,4 +1,4 @@
1import { buildUUID } from '@shared/core-utils' 1import { buildUUID } from '@shared/extra-utils'
2import * as Sequelize from 'sequelize' 2import * as Sequelize from 'sequelize'
3 3
4async function up (utils: { 4async function up (utils: {
diff --git a/server/initializers/migrations/0345-video-playlists.ts b/server/initializers/migrations/0345-video-playlists.ts
index fb27c9301..4bf3100e4 100644
--- a/server/initializers/migrations/0345-video-playlists.ts
+++ b/server/initializers/migrations/0345-video-playlists.ts
@@ -1,5 +1,5 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2import { buildUUID } from '@shared/core-utils' 2import { buildUUID } from '@shared/extra-utils'
3import { VideoPlaylistPrivacy, VideoPlaylistType } from '../../../shared/models/videos' 3import { VideoPlaylistPrivacy, VideoPlaylistType } from '../../../shared/models/videos'
4import { WEBSERVER } from '../constants' 4import { WEBSERVER } from '../constants'
5 5
diff --git a/server/initializers/migrations/0560-user-feed-token.ts b/server/initializers/migrations/0560-user-feed-token.ts
index 4ed4d9681..4c85b04f7 100644
--- a/server/initializers/migrations/0560-user-feed-token.ts
+++ b/server/initializers/migrations/0560-user-feed-token.ts
@@ -1,5 +1,5 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2import { buildUUID } from '@shared/core-utils' 2import { buildUUID } from '@shared/extra-utils'
3 3
4async function up (utils: { 4async function up (utils: {
5 transaction: Sequelize.Transaction 5 transaction: Sequelize.Transaction
diff --git a/server/lib/activitypub/actors/shared/object-to-model-attributes.ts b/server/lib/activitypub/actors/shared/object-to-model-attributes.ts
index 38d93c108..23bc972e5 100644
--- a/server/lib/activitypub/actors/shared/object-to-model-attributes.ts
+++ b/server/lib/activitypub/actors/shared/object-to-model-attributes.ts
@@ -2,7 +2,8 @@ import { isActivityPubUrlValid } from '@server/helpers/custom-validators/activit
2import { MIMETYPES } from '@server/initializers/constants' 2import { MIMETYPES } from '@server/initializers/constants'
3import { ActorModel } from '@server/models/actor/actor' 3import { ActorModel } from '@server/models/actor/actor'
4import { FilteredModelAttributes } from '@server/types' 4import { FilteredModelAttributes } from '@server/types'
5import { buildUUID, getLowercaseExtension } from '@shared/core-utils' 5import { getLowercaseExtension } from '@shared/core-utils'
6import { buildUUID } from '@shared/extra-utils'
6import { ActivityPubActor, ActorImageType } from '@shared/models' 7import { ActivityPubActor, ActorImageType } from '@shared/models'
7 8
8function getActorAttributesFromObject ( 9function getActorAttributesFromObject (
diff --git a/server/lib/local-actor.ts b/server/lib/local-actor.ts
index 04ad98f3e..c6826759b 100644
--- a/server/lib/local-actor.ts
+++ b/server/lib/local-actor.ts
@@ -3,7 +3,8 @@ import { queue } from 'async'
3import LRUCache from 'lru-cache' 3import LRUCache from 'lru-cache'
4import { join } from 'path' 4import { join } from 'path'
5import { ActorModel } from '@server/models/actor/actor' 5import { ActorModel } from '@server/models/actor/actor'
6import { buildUUID, getLowercaseExtension } from '@shared/core-utils' 6import { getLowercaseExtension } from '@shared/core-utils'
7import { buildUUID } from '@shared/extra-utils'
7import { ActivityPubActorType, ActorImageType } from '@shared/models' 8import { ActivityPubActorType, ActorImageType } from '@shared/models'
8import { retryTransactionWrapper } from '../helpers/database-utils' 9import { retryTransactionWrapper } from '../helpers/database-utils'
9import { processImage } from '../helpers/image-utils' 10import { processImage } from '../helpers/image-utils'
diff --git a/server/lib/paths.ts b/server/lib/paths.ts
index bf0c3a86b..5a85bea42 100644
--- a/server/lib/paths.ts
+++ b/server/lib/paths.ts
@@ -2,7 +2,8 @@ import { join } from 'path'
2import { CONFIG } from '@server/initializers/config' 2import { CONFIG } from '@server/initializers/config'
3import { HLS_REDUNDANCY_DIRECTORY, HLS_STREAMING_PLAYLIST_DIRECTORY } from '@server/initializers/constants' 3import { HLS_REDUNDANCY_DIRECTORY, HLS_STREAMING_PLAYLIST_DIRECTORY } from '@server/initializers/constants'
4import { isStreamingPlaylist, MStreamingPlaylistVideo, MVideo, MVideoFile, MVideoUUID } from '@server/types/models' 4import { isStreamingPlaylist, MStreamingPlaylistVideo, MVideo, MVideoFile, MVideoUUID } from '@server/types/models'
5import { buildUUID, removeFragmentedMP4Ext } from '@shared/core-utils' 5import { removeFragmentedMP4Ext } from '@shared/core-utils'
6import { buildUUID } from '@shared/extra-utils'
6 7
7// ################## Video file name ################## 8// ################## Video file name ##################
8 9
diff --git a/server/lib/user.ts b/server/lib/user.ts
index 3ba0c0ca4..0d292ac90 100644
--- a/server/lib/user.ts
+++ b/server/lib/user.ts
@@ -1,7 +1,7 @@
1import { Transaction } from 'sequelize/types' 1import { Transaction } from 'sequelize/types'
2import { UserModel } from '@server/models/user/user' 2import { UserModel } from '@server/models/user/user'
3import { MActorDefault } from '@server/types/models/actor' 3import { MActorDefault } from '@server/types/models/actor'
4import { buildUUID } from '@shared/core-utils' 4import { buildUUID } from '@shared/extra-utils'
5import { ActivityPubActorType } from '../../shared/models/activitypub' 5import { ActivityPubActorType } from '../../shared/models/activitypub'
6import { UserNotificationSetting, UserNotificationSettingValue } from '../../shared/models/users' 6import { UserNotificationSetting, UserNotificationSettingValue } from '../../shared/models/users'
7import { SERVER_ACTOR_NAME, WEBSERVER } from '../initializers/constants' 7import { SERVER_ACTOR_NAME, WEBSERVER } from '../initializers/constants'
diff --git a/server/lib/video-path-manager.ts b/server/lib/video-path-manager.ts
index 4027f885d..c3f55fd95 100644
--- a/server/lib/video-path-manager.ts
+++ b/server/lib/video-path-manager.ts
@@ -10,7 +10,7 @@ import {
10 MVideoFileVideo, 10 MVideoFileVideo,
11 MVideoUUID 11 MVideoUUID
12} from '@server/types/models' 12} from '@server/types/models'
13import { buildUUID } from '@shared/core-utils' 13import { buildUUID } from '@shared/extra-utils'
14import { VideoStorage } from '@shared/models' 14import { VideoStorage } from '@shared/models'
15import { makeHLSFileAvailable, makeWebTorrentFileAvailable } from './object-storage' 15import { makeHLSFileAvailable, makeWebTorrentFileAvailable } from './object-storage'
16import { getHLSDirectory, getHLSRedundancyDirectory, getHlsResolutionPlaylistFilename } from './paths' 16import { getHLSDirectory, getHLSRedundancyDirectory, getHlsResolutionPlaylistFilename } from './paths'
diff --git a/server/models/user/user-notification.ts b/server/models/user/user-notification.ts
index 8450ad49e..edad10a55 100644
--- a/server/models/user/user-notification.ts
+++ b/server/models/user/user-notification.ts
@@ -1,7 +1,7 @@
1import { FindOptions, ModelIndexesOptions, Op, WhereOptions } from 'sequelize' 1import { FindOptions, ModelIndexesOptions, Op, WhereOptions } from 'sequelize'
2import { AllowNull, BelongsTo, Column, CreatedAt, Default, ForeignKey, Is, Model, Scopes, Table, UpdatedAt } from 'sequelize-typescript' 2import { AllowNull, BelongsTo, Column, CreatedAt, Default, ForeignKey, Is, Model, Scopes, Table, UpdatedAt } from 'sequelize-typescript'
3import { UserNotificationIncludes, UserNotificationModelForApi } from '@server/types/models/user' 3import { UserNotificationIncludes, UserNotificationModelForApi } from '@server/types/models/user'
4import { uuidToShort } from '@shared/core-utils' 4import { uuidToShort } from '@shared/extra-utils'
5import { UserNotification, UserNotificationType } from '@shared/models' 5import { UserNotification, UserNotificationType } from '@shared/models'
6import { AttributesOnly } from '@shared/typescript-utils' 6import { AttributesOnly } from '@shared/typescript-utils'
7import { isBooleanValid } from '../../helpers/custom-validators/misc' 7import { isBooleanValid } from '../../helpers/custom-validators/misc'
diff --git a/server/models/video/formatter/video-format-utils.ts b/server/models/video/formatter/video-format-utils.ts
index 99a4818ab..7456f37c5 100644
--- a/server/models/video/formatter/video-format-utils.ts
+++ b/server/models/video/formatter/video-format-utils.ts
@@ -1,7 +1,7 @@
1import { generateMagnetUri } from '@server/helpers/webtorrent' 1import { generateMagnetUri } from '@server/helpers/webtorrent'
2import { getLocalVideoFileMetadataUrl } from '@server/lib/video-urls' 2import { getLocalVideoFileMetadataUrl } from '@server/lib/video-urls'
3import { VideoViews } from '@server/lib/video-views' 3import { VideoViews } from '@server/lib/video-views'
4import { uuidToShort } from '@shared/core-utils' 4import { uuidToShort } from '@shared/extra-utils'
5import { VideoFile, VideosCommonQueryAfterSanitize } from '@shared/models' 5import { VideoFile, VideosCommonQueryAfterSanitize } from '@shared/models'
6import { ActivityTagObject, ActivityUrlObject, VideoObject } from '../../../../shared/models/activitypub/objects' 6import { ActivityTagObject, ActivityUrlObject, VideoObject } from '../../../../shared/models/activitypub/objects'
7import { Video, VideoDetails, VideoInclude } from '../../../../shared/models/videos' 7import { Video, VideoDetails, VideoInclude } from '../../../../shared/models/videos'
diff --git a/server/models/video/video-caption.ts b/server/models/video/video-caption.ts
index 20741ea64..6b240f116 100644
--- a/server/models/video/video-caption.ts
+++ b/server/models/video/video-caption.ts
@@ -16,7 +16,7 @@ import {
16 UpdatedAt 16 UpdatedAt
17} from 'sequelize-typescript' 17} from 'sequelize-typescript'
18import { MVideo, MVideoCaption, MVideoCaptionFormattable, MVideoCaptionVideo } from '@server/types/models' 18import { MVideo, MVideoCaption, MVideoCaptionFormattable, MVideoCaptionVideo } from '@server/types/models'
19import { buildUUID } from '@shared/core-utils' 19import { buildUUID } from '@shared/extra-utils'
20import { AttributesOnly } from '@shared/typescript-utils' 20import { AttributesOnly } from '@shared/typescript-utils'
21import { VideoCaption } from '../../../shared/models/videos/caption/video-caption.model' 21import { VideoCaption } from '../../../shared/models/videos/caption/video-caption.model'
22import { isVideoCaptionLanguageValid } from '../../helpers/custom-validators/video-captions' 22import { isVideoCaptionLanguageValid } from '../../helpers/custom-validators/video-captions'
diff --git a/server/models/video/video-playlist.ts b/server/models/video/video-playlist.ts
index 07bb64810..0d43c795e 100644
--- a/server/models/video/video-playlist.ts
+++ b/server/models/video/video-playlist.ts
@@ -18,7 +18,8 @@ import {
18 UpdatedAt 18 UpdatedAt
19} from 'sequelize-typescript' 19} from 'sequelize-typescript'
20import { MAccountId, MChannelId } from '@server/types/models' 20import { MAccountId, MChannelId } from '@server/types/models'
21import { buildPlaylistEmbedPath, buildPlaylistWatchPath, buildUUID, pick, uuidToShort } from '@shared/core-utils' 21import { buildPlaylistEmbedPath, buildPlaylistWatchPath, pick } from '@shared/core-utils'
22import { buildUUID, uuidToShort } from '@shared/extra-utils'
22import { AttributesOnly } from '@shared/typescript-utils' 23import { AttributesOnly } from '@shared/typescript-utils'
23import { ActivityIconObject } from '../../../shared/models/activitypub/objects' 24import { ActivityIconObject } from '../../../shared/models/activitypub/objects'
24import { PlaylistObject } from '../../../shared/models/activitypub/objects/playlist-object' 25import { PlaylistObject } from '../../../shared/models/activitypub/objects/playlist-object'
diff --git a/server/models/video/video.ts b/server/models/video/video.ts
index 1f103f930..e5077487a 100644
--- a/server/models/video/video.ts
+++ b/server/models/video/video.ts
@@ -32,7 +32,8 @@ import { getHLSDirectory, getHLSRedundancyDirectory } from '@server/lib/paths'
32import { VideoPathManager } from '@server/lib/video-path-manager' 32import { VideoPathManager } from '@server/lib/video-path-manager'
33import { getServerActor } from '@server/models/application/application' 33import { getServerActor } from '@server/models/application/application'
34import { ModelCache } from '@server/models/model-cache' 34import { ModelCache } from '@server/models/model-cache'
35import { buildVideoEmbedPath, buildVideoWatchPath, pick, uuidToShort } from '@shared/core-utils' 35import { buildVideoEmbedPath, buildVideoWatchPath, pick } from '@shared/core-utils'
36import { uuidToShort } from '@shared/extra-utils'
36import { 37import {
37 ResultList, 38 ResultList,
38 ThumbnailType, 39 ThumbnailType,
diff --git a/server/tests/api/notifications/moderation-notifications.ts b/server/tests/api/notifications/moderation-notifications.ts
index e6e1d5f7b..9e330bd61 100644
--- a/server/tests/api/notifications/moderation-notifications.ts
+++ b/server/tests/api/notifications/moderation-notifications.ts
@@ -19,7 +19,8 @@ import {
19 MockSmtpServer, 19 MockSmtpServer,
20 prepareNotificationsTest 20 prepareNotificationsTest
21} from '@server/tests/shared' 21} from '@server/tests/shared'
22import { buildUUID, wait } from '@shared/core-utils' 22import { wait } from '@shared/core-utils'
23import { buildUUID } from '@shared/extra-utils'
23import { AbuseState, CustomConfig, UserNotification, UserRole, VideoPrivacy } from '@shared/models' 24import { AbuseState, CustomConfig, UserNotification, UserRole, VideoPrivacy } from '@shared/models'
24import { cleanupTests, PeerTubeServer, waitJobs } from '@shared/server-commands' 25import { cleanupTests, PeerTubeServer, waitJobs } from '@shared/server-commands'
25 26
diff --git a/server/tests/api/notifications/user-notifications.ts b/server/tests/api/notifications/user-notifications.ts
index 0bd474c09..f9f3e0e0e 100644
--- a/server/tests/api/notifications/user-notifications.ts
+++ b/server/tests/api/notifications/user-notifications.ts
@@ -13,7 +13,8 @@ import {
13 prepareNotificationsTest, 13 prepareNotificationsTest,
14 uploadRandomVideoOnServers 14 uploadRandomVideoOnServers
15} from '@server/tests/shared' 15} from '@server/tests/shared'
16import { buildUUID, wait } from '@shared/core-utils' 16import { wait } from '@shared/core-utils'
17import { buildUUID } from '@shared/extra-utils'
17import { UserNotification, UserNotificationType, VideoPrivacy } from '@shared/models' 18import { UserNotification, UserNotificationType, VideoPrivacy } from '@shared/models'
18import { cleanupTests, PeerTubeServer, waitJobs } from '@shared/server-commands' 19import { cleanupTests, PeerTubeServer, waitJobs } from '@shared/server-commands'
19 20
diff --git a/server/tests/cli/prune-storage.ts b/server/tests/cli/prune-storage.ts
index 8e8fc7e20..a723ed8b4 100644
--- a/server/tests/cli/prune-storage.ts
+++ b/server/tests/cli/prune-storage.ts
@@ -4,7 +4,8 @@ import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { createFile, readdir } from 'fs-extra' 5import { createFile, readdir } from 'fs-extra'
6import { join } from 'path' 6import { join } from 'path'
7import { buildUUID, wait } from '@shared/core-utils' 7import { wait } from '@shared/core-utils'
8import { buildUUID } from '@shared/extra-utils'
8import { HttpStatusCode, VideoPlaylistPrivacy } from '@shared/models' 9import { HttpStatusCode, VideoPlaylistPrivacy } from '@shared/models'
9import { 10import {
10 cleanupTests, 11 cleanupTests,
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,