aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-16 14:27:30 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:19 +0200
commit4c7e60bc17ee5830399bac4aa273356903421b4c (patch)
tree9e67397cf49b229b5bc0f9747f1a7e387bba558a /shared
parentc0e8b12e7fd554ba4d2ceb0c4900804c6a4c63ea (diff)
downloadPeerTube-4c7e60bc17ee5830399bac4aa273356903421b4c.tar.gz
PeerTube-4c7e60bc17ee5830399bac4aa273356903421b4c.tar.zst
PeerTube-4c7e60bc17ee5830399bac4aa273356903421b4c.zip
Reorganize imports
Diffstat (limited to 'shared')
-rw-r--r--shared/extra-utils/custom-pages/custom-pages-command.ts3
-rw-r--r--shared/extra-utils/miscs/generate.ts2
-rw-r--r--shared/extra-utils/moderation/abuses-command.ts4
-rw-r--r--shared/extra-utils/overviews/overviews-command.ts3
-rw-r--r--shared/extra-utils/requests/activitypub.ts2
-rw-r--r--shared/extra-utils/search/search-command.ts2
-rw-r--r--shared/extra-utils/server/config-command.ts2
-rw-r--r--shared/extra-utils/server/debug-command.ts3
-rw-r--r--shared/extra-utils/server/follows-command.ts3
-rw-r--r--shared/extra-utils/server/plugins-command.ts2
-rw-r--r--shared/extra-utils/server/redundancy-command.ts3
-rw-r--r--shared/extra-utils/server/stats-command.ts3
-rw-r--r--shared/extra-utils/users/accounts-command.ts3
-rw-r--r--shared/extra-utils/users/blocklist-command.ts3
-rw-r--r--shared/extra-utils/users/login-command.ts3
-rw-r--r--shared/extra-utils/users/notifications-command.ts3
-rw-r--r--shared/extra-utils/users/subscriptions-command.ts3
-rw-r--r--shared/extra-utils/users/users-command.ts2
-rw-r--r--shared/extra-utils/videos/blacklist-command.ts3
-rw-r--r--shared/extra-utils/videos/captions-command.ts3
-rw-r--r--shared/extra-utils/videos/change-ownership-command.ts3
-rw-r--r--shared/extra-utils/videos/channels-command.ts3
-rw-r--r--shared/extra-utils/videos/comments-command.ts3
-rw-r--r--shared/extra-utils/videos/history-command.ts3
-rw-r--r--shared/extra-utils/videos/imports-command.ts3
-rw-r--r--shared/extra-utils/videos/live-command.ts3
-rw-r--r--shared/extra-utils/videos/playlists-command.ts2
-rw-r--r--shared/extra-utils/videos/streaming-playlists.ts3
-rw-r--r--shared/extra-utils/videos/videos-command.ts15
-rw-r--r--shared/extra-utils/videos/videos.ts2
30 files changed, 38 insertions, 57 deletions
diff --git a/shared/extra-utils/custom-pages/custom-pages-command.ts b/shared/extra-utils/custom-pages/custom-pages-command.ts
index 6042233d4..cd869a8de 100644
--- a/shared/extra-utils/custom-pages/custom-pages-command.ts
+++ b/shared/extra-utils/custom-pages/custom-pages-command.ts
@@ -1,5 +1,4 @@
1import { CustomPage } from '@shared/models' 1import { CustomPage, HttpStatusCode } from '@shared/models'
2import { HttpStatusCode } from '@shared/models'
3import { AbstractCommand, OverrideCommandOptions } from '../shared' 2import { AbstractCommand, OverrideCommandOptions } from '../shared'
4 3
5export class CustomPagesCommand extends AbstractCommand { 4export class CustomPagesCommand extends AbstractCommand {
diff --git a/shared/extra-utils/miscs/generate.ts b/shared/extra-utils/miscs/generate.ts
index 4e70ab853..8d6435481 100644
--- a/shared/extra-utils/miscs/generate.ts
+++ b/shared/extra-utils/miscs/generate.ts
@@ -1,7 +1,7 @@
1import * as ffmpeg from 'fluent-ffmpeg'
1import { ensureDir, pathExists } from 'fs-extra' 2import { ensureDir, pathExists } from 'fs-extra'
2import { dirname } from 'path' 3import { dirname } from 'path'
3import { buildAbsoluteFixturePath } from './tests' 4import { buildAbsoluteFixturePath } from './tests'
4import * as ffmpeg from 'fluent-ffmpeg'
5 5
6async function generateHighBitrateVideo () { 6async function generateHighBitrateVideo () {
7 const tempFixturePath = buildAbsoluteFixturePath('video_high_bitrate_1080p.mp4', true) 7 const tempFixturePath = buildAbsoluteFixturePath('video_high_bitrate_1080p.mp4', true)
diff --git a/shared/extra-utils/moderation/abuses-command.ts b/shared/extra-utils/moderation/abuses-command.ts
index 72f2c9951..7b3abb056 100644
--- a/shared/extra-utils/moderation/abuses-command.ts
+++ b/shared/extra-utils/moderation/abuses-command.ts
@@ -7,12 +7,12 @@ import {
7 AbuseUpdate, 7 AbuseUpdate,
8 AbuseVideoIs, 8 AbuseVideoIs,
9 AdminAbuse, 9 AdminAbuse,
10 HttpStatusCode,
10 ResultList, 11 ResultList,
11 UserAbuse 12 UserAbuse
12} from '@shared/models' 13} from '@shared/models'
13import { HttpStatusCode } from '@shared/models'
14import { AbstractCommand, OverrideCommandOptions } from '../shared'
15import { unwrapBody } from '../requests/requests' 14import { unwrapBody } from '../requests/requests'
15import { AbstractCommand, OverrideCommandOptions } from '../shared'
16 16
17export class AbusesCommand extends AbstractCommand { 17export class AbusesCommand extends AbstractCommand {
18 18
diff --git a/shared/extra-utils/overviews/overviews-command.ts b/shared/extra-utils/overviews/overviews-command.ts
index d4a2ac254..06b4892d2 100644
--- a/shared/extra-utils/overviews/overviews-command.ts
+++ b/shared/extra-utils/overviews/overviews-command.ts
@@ -1,5 +1,4 @@
1import { HttpStatusCode } from '@shared/models' 1import { HttpStatusCode, VideosOverview } from '@shared/models'
2import { VideosOverview } from '@shared/models'
3import { AbstractCommand, OverrideCommandOptions } from '../shared' 2import { AbstractCommand, OverrideCommandOptions } from '../shared'
4 3
5export class OverviewsCommand extends AbstractCommand { 4export class OverviewsCommand extends AbstractCommand {
diff --git a/shared/extra-utils/requests/activitypub.ts b/shared/extra-utils/requests/activitypub.ts
index ecd8ce823..4ae878384 100644
--- a/shared/extra-utils/requests/activitypub.ts
+++ b/shared/extra-utils/requests/activitypub.ts
@@ -1,7 +1,7 @@
1import { activityPubContextify } from '../../../server/helpers/activitypub'
1import { doRequest } from '../../../server/helpers/requests' 2import { doRequest } from '../../../server/helpers/requests'
2import { HTTP_SIGNATURE } from '../../../server/initializers/constants' 3import { HTTP_SIGNATURE } from '../../../server/initializers/constants'
3import { buildGlobalHeaders } from '../../../server/lib/job-queue/handlers/utils/activitypub-http-utils' 4import { buildGlobalHeaders } from '../../../server/lib/job-queue/handlers/utils/activitypub-http-utils'
4import { activityPubContextify } from '../../../server/helpers/activitypub'
5 5
6function makePOSTAPRequest (url: string, body: any, httpSignature: any, headers: any) { 6function makePOSTAPRequest (url: string, body: any, httpSignature: any, headers: any) {
7 const options = { 7 const options = {
diff --git a/shared/extra-utils/search/search-command.ts b/shared/extra-utils/search/search-command.ts
index 09f5d3f1d..0fbbcd6ef 100644
--- a/shared/extra-utils/search/search-command.ts
+++ b/shared/extra-utils/search/search-command.ts
@@ -1,4 +1,5 @@
1import { 1import {
2 HttpStatusCode,
2 ResultList, 3 ResultList,
3 Video, 4 Video,
4 VideoChannel, 5 VideoChannel,
@@ -7,7 +8,6 @@ import {
7 VideoPlaylistsSearchQuery, 8 VideoPlaylistsSearchQuery,
8 VideosSearchQuery 9 VideosSearchQuery
9} from '@shared/models' 10} from '@shared/models'
10import { HttpStatusCode } from '@shared/models'
11import { AbstractCommand, OverrideCommandOptions } from '../shared' 11import { AbstractCommand, OverrideCommandOptions } from '../shared'
12 12
13export class SearchCommand extends AbstractCommand { 13export class SearchCommand extends AbstractCommand {
diff --git a/shared/extra-utils/server/config-command.ts b/shared/extra-utils/server/config-command.ts
index 6e875fdf6..11148aa46 100644
--- a/shared/extra-utils/server/config-command.ts
+++ b/shared/extra-utils/server/config-command.ts
@@ -1,6 +1,6 @@
1import { merge } from 'lodash' 1import { merge } from 'lodash'
2import { DeepPartial } from '@shared/core-utils' 2import { DeepPartial } from '@shared/core-utils'
3import { About, ServerConfig, HttpStatusCode } from '@shared/models' 3import { About, HttpStatusCode, ServerConfig } from '@shared/models'
4import { CustomConfig } from '../../models/server/custom-config.model' 4import { CustomConfig } from '../../models/server/custom-config.model'
5import { AbstractCommand, OverrideCommandOptions } from '../shared' 5import { AbstractCommand, OverrideCommandOptions } from '../shared'
6 6
diff --git a/shared/extra-utils/server/debug-command.ts b/shared/extra-utils/server/debug-command.ts
index 36704836d..3c5a785bb 100644
--- a/shared/extra-utils/server/debug-command.ts
+++ b/shared/extra-utils/server/debug-command.ts
@@ -1,5 +1,4 @@
1import { Debug, SendDebugCommand } from '@shared/models' 1import { Debug, HttpStatusCode, SendDebugCommand } from '@shared/models'
2import { HttpStatusCode } from '@shared/models'
3import { AbstractCommand, OverrideCommandOptions } from '../shared' 2import { AbstractCommand, OverrideCommandOptions } from '../shared'
4 3
5export class DebugCommand extends AbstractCommand { 4export class DebugCommand extends AbstractCommand {
diff --git a/shared/extra-utils/server/follows-command.ts b/shared/extra-utils/server/follows-command.ts
index 694f5ea24..dce674ac5 100644
--- a/shared/extra-utils/server/follows-command.ts
+++ b/shared/extra-utils/server/follows-command.ts
@@ -1,6 +1,5 @@
1import { pick } from 'lodash' 1import { pick } from 'lodash'
2import { ActivityPubActorType, ActorFollow, FollowState, ResultList } from '@shared/models' 2import { ActivityPubActorType, ActorFollow, FollowState, HttpStatusCode, ResultList } from '@shared/models'
3import { HttpStatusCode } from '@shared/models'
4import { AbstractCommand, OverrideCommandOptions } from '../shared' 3import { AbstractCommand, OverrideCommandOptions } from '../shared'
5import { PeerTubeServer } from './server' 4import { PeerTubeServer } from './server'
6 5
diff --git a/shared/extra-utils/server/plugins-command.ts b/shared/extra-utils/server/plugins-command.ts
index 59bc79b3d..b944475a2 100644
--- a/shared/extra-utils/server/plugins-command.ts
+++ b/shared/extra-utils/server/plugins-command.ts
@@ -3,8 +3,8 @@
3import { readJSON, writeJSON } from 'fs-extra' 3import { readJSON, writeJSON } from 'fs-extra'
4import { join } from 'path' 4import { join } from 'path'
5import { root } from '@server/helpers/core-utils' 5import { root } from '@server/helpers/core-utils'
6import { HttpStatusCode } from '@shared/models'
7import { 6import {
7 HttpStatusCode,
8 PeerTubePlugin, 8 PeerTubePlugin,
9 PeerTubePluginIndex, 9 PeerTubePluginIndex,
10 PeertubePluginIndexList, 10 PeertubePluginIndexList,
diff --git a/shared/extra-utils/server/redundancy-command.ts b/shared/extra-utils/server/redundancy-command.ts
index 137d7f01c..e7a8b3c29 100644
--- a/shared/extra-utils/server/redundancy-command.ts
+++ b/shared/extra-utils/server/redundancy-command.ts
@@ -1,5 +1,4 @@
1import { ResultList, VideoRedundanciesTarget, VideoRedundancy } from '@shared/models' 1import { HttpStatusCode, ResultList, VideoRedundanciesTarget, VideoRedundancy } from '@shared/models'
2import { HttpStatusCode } from '@shared/models'
3import { AbstractCommand, OverrideCommandOptions } from '../shared' 2import { AbstractCommand, OverrideCommandOptions } from '../shared'
4 3
5export class RedundancyCommand extends AbstractCommand { 4export class RedundancyCommand extends AbstractCommand {
diff --git a/shared/extra-utils/server/stats-command.ts b/shared/extra-utils/server/stats-command.ts
index 6db473588..64a452306 100644
--- a/shared/extra-utils/server/stats-command.ts
+++ b/shared/extra-utils/server/stats-command.ts
@@ -1,5 +1,4 @@
1import { ServerStats } from '@shared/models' 1import { HttpStatusCode, ServerStats } from '@shared/models'
2import { HttpStatusCode } from '@shared/models'
3import { AbstractCommand, OverrideCommandOptions } from '../shared' 2import { AbstractCommand, OverrideCommandOptions } from '../shared'
4 3
5export class StatsCommand extends AbstractCommand { 4export class StatsCommand extends AbstractCommand {
diff --git a/shared/extra-utils/users/accounts-command.ts b/shared/extra-utils/users/accounts-command.ts
index 08977e58b..2f586104e 100644
--- a/shared/extra-utils/users/accounts-command.ts
+++ b/shared/extra-utils/users/accounts-command.ts
@@ -1,5 +1,4 @@
1import { ResultList } from '@shared/models' 1import { HttpStatusCode, ResultList } from '@shared/models'
2import { HttpStatusCode } from '@shared/models'
3import { Account } from '../../models/actors' 2import { Account } from '../../models/actors'
4import { AccountVideoRate, VideoRateType } from '../../models/videos' 3import { AccountVideoRate, VideoRateType } from '../../models/videos'
5import { AbstractCommand, OverrideCommandOptions } from '../shared' 4import { AbstractCommand, OverrideCommandOptions } from '../shared'
diff --git a/shared/extra-utils/users/blocklist-command.ts b/shared/extra-utils/users/blocklist-command.ts
index a9431acf3..14491a1ae 100644
--- a/shared/extra-utils/users/blocklist-command.ts
+++ b/shared/extra-utils/users/blocklist-command.ts
@@ -1,7 +1,6 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2 2
3import { HttpStatusCode } from '@shared/models' 3import { AccountBlock, HttpStatusCode, ResultList, ServerBlock } from '@shared/models'
4import { AccountBlock, ResultList, ServerBlock } from '@shared/models'
5import { AbstractCommand, OverrideCommandOptions } from '../shared' 4import { AbstractCommand, OverrideCommandOptions } from '../shared'
6 5
7type ListBlocklistOptions = OverrideCommandOptions & { 6type ListBlocklistOptions = OverrideCommandOptions & {
diff --git a/shared/extra-utils/users/login-command.ts b/shared/extra-utils/users/login-command.ts
index b39577260..143f72a59 100644
--- a/shared/extra-utils/users/login-command.ts
+++ b/shared/extra-utils/users/login-command.ts
@@ -1,5 +1,4 @@
1import { HttpStatusCode } from '@shared/models' 1import { HttpStatusCode, PeerTubeProblemDocument } from '@shared/models'
2import { PeerTubeProblemDocument } from '@shared/models'
3import { unwrapBody } from '../requests' 2import { unwrapBody } from '../requests'
4import { AbstractCommand, OverrideCommandOptions } from '../shared' 3import { AbstractCommand, OverrideCommandOptions } from '../shared'
5 4
diff --git a/shared/extra-utils/users/notifications-command.ts b/shared/extra-utils/users/notifications-command.ts
index a51fcc3af..2d79a3747 100644
--- a/shared/extra-utils/users/notifications-command.ts
+++ b/shared/extra-utils/users/notifications-command.ts
@@ -1,5 +1,4 @@
1import { ResultList } from '@shared/models' 1import { HttpStatusCode, ResultList } from '@shared/models'
2import { HttpStatusCode } from '@shared/models'
3import { UserNotification, UserNotificationSetting } from '../../models/users' 2import { UserNotification, UserNotificationSetting } from '../../models/users'
4import { AbstractCommand, OverrideCommandOptions } from '../shared' 3import { AbstractCommand, OverrideCommandOptions } from '../shared'
5 4
diff --git a/shared/extra-utils/users/subscriptions-command.ts b/shared/extra-utils/users/subscriptions-command.ts
index a69d2a194..edc60e612 100644
--- a/shared/extra-utils/users/subscriptions-command.ts
+++ b/shared/extra-utils/users/subscriptions-command.ts
@@ -1,5 +1,4 @@
1import { ResultList, Video, VideoChannel } from '@shared/models' 1import { HttpStatusCode, ResultList, Video, VideoChannel } from '@shared/models'
2import { HttpStatusCode } from '@shared/models'
3import { AbstractCommand, OverrideCommandOptions } from '../shared' 2import { AbstractCommand, OverrideCommandOptions } from '../shared'
4 3
5export class SubscriptionsCommand extends AbstractCommand { 4export class SubscriptionsCommand extends AbstractCommand {
diff --git a/shared/extra-utils/users/users-command.ts b/shared/extra-utils/users/users-command.ts
index f3a251e65..d66ad15f2 100644
--- a/shared/extra-utils/users/users-command.ts
+++ b/shared/extra-utils/users/users-command.ts
@@ -1,6 +1,6 @@
1import { omit, pick } from 'lodash' 1import { omit, pick } from 'lodash'
2import { HttpStatusCode } from '@shared/models'
3import { 2import {
3 HttpStatusCode,
4 MyUser, 4 MyUser,
5 ResultList, 5 ResultList,
6 User, 6 User,
diff --git a/shared/extra-utils/videos/blacklist-command.ts b/shared/extra-utils/videos/blacklist-command.ts
index 9404d4c08..3a2ef89ba 100644
--- a/shared/extra-utils/videos/blacklist-command.ts
+++ b/shared/extra-utils/videos/blacklist-command.ts
@@ -1,6 +1,5 @@
1 1
2import { ResultList } from '@shared/models' 2import { HttpStatusCode, ResultList } from '@shared/models'
3import { HttpStatusCode } from '@shared/models'
4import { VideoBlacklist, VideoBlacklistType } from '../../models/videos' 3import { VideoBlacklist, VideoBlacklistType } from '../../models/videos'
5import { AbstractCommand, OverrideCommandOptions } from '../shared' 4import { AbstractCommand, OverrideCommandOptions } from '../shared'
6 5
diff --git a/shared/extra-utils/videos/captions-command.ts b/shared/extra-utils/videos/captions-command.ts
index 04dd32f84..a0608e1a6 100644
--- a/shared/extra-utils/videos/captions-command.ts
+++ b/shared/extra-utils/videos/captions-command.ts
@@ -1,5 +1,4 @@
1import { HttpStatusCode } from '@shared/models' 1import { HttpStatusCode, ResultList, VideoCaption } from '@shared/models'
2import { ResultList, VideoCaption } from '@shared/models'
3import { buildAbsoluteFixturePath } from '../miscs' 2import { buildAbsoluteFixturePath } from '../miscs'
4import { AbstractCommand, OverrideCommandOptions } from '../shared' 3import { AbstractCommand, OverrideCommandOptions } from '../shared'
5 4
diff --git a/shared/extra-utils/videos/change-ownership-command.ts b/shared/extra-utils/videos/change-ownership-command.ts
index ef6f07536..ad4c726ef 100644
--- a/shared/extra-utils/videos/change-ownership-command.ts
+++ b/shared/extra-utils/videos/change-ownership-command.ts
@@ -1,6 +1,5 @@
1 1
2import { ResultList, VideoChangeOwnership } from '@shared/models' 2import { HttpStatusCode, ResultList, VideoChangeOwnership } from '@shared/models'
3import { HttpStatusCode } from '@shared/models'
4import { AbstractCommand, OverrideCommandOptions } from '../shared' 3import { AbstractCommand, OverrideCommandOptions } from '../shared'
5 4
6export class ChangeOwnershipCommand extends AbstractCommand { 5export class ChangeOwnershipCommand extends AbstractCommand {
diff --git a/shared/extra-utils/videos/channels-command.ts b/shared/extra-utils/videos/channels-command.ts
index e5393ff56..f8eb3f885 100644
--- a/shared/extra-utils/videos/channels-command.ts
+++ b/shared/extra-utils/videos/channels-command.ts
@@ -1,6 +1,5 @@
1import { pick } from 'lodash' 1import { pick } from 'lodash'
2import { ResultList, VideoChannel, VideoChannelCreateResult } from '@shared/models' 2import { HttpStatusCode, ResultList, VideoChannel, VideoChannelCreateResult } from '@shared/models'
3import { HttpStatusCode } from '@shared/models'
4import { VideoChannelCreate } from '../../models/videos/channel/video-channel-create.model' 3import { VideoChannelCreate } from '../../models/videos/channel/video-channel-create.model'
5import { VideoChannelUpdate } from '../../models/videos/channel/video-channel-update.model' 4import { VideoChannelUpdate } from '../../models/videos/channel/video-channel-update.model'
6import { unwrapBody } from '../requests' 5import { unwrapBody } from '../requests'
diff --git a/shared/extra-utils/videos/comments-command.ts b/shared/extra-utils/videos/comments-command.ts
index 7368f3ea2..dd14e4b64 100644
--- a/shared/extra-utils/videos/comments-command.ts
+++ b/shared/extra-utils/videos/comments-command.ts
@@ -1,6 +1,5 @@
1import { pick } from 'lodash' 1import { pick } from 'lodash'
2import { HttpStatusCode } from '@shared/models' 2import { HttpStatusCode, ResultList, VideoComment, VideoCommentThreads, VideoCommentThreadTree } from '@shared/models'
3import { ResultList, VideoComment, VideoCommentThreads, VideoCommentThreadTree } from '@shared/models'
4import { unwrapBody } from '../requests' 3import { unwrapBody } from '../requests'
5import { AbstractCommand, OverrideCommandOptions } from '../shared' 4import { AbstractCommand, OverrideCommandOptions } from '../shared'
6 5
diff --git a/shared/extra-utils/videos/history-command.ts b/shared/extra-utils/videos/history-command.ts
index 41afc6bc6..13b7150c1 100644
--- a/shared/extra-utils/videos/history-command.ts
+++ b/shared/extra-utils/videos/history-command.ts
@@ -1,5 +1,4 @@
1import { HttpStatusCode } from '@shared/models' 1import { HttpStatusCode, ResultList, Video } from '@shared/models'
2import { ResultList, Video } from '@shared/models'
3import { AbstractCommand, OverrideCommandOptions } from '../shared' 2import { AbstractCommand, OverrideCommandOptions } from '../shared'
4 3
5export class HistoryCommand extends AbstractCommand { 4export class HistoryCommand extends AbstractCommand {
diff --git a/shared/extra-utils/videos/imports-command.ts b/shared/extra-utils/videos/imports-command.ts
index d30f9745b..e4944694d 100644
--- a/shared/extra-utils/videos/imports-command.ts
+++ b/shared/extra-utils/videos/imports-command.ts
@@ -1,6 +1,5 @@
1 1
2import { HttpStatusCode } from '@shared/models' 2import { HttpStatusCode, ResultList } from '@shared/models'
3import { ResultList } from '@shared/models'
4import { VideoImport, VideoImportCreate } from '../../models/videos' 3import { VideoImport, VideoImportCreate } from '../../models/videos'
5import { unwrapBody } from '../requests' 4import { unwrapBody } from '../requests'
6import { AbstractCommand, OverrideCommandOptions } from '../shared' 5import { AbstractCommand, OverrideCommandOptions } from '../shared'
diff --git a/shared/extra-utils/videos/live-command.ts b/shared/extra-utils/videos/live-command.ts
index 9dfe3087e..bf9486a05 100644
--- a/shared/extra-utils/videos/live-command.ts
+++ b/shared/extra-utils/videos/live-command.ts
@@ -3,8 +3,7 @@
3import { readdir } from 'fs-extra' 3import { readdir } from 'fs-extra'
4import { omit } from 'lodash' 4import { omit } from 'lodash'
5import { join } from 'path' 5import { join } from 'path'
6import { HttpStatusCode } from '@shared/models' 6import { HttpStatusCode, LiveVideo, LiveVideoCreate, LiveVideoUpdate, VideoCreateResult, VideoDetails, VideoState } from '@shared/models'
7import { LiveVideo, LiveVideoCreate, LiveVideoUpdate, VideoCreateResult, VideoDetails, VideoState } from '@shared/models'
8import { wait } from '../miscs' 7import { wait } from '../miscs'
9import { unwrapBody } from '../requests' 8import { unwrapBody } from '../requests'
10import { AbstractCommand, OverrideCommandOptions } from '../shared' 9import { AbstractCommand, OverrideCommandOptions } from '../shared'
diff --git a/shared/extra-utils/videos/playlists-command.ts b/shared/extra-utils/videos/playlists-command.ts
index 40162c30d..6f329800e 100644
--- a/shared/extra-utils/videos/playlists-command.ts
+++ b/shared/extra-utils/videos/playlists-command.ts
@@ -1,7 +1,7 @@
1import { omit, pick } from 'lodash' 1import { omit, pick } from 'lodash'
2import { HttpStatusCode } from '@shared/models'
3import { 2import {
4 BooleanBothQuery, 3 BooleanBothQuery,
4 HttpStatusCode,
5 ResultList, 5 ResultList,
6 VideoExistInPlaylist, 6 VideoExistInPlaylist,
7 VideoPlaylist, 7 VideoPlaylist,
diff --git a/shared/extra-utils/videos/streaming-playlists.ts b/shared/extra-utils/videos/streaming-playlists.ts
index 007d3d98d..1ae3fefc1 100644
--- a/shared/extra-utils/videos/streaming-playlists.ts
+++ b/shared/extra-utils/videos/streaming-playlists.ts
@@ -1,7 +1,6 @@
1import { expect } from 'chai' 1import { expect } from 'chai'
2import { sha256 } from '@server/helpers/core-utils' 2import { sha256 } from '@server/helpers/core-utils'
3import { HttpStatusCode } from '@shared/models' 3import { HttpStatusCode, VideoStreamingPlaylist } from '@shared/models'
4import { VideoStreamingPlaylist } from '@shared/models'
5import { PeerTubeServer } from '../server' 4import { PeerTubeServer } from '../server'
6 5
7async function checkSegmentHash (options: { 6async function checkSegmentHash (options: {
diff --git a/shared/extra-utils/videos/videos-command.ts b/shared/extra-utils/videos/videos-command.ts
index f46d386f4..40cc4dc28 100644
--- a/shared/extra-utils/videos/videos-command.ts
+++ b/shared/extra-utils/videos/videos-command.ts
@@ -7,8 +7,8 @@ import { omit, pick } from 'lodash'
7import validator from 'validator' 7import validator from 'validator'
8import { buildUUID } from '@server/helpers/uuid' 8import { buildUUID } from '@server/helpers/uuid'
9import { loadLanguages } from '@server/initializers/constants' 9import { loadLanguages } from '@server/initializers/constants'
10import { HttpStatusCode } from '@shared/models'
11import { 10import {
11 HttpStatusCode,
12 ResultList, 12 ResultList,
13 UserVideoRateType, 13 UserVideoRateType,
14 Video, 14 Video,
@@ -332,7 +332,7 @@ export class VideosCommand extends AbstractCommand {
332 attributes?: VideoEdit 332 attributes?: VideoEdit
333 mode?: 'legacy' | 'resumable' // default legacy 333 mode?: 'legacy' | 'resumable' // default legacy
334 } = {}) { 334 } = {}) {
335 const { mode = 'legacy', expectedStatus } = options 335 const { mode = 'legacy' } = options
336 let defaultChannelId = 1 336 let defaultChannelId = 1
337 337
338 try { 338 try {
@@ -360,22 +360,23 @@ export class VideosCommand extends AbstractCommand {
360 ...options.attributes 360 ...options.attributes
361 } 361 }
362 362
363 const res = mode === 'legacy' 363 const created = mode === 'legacy'
364 ? await this.buildLegacyUpload({ ...options, attributes }) 364 ? await this.buildLegacyUpload({ ...options, attributes })
365 : await this.buildResumeUpload({ ...options, attributes }) 365 : await this.buildResumeUpload({ ...options, attributes })
366 366
367 // Wait torrent generation 367 // Wait torrent generation
368 const expectedStatus = this.buildExpectedStatus({ ...options, defaultExpectedStatus: HttpStatusCode.OK_200 })
368 if (expectedStatus === HttpStatusCode.OK_200) { 369 if (expectedStatus === HttpStatusCode.OK_200) {
369 let video: VideoDetails 370 let video: VideoDetails
370 371
371 do { 372 do {
372 video = await this.getWithToken({ ...options, id: video.uuid }) 373 video = await this.getWithToken({ ...options, id: created.uuid })
373 374
374 await wait(50) 375 await wait(50)
375 } while (!video.files[0].torrentUrl) 376 } while (!video.files[0].torrentUrl)
376 } 377 }
377 378
378 return res 379 return created
379 } 380 }
380 381
381 async buildLegacyUpload (options: OverrideCommandOptions & { 382 async buildLegacyUpload (options: OverrideCommandOptions & {
@@ -535,13 +536,13 @@ export class VideosCommand extends AbstractCommand {
535 536
536 async randomUpload (options: OverrideCommandOptions & { 537 async randomUpload (options: OverrideCommandOptions & {
537 wait?: boolean // default true 538 wait?: boolean // default true
538 additionalParams?: VideoEdit & { prefixName: string } 539 additionalParams?: VideoEdit & { prefixName?: string }
539 } = {}) { 540 } = {}) {
540 const { wait = true, additionalParams } = options 541 const { wait = true, additionalParams } = options
541 const prefixName = additionalParams?.prefixName || '' 542 const prefixName = additionalParams?.prefixName || ''
542 const name = prefixName + buildUUID() 543 const name = prefixName + buildUUID()
543 544
544 const attributes = { name, additionalParams } 545 const attributes = { name, ...additionalParams }
545 546
546 const result = await this.upload({ ...options, attributes }) 547 const result = await this.upload({ ...options, attributes })
547 548
diff --git a/shared/extra-utils/videos/videos.ts b/shared/extra-utils/videos/videos.ts
index a96073c56..9a9bfb3cf 100644
--- a/shared/extra-utils/videos/videos.ts
+++ b/shared/extra-utils/videos/videos.ts
@@ -202,7 +202,7 @@ async function uploadRandomVideoOnServers (
202 additionalParams?: VideoEdit & { prefixName?: string } 202 additionalParams?: VideoEdit & { prefixName?: string }
203) { 203) {
204 const server = servers.find(s => s.serverNumber === serverNumber) 204 const server = servers.find(s => s.serverNumber === serverNumber)
205 const res = await server.videos.randomUpload({ wait: false, ...additionalParams }) 205 const res = await server.videos.randomUpload({ wait: false, additionalParams })
206 206
207 await waitJobs(servers) 207 await waitJobs(servers)
208 208