diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-16 14:27:30 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-20 15:27:19 +0200 |
commit | 4c7e60bc17ee5830399bac4aa273356903421b4c (patch) | |
tree | 9e67397cf49b229b5bc0f9747f1a7e387bba558a /shared | |
parent | c0e8b12e7fd554ba4d2ceb0c4900804c6a4c63ea (diff) | |
download | PeerTube-4c7e60bc17ee5830399bac4aa273356903421b4c.tar.gz PeerTube-4c7e60bc17ee5830399bac4aa273356903421b4c.tar.zst PeerTube-4c7e60bc17ee5830399bac4aa273356903421b4c.zip |
Reorganize imports
Diffstat (limited to 'shared')
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 @@ | |||
1 | import { CustomPage } from '@shared/models' | 1 | import { CustomPage, HttpStatusCode } from '@shared/models' |
2 | import { HttpStatusCode } from '@shared/models' | ||
3 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 2 | import { AbstractCommand, OverrideCommandOptions } from '../shared' |
4 | 3 | ||
5 | export class CustomPagesCommand extends AbstractCommand { | 4 | export 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 @@ | |||
1 | import * as ffmpeg from 'fluent-ffmpeg' | ||
1 | import { ensureDir, pathExists } from 'fs-extra' | 2 | import { ensureDir, pathExists } from 'fs-extra' |
2 | import { dirname } from 'path' | 3 | import { dirname } from 'path' |
3 | import { buildAbsoluteFixturePath } from './tests' | 4 | import { buildAbsoluteFixturePath } from './tests' |
4 | import * as ffmpeg from 'fluent-ffmpeg' | ||
5 | 5 | ||
6 | async function generateHighBitrateVideo () { | 6 | async 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' |
13 | import { HttpStatusCode } from '@shared/models' | ||
14 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | ||
15 | import { unwrapBody } from '../requests/requests' | 14 | import { unwrapBody } from '../requests/requests' |
15 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | ||
16 | 16 | ||
17 | export class AbusesCommand extends AbstractCommand { | 17 | export 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 @@ | |||
1 | import { HttpStatusCode } from '@shared/models' | 1 | import { HttpStatusCode, VideosOverview } from '@shared/models' |
2 | import { VideosOverview } from '@shared/models' | ||
3 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 2 | import { AbstractCommand, OverrideCommandOptions } from '../shared' |
4 | 3 | ||
5 | export class OverviewsCommand extends AbstractCommand { | 4 | export 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 @@ | |||
1 | import { activityPubContextify } from '../../../server/helpers/activitypub' | ||
1 | import { doRequest } from '../../../server/helpers/requests' | 2 | import { doRequest } from '../../../server/helpers/requests' |
2 | import { HTTP_SIGNATURE } from '../../../server/initializers/constants' | 3 | import { HTTP_SIGNATURE } from '../../../server/initializers/constants' |
3 | import { buildGlobalHeaders } from '../../../server/lib/job-queue/handlers/utils/activitypub-http-utils' | 4 | import { buildGlobalHeaders } from '../../../server/lib/job-queue/handlers/utils/activitypub-http-utils' |
4 | import { activityPubContextify } from '../../../server/helpers/activitypub' | ||
5 | 5 | ||
6 | function makePOSTAPRequest (url: string, body: any, httpSignature: any, headers: any) { | 6 | function 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 @@ | |||
1 | import { | 1 | import { |
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' |
10 | import { HttpStatusCode } from '@shared/models' | ||
11 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 11 | import { AbstractCommand, OverrideCommandOptions } from '../shared' |
12 | 12 | ||
13 | export class SearchCommand extends AbstractCommand { | 13 | export 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 @@ | |||
1 | import { merge } from 'lodash' | 1 | import { merge } from 'lodash' |
2 | import { DeepPartial } from '@shared/core-utils' | 2 | import { DeepPartial } from '@shared/core-utils' |
3 | import { About, ServerConfig, HttpStatusCode } from '@shared/models' | 3 | import { About, HttpStatusCode, ServerConfig } from '@shared/models' |
4 | import { CustomConfig } from '../../models/server/custom-config.model' | 4 | import { CustomConfig } from '../../models/server/custom-config.model' |
5 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 5 | import { 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 @@ | |||
1 | import { Debug, SendDebugCommand } from '@shared/models' | 1 | import { Debug, HttpStatusCode, SendDebugCommand } from '@shared/models' |
2 | import { HttpStatusCode } from '@shared/models' | ||
3 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 2 | import { AbstractCommand, OverrideCommandOptions } from '../shared' |
4 | 3 | ||
5 | export class DebugCommand extends AbstractCommand { | 4 | export 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 @@ | |||
1 | import { pick } from 'lodash' | 1 | import { pick } from 'lodash' |
2 | import { ActivityPubActorType, ActorFollow, FollowState, ResultList } from '@shared/models' | 2 | import { ActivityPubActorType, ActorFollow, FollowState, HttpStatusCode, ResultList } from '@shared/models' |
3 | import { HttpStatusCode } from '@shared/models' | ||
4 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 3 | import { AbstractCommand, OverrideCommandOptions } from '../shared' |
5 | import { PeerTubeServer } from './server' | 4 | import { 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 @@ | |||
3 | import { readJSON, writeJSON } from 'fs-extra' | 3 | import { readJSON, writeJSON } from 'fs-extra' |
4 | import { join } from 'path' | 4 | import { join } from 'path' |
5 | import { root } from '@server/helpers/core-utils' | 5 | import { root } from '@server/helpers/core-utils' |
6 | import { HttpStatusCode } from '@shared/models' | ||
7 | import { | 6 | import { |
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 @@ | |||
1 | import { ResultList, VideoRedundanciesTarget, VideoRedundancy } from '@shared/models' | 1 | import { HttpStatusCode, ResultList, VideoRedundanciesTarget, VideoRedundancy } from '@shared/models' |
2 | import { HttpStatusCode } from '@shared/models' | ||
3 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 2 | import { AbstractCommand, OverrideCommandOptions } from '../shared' |
4 | 3 | ||
5 | export class RedundancyCommand extends AbstractCommand { | 4 | export 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 @@ | |||
1 | import { ServerStats } from '@shared/models' | 1 | import { HttpStatusCode, ServerStats } from '@shared/models' |
2 | import { HttpStatusCode } from '@shared/models' | ||
3 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 2 | import { AbstractCommand, OverrideCommandOptions } from '../shared' |
4 | 3 | ||
5 | export class StatsCommand extends AbstractCommand { | 4 | export 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 @@ | |||
1 | import { ResultList } from '@shared/models' | 1 | import { HttpStatusCode, ResultList } from '@shared/models' |
2 | import { HttpStatusCode } from '@shared/models' | ||
3 | import { Account } from '../../models/actors' | 2 | import { Account } from '../../models/actors' |
4 | import { AccountVideoRate, VideoRateType } from '../../models/videos' | 3 | import { AccountVideoRate, VideoRateType } from '../../models/videos' |
5 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 4 | import { 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 | ||
3 | import { HttpStatusCode } from '@shared/models' | 3 | import { AccountBlock, HttpStatusCode, ResultList, ServerBlock } from '@shared/models' |
4 | import { AccountBlock, ResultList, ServerBlock } from '@shared/models' | ||
5 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 4 | import { AbstractCommand, OverrideCommandOptions } from '../shared' |
6 | 5 | ||
7 | type ListBlocklistOptions = OverrideCommandOptions & { | 6 | type 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 @@ | |||
1 | import { HttpStatusCode } from '@shared/models' | 1 | import { HttpStatusCode, PeerTubeProblemDocument } from '@shared/models' |
2 | import { PeerTubeProblemDocument } from '@shared/models' | ||
3 | import { unwrapBody } from '../requests' | 2 | import { unwrapBody } from '../requests' |
4 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 3 | import { 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 @@ | |||
1 | import { ResultList } from '@shared/models' | 1 | import { HttpStatusCode, ResultList } from '@shared/models' |
2 | import { HttpStatusCode } from '@shared/models' | ||
3 | import { UserNotification, UserNotificationSetting } from '../../models/users' | 2 | import { UserNotification, UserNotificationSetting } from '../../models/users' |
4 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 3 | import { 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 @@ | |||
1 | import { ResultList, Video, VideoChannel } from '@shared/models' | 1 | import { HttpStatusCode, ResultList, Video, VideoChannel } from '@shared/models' |
2 | import { HttpStatusCode } from '@shared/models' | ||
3 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 2 | import { AbstractCommand, OverrideCommandOptions } from '../shared' |
4 | 3 | ||
5 | export class SubscriptionsCommand extends AbstractCommand { | 4 | export 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 @@ | |||
1 | import { omit, pick } from 'lodash' | 1 | import { omit, pick } from 'lodash' |
2 | import { HttpStatusCode } from '@shared/models' | ||
3 | import { | 2 | import { |
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 | ||
2 | import { ResultList } from '@shared/models' | 2 | import { HttpStatusCode, ResultList } from '@shared/models' |
3 | import { HttpStatusCode } from '@shared/models' | ||
4 | import { VideoBlacklist, VideoBlacklistType } from '../../models/videos' | 3 | import { VideoBlacklist, VideoBlacklistType } from '../../models/videos' |
5 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 4 | import { 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 @@ | |||
1 | import { HttpStatusCode } from '@shared/models' | 1 | import { HttpStatusCode, ResultList, VideoCaption } from '@shared/models' |
2 | import { ResultList, VideoCaption } from '@shared/models' | ||
3 | import { buildAbsoluteFixturePath } from '../miscs' | 2 | import { buildAbsoluteFixturePath } from '../miscs' |
4 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 3 | import { 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 | ||
2 | import { ResultList, VideoChangeOwnership } from '@shared/models' | 2 | import { HttpStatusCode, ResultList, VideoChangeOwnership } from '@shared/models' |
3 | import { HttpStatusCode } from '@shared/models' | ||
4 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 3 | import { AbstractCommand, OverrideCommandOptions } from '../shared' |
5 | 4 | ||
6 | export class ChangeOwnershipCommand extends AbstractCommand { | 5 | export 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 @@ | |||
1 | import { pick } from 'lodash' | 1 | import { pick } from 'lodash' |
2 | import { ResultList, VideoChannel, VideoChannelCreateResult } from '@shared/models' | 2 | import { HttpStatusCode, ResultList, VideoChannel, VideoChannelCreateResult } from '@shared/models' |
3 | import { HttpStatusCode } from '@shared/models' | ||
4 | import { VideoChannelCreate } from '../../models/videos/channel/video-channel-create.model' | 3 | import { VideoChannelCreate } from '../../models/videos/channel/video-channel-create.model' |
5 | import { VideoChannelUpdate } from '../../models/videos/channel/video-channel-update.model' | 4 | import { VideoChannelUpdate } from '../../models/videos/channel/video-channel-update.model' |
6 | import { unwrapBody } from '../requests' | 5 | import { 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 @@ | |||
1 | import { pick } from 'lodash' | 1 | import { pick } from 'lodash' |
2 | import { HttpStatusCode } from '@shared/models' | 2 | import { HttpStatusCode, ResultList, VideoComment, VideoCommentThreads, VideoCommentThreadTree } from '@shared/models' |
3 | import { ResultList, VideoComment, VideoCommentThreads, VideoCommentThreadTree } from '@shared/models' | ||
4 | import { unwrapBody } from '../requests' | 3 | import { unwrapBody } from '../requests' |
5 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 4 | import { 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 @@ | |||
1 | import { HttpStatusCode } from '@shared/models' | 1 | import { HttpStatusCode, ResultList, Video } from '@shared/models' |
2 | import { ResultList, Video } from '@shared/models' | ||
3 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 2 | import { AbstractCommand, OverrideCommandOptions } from '../shared' |
4 | 3 | ||
5 | export class HistoryCommand extends AbstractCommand { | 4 | export 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 | ||
2 | import { HttpStatusCode } from '@shared/models' | 2 | import { HttpStatusCode, ResultList } from '@shared/models' |
3 | import { ResultList } from '@shared/models' | ||
4 | import { VideoImport, VideoImportCreate } from '../../models/videos' | 3 | import { VideoImport, VideoImportCreate } from '../../models/videos' |
5 | import { unwrapBody } from '../requests' | 4 | import { unwrapBody } from '../requests' |
6 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 5 | import { 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 @@ | |||
3 | import { readdir } from 'fs-extra' | 3 | import { readdir } from 'fs-extra' |
4 | import { omit } from 'lodash' | 4 | import { omit } from 'lodash' |
5 | import { join } from 'path' | 5 | import { join } from 'path' |
6 | import { HttpStatusCode } from '@shared/models' | 6 | import { HttpStatusCode, LiveVideo, LiveVideoCreate, LiveVideoUpdate, VideoCreateResult, VideoDetails, VideoState } from '@shared/models' |
7 | import { LiveVideo, LiveVideoCreate, LiveVideoUpdate, VideoCreateResult, VideoDetails, VideoState } from '@shared/models' | ||
8 | import { wait } from '../miscs' | 7 | import { wait } from '../miscs' |
9 | import { unwrapBody } from '../requests' | 8 | import { unwrapBody } from '../requests' |
10 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 9 | import { 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 @@ | |||
1 | import { omit, pick } from 'lodash' | 1 | import { omit, pick } from 'lodash' |
2 | import { HttpStatusCode } from '@shared/models' | ||
3 | import { | 2 | import { |
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 @@ | |||
1 | import { expect } from 'chai' | 1 | import { expect } from 'chai' |
2 | import { sha256 } from '@server/helpers/core-utils' | 2 | import { sha256 } from '@server/helpers/core-utils' |
3 | import { HttpStatusCode } from '@shared/models' | 3 | import { HttpStatusCode, VideoStreamingPlaylist } from '@shared/models' |
4 | import { VideoStreamingPlaylist } from '@shared/models' | ||
5 | import { PeerTubeServer } from '../server' | 4 | import { PeerTubeServer } from '../server' |
6 | 5 | ||
7 | async function checkSegmentHash (options: { | 6 | async 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' | |||
7 | import validator from 'validator' | 7 | import validator from 'validator' |
8 | import { buildUUID } from '@server/helpers/uuid' | 8 | import { buildUUID } from '@server/helpers/uuid' |
9 | import { loadLanguages } from '@server/initializers/constants' | 9 | import { loadLanguages } from '@server/initializers/constants' |
10 | import { HttpStatusCode } from '@shared/models' | ||
11 | import { | 10 | import { |
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 | ||