diff options
author | Chocobozzz <me@florianbigard.com> | 2021-12-29 14:44:58 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-12-29 14:44:58 +0100 |
commit | 0628157fe9662fdb2b6fa658b8b53fe684c013ce (patch) | |
tree | 52bf9dc16d9e30cb716a6df76ce12fd7d34cff7f | |
parent | fb3c9e2bf5b45d6d283cea4d55cc0d49eb58e3cb (diff) | |
download | PeerTube-0628157fe9662fdb2b6fa658b8b53fe684c013ce.tar.gz PeerTube-0628157fe9662fdb2b6fa658b8b53fe684c013ce.tar.zst PeerTube-0628157fe9662fdb2b6fa658b8b53fe684c013ce.zip |
Move uuid stuff in extra utils
Since it requires an external dependency
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' | |||
11 | import { getDevLocale, isOnDevLocale } from '@app/helpers' | 11 | import { getDevLocale, isOnDevLocale } from '@app/helpers' |
12 | import { CustomModalComponent } from '@app/modal/custom-modal.component' | 12 | import { CustomModalComponent } from '@app/modal/custom-modal.component' |
13 | import { PluginInfo, PluginsManager } from '@root-helpers/plugins-manager' | 13 | import { PluginInfo, PluginsManager } from '@root-helpers/plugins-manager' |
14 | import { getKeys } from '@shared/core-utils' | ||
14 | import { getCompleteLocale, isDefaultLocale, peertubeTranslate } from '@shared/core-utils/i18n' | 15 | import { getCompleteLocale, isDefaultLocale, peertubeTranslate } from '@shared/core-utils/i18n' |
15 | import { | 16 | import { |
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' | |||
7 | import { BypassLogin, revokeToken } from '@server/lib/auth/oauth-model' | 7 | import { BypassLogin, revokeToken } from '@server/lib/auth/oauth-model' |
8 | import { Hooks } from '@server/lib/plugins/hooks' | 8 | import { Hooks } from '@server/lib/plugins/hooks' |
9 | import { asyncMiddleware, authenticate, openapiOperationDoc } from '@server/middlewares' | 9 | import { asyncMiddleware, authenticate, openapiOperationDoc } from '@server/middlewares' |
10 | import { buildUUID } from '@shared/core-utils' | 10 | import { buildUUID } from '@shared/extra-utils' |
11 | import { ScopedToken } from '@shared/models/users/user-scoped-token' | 11 | import { ScopedToken } from '@shared/models/users/user-scoped-token' |
12 | 12 | ||
13 | const tokensRouter = express.Router() | 13 | const 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' | |||
4 | import { Hooks } from '@server/lib/plugins/hooks' | 4 | import { Hooks } from '@server/lib/plugins/hooks' |
5 | import { getServerActor } from '@server/models/application/application' | 5 | import { getServerActor } from '@server/models/application/application' |
6 | import { MVideoPlaylistFull, MVideoPlaylistThumbnail, MVideoThumbnail } from '@server/types/models' | 6 | import { MVideoPlaylistFull, MVideoPlaylistThumbnail, MVideoThumbnail } from '@server/types/models' |
7 | import { uuidToShort } from '@shared/core-utils' | 7 | import { uuidToShort } from '@shared/extra-utils' |
8 | import { VideoPlaylistCreateResult, VideoPlaylistElementCreateResult } from '@shared/models' | 8 | import { VideoPlaylistCreateResult, VideoPlaylistElementCreateResult } from '@shared/models' |
9 | import { HttpStatusCode } from '../../../shared/models/http/http-error-codes' | 9 | import { HttpStatusCode } from '../../../shared/models/http/http-error-codes' |
10 | import { VideoPlaylistCreate } from '../../../shared/models/videos/playlist/video-playlist-create.model' | 10 | import { 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 | |||
9 | import { videoLiveAddValidator, videoLiveGetValidator, videoLiveUpdateValidator } from '@server/middlewares/validators/videos/video-live' | 9 | import { videoLiveAddValidator, videoLiveGetValidator, videoLiveUpdateValidator } from '@server/middlewares/validators/videos/video-live' |
10 | import { VideoLiveModel } from '@server/models/video/video-live' | 10 | import { VideoLiveModel } from '@server/models/video/video-live' |
11 | import { MVideoDetails, MVideoFullLight } from '@server/types/models' | 11 | import { MVideoDetails, MVideoFullLight } from '@server/types/models' |
12 | import { buildUUID, uuidToShort } from '@shared/core-utils' | 12 | import { buildUUID, uuidToShort } from '@shared/extra-utils' |
13 | import { HttpStatusCode, LiveVideoCreate, LiveVideoUpdate, VideoState } from '@shared/models' | 13 | import { HttpStatusCode, LiveVideoCreate, LiveVideoUpdate, VideoState } from '@shared/models' |
14 | import { logger } from '../../../helpers/logger' | 14 | import { logger } from '../../../helpers/logger' |
15 | import { sequelizeTypescript } from '../../../initializers/database' | 15 | import { 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' | |||
18 | import { buildNextVideoState } from '@server/lib/video-state' | 18 | import { buildNextVideoState } from '@server/lib/video-state' |
19 | import { openapiOperationDoc } from '@server/middlewares/doc' | 19 | import { openapiOperationDoc } from '@server/middlewares/doc' |
20 | import { MVideo, MVideoFile, MVideoFullLight } from '@server/types/models' | 20 | import { MVideo, MVideoFile, MVideoFullLight } from '@server/types/models' |
21 | import { getLowercaseExtension, uuidToShort } from '@shared/core-utils' | 21 | import { getLowercaseExtension } from '@shared/core-utils' |
22 | import { isAudioFile } from '@shared/extra-utils' | 22 | import { isAudioFile, uuidToShort } from '@shared/extra-utils' |
23 | import { HttpStatusCode, VideoCreate, VideoResolution, VideoState } from '@shared/models' | 23 | import { HttpStatusCode, VideoCreate, VideoResolution, VideoState } from '@shared/models' |
24 | import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../helpers/audit-logger' | 24 | import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../helpers/audit-logger' |
25 | import { retryTransactionWrapper } from '../../../helpers/database-utils' | 25 | import { 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' | |||
2 | import { UploadFilesForCheck } from 'express' | 2 | import { UploadFilesForCheck } from 'express' |
3 | import { sep } from 'path' | 3 | import { sep } from 'path' |
4 | import validator from 'validator' | 4 | import validator from 'validator' |
5 | import { isShortUUID, shortToUUID } from '@shared/core-utils' | 5 | import { isShortUUID, shortToUUID } from '@shared/extra-utils' |
6 | 6 | ||
7 | function exists (value: any) { | 7 | function 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 @@ | |||
1 | import { copy, readFile, remove, rename } from 'fs-extra' | 1 | import { copy, readFile, remove, rename } from 'fs-extra' |
2 | import Jimp, { read } from 'jimp' | 2 | import Jimp, { read } from 'jimp' |
3 | import { buildUUID, getLowercaseExtension } from '@shared/core-utils' | 3 | import { getLowercaseExtension } from '@shared/core-utils' |
4 | import { buildUUID } from '@shared/extra-utils' | ||
4 | import { convertWebPToJPG, processGIF } from './ffmpeg-utils' | 5 | import { convertWebPToJPG, processGIF } from './ffmpeg-utils' |
5 | import { logger } from './logger' | 6 | import { 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 @@ | |||
1 | import { buildUUID } from '@shared/core-utils' | 1 | import { buildUUID } from '@shared/extra-utils' |
2 | import * as Sequelize from 'sequelize' | 2 | import * as Sequelize from 'sequelize' |
3 | 3 | ||
4 | async function up (utils: { | 4 | async 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 @@ | |||
1 | import * as Sequelize from 'sequelize' | 1 | import * as Sequelize from 'sequelize' |
2 | import { buildUUID } from '@shared/core-utils' | 2 | import { buildUUID } from '@shared/extra-utils' |
3 | import { VideoPlaylistPrivacy, VideoPlaylistType } from '../../../shared/models/videos' | 3 | import { VideoPlaylistPrivacy, VideoPlaylistType } from '../../../shared/models/videos' |
4 | import { WEBSERVER } from '../constants' | 4 | import { 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 @@ | |||
1 | import * as Sequelize from 'sequelize' | 1 | import * as Sequelize from 'sequelize' |
2 | import { buildUUID } from '@shared/core-utils' | 2 | import { buildUUID } from '@shared/extra-utils' |
3 | 3 | ||
4 | async function up (utils: { | 4 | async 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 | |||
2 | import { MIMETYPES } from '@server/initializers/constants' | 2 | import { MIMETYPES } from '@server/initializers/constants' |
3 | import { ActorModel } from '@server/models/actor/actor' | 3 | import { ActorModel } from '@server/models/actor/actor' |
4 | import { FilteredModelAttributes } from '@server/types' | 4 | import { FilteredModelAttributes } from '@server/types' |
5 | import { buildUUID, getLowercaseExtension } from '@shared/core-utils' | 5 | import { getLowercaseExtension } from '@shared/core-utils' |
6 | import { buildUUID } from '@shared/extra-utils' | ||
6 | import { ActivityPubActor, ActorImageType } from '@shared/models' | 7 | import { ActivityPubActor, ActorImageType } from '@shared/models' |
7 | 8 | ||
8 | function getActorAttributesFromObject ( | 9 | function 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' | |||
3 | import LRUCache from 'lru-cache' | 3 | import LRUCache from 'lru-cache' |
4 | import { join } from 'path' | 4 | import { join } from 'path' |
5 | import { ActorModel } from '@server/models/actor/actor' | 5 | import { ActorModel } from '@server/models/actor/actor' |
6 | import { buildUUID, getLowercaseExtension } from '@shared/core-utils' | 6 | import { getLowercaseExtension } from '@shared/core-utils' |
7 | import { buildUUID } from '@shared/extra-utils' | ||
7 | import { ActivityPubActorType, ActorImageType } from '@shared/models' | 8 | import { ActivityPubActorType, ActorImageType } from '@shared/models' |
8 | import { retryTransactionWrapper } from '../helpers/database-utils' | 9 | import { retryTransactionWrapper } from '../helpers/database-utils' |
9 | import { processImage } from '../helpers/image-utils' | 10 | import { 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' | |||
2 | import { CONFIG } from '@server/initializers/config' | 2 | import { CONFIG } from '@server/initializers/config' |
3 | import { HLS_REDUNDANCY_DIRECTORY, HLS_STREAMING_PLAYLIST_DIRECTORY } from '@server/initializers/constants' | 3 | import { HLS_REDUNDANCY_DIRECTORY, HLS_STREAMING_PLAYLIST_DIRECTORY } from '@server/initializers/constants' |
4 | import { isStreamingPlaylist, MStreamingPlaylistVideo, MVideo, MVideoFile, MVideoUUID } from '@server/types/models' | 4 | import { isStreamingPlaylist, MStreamingPlaylistVideo, MVideo, MVideoFile, MVideoUUID } from '@server/types/models' |
5 | import { buildUUID, removeFragmentedMP4Ext } from '@shared/core-utils' | 5 | import { removeFragmentedMP4Ext } from '@shared/core-utils' |
6 | import { 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 @@ | |||
1 | import { Transaction } from 'sequelize/types' | 1 | import { Transaction } from 'sequelize/types' |
2 | import { UserModel } from '@server/models/user/user' | 2 | import { UserModel } from '@server/models/user/user' |
3 | import { MActorDefault } from '@server/types/models/actor' | 3 | import { MActorDefault } from '@server/types/models/actor' |
4 | import { buildUUID } from '@shared/core-utils' | 4 | import { buildUUID } from '@shared/extra-utils' |
5 | import { ActivityPubActorType } from '../../shared/models/activitypub' | 5 | import { ActivityPubActorType } from '../../shared/models/activitypub' |
6 | import { UserNotificationSetting, UserNotificationSettingValue } from '../../shared/models/users' | 6 | import { UserNotificationSetting, UserNotificationSettingValue } from '../../shared/models/users' |
7 | import { SERVER_ACTOR_NAME, WEBSERVER } from '../initializers/constants' | 7 | import { 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' |
13 | import { buildUUID } from '@shared/core-utils' | 13 | import { buildUUID } from '@shared/extra-utils' |
14 | import { VideoStorage } from '@shared/models' | 14 | import { VideoStorage } from '@shared/models' |
15 | import { makeHLSFileAvailable, makeWebTorrentFileAvailable } from './object-storage' | 15 | import { makeHLSFileAvailable, makeWebTorrentFileAvailable } from './object-storage' |
16 | import { getHLSDirectory, getHLSRedundancyDirectory, getHlsResolutionPlaylistFilename } from './paths' | 16 | import { 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 @@ | |||
1 | import { FindOptions, ModelIndexesOptions, Op, WhereOptions } from 'sequelize' | 1 | import { FindOptions, ModelIndexesOptions, Op, WhereOptions } from 'sequelize' |
2 | import { AllowNull, BelongsTo, Column, CreatedAt, Default, ForeignKey, Is, Model, Scopes, Table, UpdatedAt } from 'sequelize-typescript' | 2 | import { AllowNull, BelongsTo, Column, CreatedAt, Default, ForeignKey, Is, Model, Scopes, Table, UpdatedAt } from 'sequelize-typescript' |
3 | import { UserNotificationIncludes, UserNotificationModelForApi } from '@server/types/models/user' | 3 | import { UserNotificationIncludes, UserNotificationModelForApi } from '@server/types/models/user' |
4 | import { uuidToShort } from '@shared/core-utils' | 4 | import { uuidToShort } from '@shared/extra-utils' |
5 | import { UserNotification, UserNotificationType } from '@shared/models' | 5 | import { UserNotification, UserNotificationType } from '@shared/models' |
6 | import { AttributesOnly } from '@shared/typescript-utils' | 6 | import { AttributesOnly } from '@shared/typescript-utils' |
7 | import { isBooleanValid } from '../../helpers/custom-validators/misc' | 7 | import { 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 @@ | |||
1 | import { generateMagnetUri } from '@server/helpers/webtorrent' | 1 | import { generateMagnetUri } from '@server/helpers/webtorrent' |
2 | import { getLocalVideoFileMetadataUrl } from '@server/lib/video-urls' | 2 | import { getLocalVideoFileMetadataUrl } from '@server/lib/video-urls' |
3 | import { VideoViews } from '@server/lib/video-views' | 3 | import { VideoViews } from '@server/lib/video-views' |
4 | import { uuidToShort } from '@shared/core-utils' | 4 | import { uuidToShort } from '@shared/extra-utils' |
5 | import { VideoFile, VideosCommonQueryAfterSanitize } from '@shared/models' | 5 | import { VideoFile, VideosCommonQueryAfterSanitize } from '@shared/models' |
6 | import { ActivityTagObject, ActivityUrlObject, VideoObject } from '../../../../shared/models/activitypub/objects' | 6 | import { ActivityTagObject, ActivityUrlObject, VideoObject } from '../../../../shared/models/activitypub/objects' |
7 | import { Video, VideoDetails, VideoInclude } from '../../../../shared/models/videos' | 7 | import { 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' |
18 | import { MVideo, MVideoCaption, MVideoCaptionFormattable, MVideoCaptionVideo } from '@server/types/models' | 18 | import { MVideo, MVideoCaption, MVideoCaptionFormattable, MVideoCaptionVideo } from '@server/types/models' |
19 | import { buildUUID } from '@shared/core-utils' | 19 | import { buildUUID } from '@shared/extra-utils' |
20 | import { AttributesOnly } from '@shared/typescript-utils' | 20 | import { AttributesOnly } from '@shared/typescript-utils' |
21 | import { VideoCaption } from '../../../shared/models/videos/caption/video-caption.model' | 21 | import { VideoCaption } from '../../../shared/models/videos/caption/video-caption.model' |
22 | import { isVideoCaptionLanguageValid } from '../../helpers/custom-validators/video-captions' | 22 | import { 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' |
20 | import { MAccountId, MChannelId } from '@server/types/models' | 20 | import { MAccountId, MChannelId } from '@server/types/models' |
21 | import { buildPlaylistEmbedPath, buildPlaylistWatchPath, buildUUID, pick, uuidToShort } from '@shared/core-utils' | 21 | import { buildPlaylistEmbedPath, buildPlaylistWatchPath, pick } from '@shared/core-utils' |
22 | import { buildUUID, uuidToShort } from '@shared/extra-utils' | ||
22 | import { AttributesOnly } from '@shared/typescript-utils' | 23 | import { AttributesOnly } from '@shared/typescript-utils' |
23 | import { ActivityIconObject } from '../../../shared/models/activitypub/objects' | 24 | import { ActivityIconObject } from '../../../shared/models/activitypub/objects' |
24 | import { PlaylistObject } from '../../../shared/models/activitypub/objects/playlist-object' | 25 | import { 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' | |||
32 | import { VideoPathManager } from '@server/lib/video-path-manager' | 32 | import { VideoPathManager } from '@server/lib/video-path-manager' |
33 | import { getServerActor } from '@server/models/application/application' | 33 | import { getServerActor } from '@server/models/application/application' |
34 | import { ModelCache } from '@server/models/model-cache' | 34 | import { ModelCache } from '@server/models/model-cache' |
35 | import { buildVideoEmbedPath, buildVideoWatchPath, pick, uuidToShort } from '@shared/core-utils' | 35 | import { buildVideoEmbedPath, buildVideoWatchPath, pick } from '@shared/core-utils' |
36 | import { uuidToShort } from '@shared/extra-utils' | ||
36 | import { | 37 | import { |
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' |
22 | import { buildUUID, wait } from '@shared/core-utils' | 22 | import { wait } from '@shared/core-utils' |
23 | import { buildUUID } from '@shared/extra-utils' | ||
23 | import { AbuseState, CustomConfig, UserNotification, UserRole, VideoPrivacy } from '@shared/models' | 24 | import { AbuseState, CustomConfig, UserNotification, UserRole, VideoPrivacy } from '@shared/models' |
24 | import { cleanupTests, PeerTubeServer, waitJobs } from '@shared/server-commands' | 25 | import { 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' |
16 | import { buildUUID, wait } from '@shared/core-utils' | 16 | import { wait } from '@shared/core-utils' |
17 | import { buildUUID } from '@shared/extra-utils' | ||
17 | import { UserNotification, UserNotificationType, VideoPrivacy } from '@shared/models' | 18 | import { UserNotification, UserNotificationType, VideoPrivacy } from '@shared/models' |
18 | import { cleanupTests, PeerTubeServer, waitJobs } from '@shared/server-commands' | 19 | import { 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' | |||
4 | import * as chai from 'chai' | 4 | import * as chai from 'chai' |
5 | import { createFile, readdir } from 'fs-extra' | 5 | import { createFile, readdir } from 'fs-extra' |
6 | import { join } from 'path' | 6 | import { join } from 'path' |
7 | import { buildUUID, wait } from '@shared/core-utils' | 7 | import { wait } from '@shared/core-utils' |
8 | import { buildUUID } from '@shared/extra-utils' | ||
8 | import { HttpStatusCode, VideoPlaylistPrivacy } from '@shared/models' | 9 | import { HttpStatusCode, VideoPlaylistPrivacy } from '@shared/models' |
9 | import { | 10 | import { |
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 | ||
13 | function 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 | |||
13 | function sortObjectComparator (key: string, order: 'asc' | 'desc') { | 17 | function 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 | ||
27 | export { | 31 | export { |
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 @@ | |||
1 | import { VideoResolution } from "@shared/models" | 1 | import { VideoResolution } from '@shared/models' |
2 | 2 | ||
3 | type BitPerPixel = { [ id in VideoResolution ]: number } | 3 | type 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 @@ | |||
1 | export * from './bitrate' | 1 | export * from './bitrate' |
2 | export * from './privacy' | 2 | export * from './privacy' |
3 | export * 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 @@ | |||
1 | export * from './crypto' | 1 | export * from './crypto' |
2 | export * from './ffprobe' | 2 | export * from './ffprobe' |
3 | export * from './file' | 3 | export * from './file' |
4 | export * 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' | |||
5 | import got, { Response as GotResponse } from 'got' | 5 | import got, { Response as GotResponse } from 'got' |
6 | import { omit } from 'lodash' | 6 | import { omit } from 'lodash' |
7 | import validator from 'validator' | 7 | import validator from 'validator' |
8 | import { buildAbsoluteFixturePath, buildUUID, pick, wait } from '@shared/core-utils' | 8 | import { buildAbsoluteFixturePath, pick, wait } from '@shared/core-utils' |
9 | import { buildUUID } from '@shared/extra-utils' | ||
9 | import { | 10 | import { |
10 | HttpStatusCode, | 11 | HttpStatusCode, |
11 | ResultList, | 12 | ResultList, |