Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Reorganize imports

Chocobozzz4c7e60bc17ee
diff --git a/server/controllers/api/bulk.ts b/server/controllers/api/bulk.ts
index 10d83571de..62121ece5a 100644
--- a/server/controllers/api/bulk.ts
+++ b/server/controllers/api/bulk.ts
@@ -1,10 +1,10 @@
import * as express from 'express'
-import { asyncMiddleware, authenticate } from '../../middlewares'
+import { removeComment } from '@server/lib/video-comment'
import { bulkRemoveCommentsOfValidator } from '@server/middlewares/validators/bulk'
import { VideoCommentModel } from '@server/models/video/video-comment'
-import { removeComment } from '@server/lib/video-comment'
-import { BulkRemoveCommentsOfBody } from '@shared/models/bulk/bulk-remove-comments-of-body.model'
import { HttpStatusCode } from '@shared/models'
+import { BulkRemoveCommentsOfBody } from '@shared/models/bulk/bulk-remove-comments-of-body.model'
+import { asyncMiddleware, authenticate } from '../../middlewares'
const bulkRouter = express.Router()
diff --git a/server/controllers/api/config.ts b/server/controllers/api/config.ts
index 9bd8c21c5d..ee733a38c8 100644
--- a/server/controllers/api/config.ts
+++ b/server/controllers/api/config.ts
@@ -1,8 +1,8 @@
-import { ServerConfigManager } from '@server/lib/server-config-manager'
import * as express from 'express'
import { remove, writeJSON } from 'fs-extra'
import { snakeCase } from 'lodash'
import validator from 'validator'
+import { ServerConfigManager } from '@server/lib/server-config-manager'
import { UserRight } from '../../../shared'
import { About } from '../../../shared/models/server/about.model'
import { CustomConfig } from '../../../shared/models/server/custom-config.model'
diff --git a/server/controllers/api/custom-page.ts b/server/controllers/api/custom-page.ts
index cc1aa84272..68d8c2ea49 100644
--- a/server/controllers/api/custom-page.ts
+++ b/server/controllers/api/custom-page.ts
@@ -1,8 +1,7 @@
import * as express from 'express'
import { ServerConfigManager } from '@server/lib/server-config-manager'
import { ActorCustomPageModel } from '@server/models/account/actor-custom-page'
-import { HttpStatusCode } from '@shared/models'
-import { UserRight } from '@shared/models'
+import { HttpStatusCode, UserRight } from '@shared/models'
import { asyncMiddleware, authenticate, ensureUserHasRight } from '../../middlewares'
const customPageRouter = express.Router()
diff --git a/server/controllers/api/overviews.ts b/server/controllers/api/overviews.ts
index ad879aad6c..aaa341d54a 100644
--- a/server/controllers/api/overviews.ts
+++ b/server/controllers/api/overviews.ts
@@ -1,12 +1,12 @@
import * as express from 'express'
+import * as memoizee from 'memoizee'
+import { logger } from '@server/helpers/logger'
+import { CategoryOverview, ChannelOverview, TagOverview, VideosOverview } from '../../../shared/models/overviews'
import { buildNSFWFilter } from '../../helpers/express-utils'
-import { VideoModel } from '../../models/video/video'
+import { MEMOIZE_TTL, OVERVIEWS } from '../../initializers/constants'
import { asyncMiddleware, optionalAuthenticate, videosOverviewValidator } from '../../middlewares'
import { TagModel } from '../../models/video/tag'
-import { CategoryOverview, ChannelOverview, TagOverview, VideosOverview } from '../../../shared/models/overviews'
-import { MEMOIZE_TTL, OVERVIEWS } from '../../initializers/constants'
-import * as memoizee from 'memoizee'
-import { logger } from '@server/helpers/logger'
+import { VideoModel } from '../../models/video/video'
const overviewsRouter = express.Router()
diff --git a/server/controllers/api/plugins.ts b/server/controllers/api/plugins.ts
index 4b213c2461..3a9ef34e8a 100644
--- a/server/controllers/api/plugins.ts
+++ b/server/controllers/api/plugins.ts
@@ -23,8 +23,8 @@ import {
updatePluginSettingsValidator
} from '@server/middlewares/validators/plugins'
import { PluginModel } from '@server/models/server/plugin'
-import { HttpStatusCode } from '@shared/models'
import {
+ HttpStatusCode,
InstallOrUpdatePlugin,
ManagePlugin,
PeertubePluginIndexList,
diff --git a/server/controllers/api/search/search-video-channels.ts b/server/controllers/api/search/search-video-channels.ts
index fe9178e691..c8f0a0a0b3 100644
--- a/server/controllers/api/search/search-video-channels.ts
+++ b/server/controllers/api/search/search-video-channels.ts
@@ -6,8 +6,7 @@ import { WEBSERVER } from '@server/initializers/constants'
import { Hooks } from '@server/lib/plugins/hooks'
import { buildMutedForSearchIndex, isSearchIndexSearch, isURISearch } from '@server/lib/search'
import { getServerActor } from '@server/models/application/application'
-import { HttpStatusCode } from '@shared/models'
-import { ResultList, VideoChannel } from '@shared/models'
+import { HttpStatusCode, ResultList, VideoChannel } from '@shared/models'
import { VideoChannelsSearchQuery } from '../../../../shared/models/search'
import { isUserAbleToSearchRemoteURI } from '../../../helpers/express-utils'
import { logger } from '../../../helpers/logger'
diff --git a/server/controllers/api/search/search-video-playlists.ts b/server/controllers/api/search/search-video-playlists.ts
index a0e2c17476..f55b1fba37 100644
--- a/server/controllers/api/search/search-video-playlists.ts
+++ b/server/controllers/api/search/search-video-playlists.ts
@@ -5,14 +5,14 @@ import { logger } from '@server/helpers/logger'
import { doJSONRequest } from '@server/helpers/requests'
import { getFormattedObjects } from '@server/helpers/utils'
import { CONFIG } from '@server/initializers/config'
+import { WEBSERVER } from '@server/initializers/constants'
import { getOrCreateAPVideoPlaylist } from '@server/lib/activitypub/playlists/get'
import { Hooks } from '@server/lib/plugins/hooks'
import { buildMutedForSearchIndex, isSearchIndexSearch, isURISearch } from '@server/lib/search'
import { getServerActor } from '@server/models/application/application'
import { VideoPlaylistModel } from '@server/models/video/video-playlist'
import { MVideoPlaylistFullSummary } from '@server/types/models'
-import { HttpStatusCode } from '@shared/models'
-import { ResultList, VideoPlaylist, VideoPlaylistsSearchQuery } from '@shared/models'
+import { HttpStatusCode, ResultList, VideoPlaylist, VideoPlaylistsSearchQuery } from '@shared/models'
import {
asyncMiddleware,
openapiOperationDoc,
@@ -23,7 +23,6 @@ import {
videoPlaylistsListSearchValidator,
videoPlaylistsSearchSortValidator
} from '../../../middlewares'
-import { WEBSERVER } from '@server/initializers/constants'
const searchPlaylistsRouter = express.Router()
diff --git a/server/controllers/api/search/search-videos.ts b/server/controllers/api/search/search-videos.ts
index 0e6fd9c721..a4153f3f87 100644
--- a/server/controllers/api/search/search-videos.ts
+++ b/server/controllers/api/search/search-videos.ts
@@ -6,8 +6,7 @@ import { WEBSERVER } from '@server/initializers/constants'
import { getOrCreateAPVideo } from '@server/lib/activitypub/videos'
import { Hooks } from '@server/lib/plugins/hooks'
import { buildMutedForSearchIndex, isSearchIndexSearch, isURISearch } from '@server/lib/search'
-import { HttpStatusCode } from '@shared/models'
-import { ResultList, Video } from '@shared/models'
+import { HttpStatusCode, ResultList, Video } from '@shared/models'
import { VideosSearchQuery } from '../../../../shared/models/search'
import { buildNSFWFilter, isUserAbleToSearchRemoteURI } from '../../../helpers/express-utils'
import { logger } from '../../../helpers/logger'
diff --git a/server/controllers/api/server/contact.ts b/server/controllers/api/server/contact.ts
index ae36dd599a..b315e99cf2 100644
--- a/server/controllers/api/server/contact.ts
+++ b/server/controllers/api/server/contact.ts
@@ -1,9 +1,9 @@
import * as express from 'express'
-import { asyncMiddleware, contactAdministratorValidator } from '../../../middlewares'
-import { Redis } from '../../../lib/redis'
-import { Emailer } from '../../../lib/emailer'
-import { ContactForm } from '../../../../shared/models/server'
import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
+import { ContactForm } from '../../../../shared/models/server'
+import { Emailer } from '../../../lib/emailer'
+import { Redis } from '../../../lib/redis'
+import { asyncMiddleware, contactAdministratorValidator } from '../../../middlewares'
const contactRouter = express.Router()
diff --git a/server/controllers/api/server/index.ts b/server/controllers/api/server/index.ts
index 6b8793a196..32fefefc04 100644
--- a/server/controllers/api/server/index.ts
+++ b/server/controllers/api/server/index.ts
@@ -1,11 +1,11 @@
import * as express from 'express'
+import { contactRouter } from './contact'
+import { debugRouter } from './debug'
import { serverFollowsRouter } from './follows'
-import { statsRouter } from './stats'
+import { logsRouter } from './logs'
import { serverRedundancyRouter } from './redundancy'
import { serverBlocklistRouter } from './server-blocklist'
-import { contactRouter } from './contact'
-import { logsRouter } from './logs'
-import { debugRouter } from './debug'
+import { statsRouter } from './stats'
const serverRouter = express.Router()
diff --git a/server/controllers/api/server/logs.ts b/server/controllers/api/server/logs.ts
index 4b543d686e..f78607d359 100644
--- a/server/controllers/api/server/logs.ts
+++ b/server/controllers/api/server/logs.ts
@@ -1,14 +1,14 @@
import * as express from 'express'
-import { UserRight } from '../../../../shared/models/users'
-import { asyncMiddleware, authenticate, ensureUserHasRight } from '../../../middlewares'
-import { mtimeSortFilesDesc } from '../../../../shared/core-utils/logs/logs'
import { readdir, readFile } from 'fs-extra'
-import { AUDIT_LOG_FILENAME, MAX_LOGS_OUTPUT_CHARACTERS, LOG_FILENAME } from '../../../initializers/constants'
import { join } from 'path'
-import { getAuditLogsValidator, getLogsValidator } from '../../../middlewares/validators/logs'
+import { logger } from '@server/helpers/logger'
+import { mtimeSortFilesDesc } from '../../../../shared/core-utils/logs/logs'
import { LogLevel } from '../../../../shared/models/server/log-level.type'
+import { UserRight } from '../../../../shared/models/users'
import { CONFIG } from '../../../initializers/config'
-import { logger } from '@server/helpers/logger'
+import { AUDIT_LOG_FILENAME, LOG_FILENAME, MAX_LOGS_OUTPUT_CHARACTERS } from '../../../initializers/constants'
+import { asyncMiddleware, authenticate, ensureUserHasRight } from '../../../middlewares'
+import { getAuditLogsValidator, getLogsValidator } from '../../../middlewares/validators/logs'
const logsRouter = express.Router()
diff --git a/server/controllers/api/users/me.ts b/server/controllers/api/users/me.ts
index c9610c59f2..ac6faca9cd 100644
--- a/server/controllers/api/users/me.ts
+++ b/server/controllers/api/users/me.ts
@@ -2,6 +2,7 @@ import 'multer'
import * as express from 'express'
import { auditLoggerFactory, getAuditIdFromRes, UserAuditView } from '@server/helpers/audit-logger'
import { Hooks } from '@server/lib/plugins/hooks'
+import { AttributesOnly } from '@shared/core-utils'
import { ActorImageType, UserUpdateMe, UserVideoRate as FormattedUserVideoRate } from '../../../../shared'
import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
import { UserVideoQuota } from '../../../../shared/models/users/user-video-quota.model'
@@ -31,7 +32,6 @@ import { AccountVideoRateModel } from '../../../models/account/account-video-rat
import { UserModel } from '../../../models/user/user'
import { VideoModel } from '../../../models/video/video'
import { VideoImportModel } from '../../../models/video/video-import'
-import { AttributesOnly } from '@shared/core-utils'
const auditLogger = auditLoggerFactory('users')
diff --git a/server/controllers/api/users/my-blocklist.ts b/server/controllers/api/users/my-blocklist.ts
index fe11b6e779..24fff83e33 100644
--- a/server/controllers/api/users/my-blocklist.ts
+++ b/server/controllers/api/users/my-blocklist.ts
@@ -1,6 +1,10 @@
-import * as express from 'express'
import 'multer'
+import * as express from 'express'
+import { logger } from '@server/helpers/logger'
+import { UserNotificationModel } from '@server/models/user/user-notification'
+import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
import { getFormattedObjects } from '../../../helpers/utils'
+import { addAccountInBlocklist, addServerInBlocklist, removeAccountFromBlocklist, removeServerFromBlocklist } from '../../../lib/blocklist'
import {
asyncMiddleware,
asyncRetryTransactionMiddleware,
@@ -18,11 +22,7 @@ import {
unblockServerByAccountValidator
} from '../../../middlewares/validators'
import { AccountBlocklistModel } from '../../../models/account/account-blocklist'
-import { addAccountInBlocklist, addServerInBlocklist, removeAccountFromBlocklist, removeServerFromBlocklist } from '../../../lib/blocklist'
import { ServerBlocklistModel } from '../../../models/server/server-blocklist'
-import { UserNotificationModel } from '@server/models/user/user-notification'
-import { logger } from '@server/helpers/logger'
-import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
const myBlocklistRouter = express.Router()
diff --git a/server/controllers/api/users/my-history.ts b/server/controllers/api/users/my-history.ts
index 85e04925ea..a6e7231030 100644
--- a/server/controllers/api/users/my-history.ts
+++ b/server/controllers/api/users/my-history.ts
@@ -1,4 +1,7 @@
import * as express from 'express'
+import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
+import { getFormattedObjects } from '../../../helpers/utils'
+import { sequelizeTypescript } from '../../../initializers/database'
import {
asyncMiddleware,
asyncRetryTransactionMiddleware,
@@ -8,10 +11,7 @@ import {
userHistoryListValidator,
userHistoryRemoveValidator
} from '../../../middlewares'
-import { getFormattedObjects } from '../../../helpers/utils'
import { UserVideoHistoryModel } from '../../../models/user/user-video-history'
-import { sequelizeTypescript } from '../../../initializers/database'
-import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
const myVideosHistoryRouter = express.Router()
diff --git a/server/controllers/api/users/my-video-playlists.ts b/server/controllers/api/users/my-video-playlists.ts
index d0bd994632..76e741ba54 100644
--- a/server/controllers/api/users/my-video-playlists.ts
+++ b/server/controllers/api/users/my-video-playlists.ts
@@ -1,8 +1,8 @@
import * as express from 'express'
+import { VideosExistInPlaylists } from '../../../../shared/models/videos/playlist/video-exist-in-playlist.model'
import { asyncMiddleware, authenticate } from '../../../middlewares'
import { doVideosInPlaylistExistValidator } from '../../../middlewares/validators/videos/video-playlists'
import { VideoPlaylistModel } from '../../../models/video/video-playlist'
-import { VideosExistInPlaylists } from '../../../../shared/models/videos/playlist/video-exist-in-playlist.model'
const myVideoPlaylistsRouter = express.Router()
diff --git a/server/controllers/api/videos/blacklist.ts b/server/controllers/api/videos/blacklist.ts
index a7f5f53d85..6bc768471c 100644
--- a/server/controllers/api/videos/blacklist.ts
+++ b/server/controllers/api/videos/blacklist.ts
@@ -1,6 +1,7 @@
import * as express from 'express'
import { blacklistVideo, unblacklistVideo } from '@server/lib/video-blacklist'
import { UserRight, VideoBlacklistCreate } from '../../../../shared'
+import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
import { logger } from '../../../helpers/logger'
import { getFormattedObjects } from '../../../helpers/utils'
import { sequelizeTypescript } from '../../../initializers/database'
@@ -19,7 +20,6 @@ import {
videosBlacklistUpdateValidator
} from '../../../middlewares'
import { VideoBlacklistModel } from '../../../models/video/video-blacklist'
-import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
const blacklistRouter = express.Router()
diff --git a/server/controllers/api/videos/comment.ts b/server/controllers/api/videos/comment.ts
index 90b633bb51..cb696f652c 100644
--- a/server/controllers/api/videos/comment.ts
+++ b/server/controllers/api/videos/comment.ts
@@ -1,6 +1,6 @@
import * as express from 'express'
-import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
import { ResultList, ThreadsResultList, UserRight, VideoCommentCreate } from '../../../../shared/models'
+import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
import { VideoCommentThreads } from '../../../../shared/models/videos/comment/video-comment.model'
import { auditLoggerFactory, CommentAuditView, getAuditIdFromRes } from '../../../helpers/audit-logger'
import { getFormattedObjects } from '../../../helpers/utils'
diff --git a/server/controllers/api/videos/ownership.ts b/server/controllers/api/videos/ownership.ts
index e6c94a45ad..f48acbc681 100644
--- a/server/controllers/api/videos/ownership.ts
+++ b/server/controllers/api/videos/ownership.ts
@@ -1,6 +1,12 @@
import * as express from 'express'
+import { MVideoFullLight } from '@server/types/models'
+import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
+import { VideoChangeOwnershipStatus, VideoState } from '../../../../shared/models/videos'
import { logger } from '../../../helpers/logger'
+import { getFormattedObjects } from '../../../helpers/utils'
import { sequelizeTypescript } from '../../../initializers/database'
+import { sendUpdateVideo } from '../../../lib/activitypub/send'
+import { changeVideoChannelShare } from '../../../lib/activitypub/share'
import {
asyncMiddleware,
asyncRetryTransactionMiddleware,
@@ -11,15 +17,9 @@ import {
videosChangeOwnershipValidator,
videosTerminateChangeOwnershipValidator
} from '../../../middlewares'
+import { VideoModel } from '../../../models/video/video'
import { VideoChangeOwnershipModel } from '../../../models/video/video-change-ownership'
-import { VideoChangeOwnershipStatus, VideoState } from '../../../../shared/models/videos'
import { VideoChannelModel } from '../../../models/video/video-channel'
-import { getFormattedObjects } from '../../../helpers/utils'
-import { changeVideoChannelShare } from '../../../lib/activitypub/share'
-import { sendUpdateVideo } from '../../../lib/activitypub/send'
-import { VideoModel } from '../../../models/video/video'
-import { MVideoFullLight } from '@server/types/models'
-import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
const ownershipVideoRouter = express.Router()
diff --git a/server/controllers/api/videos/rate.ts b/server/controllers/api/videos/rate.ts
index 134c9e5caa..96f6cd886b 100644
--- a/server/controllers/api/videos/rate.ts
+++ b/server/controllers/api/videos/rate.ts
@@ -1,13 +1,13 @@
import * as express from 'express'
import { UserVideoRateUpdate } from '../../../../shared'
+import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
import { logger } from '../../../helpers/logger'
import { VIDEO_RATE_TYPES } from '../../../initializers/constants'
+import { sequelizeTypescript } from '../../../initializers/database'
import { getLocalRateUrl, sendVideoRateChange } from '../../../lib/activitypub/video-rates'
import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate, videoUpdateRateValidator } from '../../../middlewares'
import { AccountModel } from '../../../models/account/account'
import { AccountVideoRateModel } from '../../../models/account/account-video-rate'
-import { sequelizeTypescript } from '../../../initializers/database'
-import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
const rateVideoRouter = express.Router()
diff --git a/server/controllers/api/videos/watching.ts b/server/controllers/api/videos/watching.ts
index 2899dbd9ca..05c75e543c 100644
--- a/server/controllers/api/videos/watching.ts
+++ b/server/controllers/api/videos/watching.ts
@@ -1,5 +1,6 @@
import * as express from 'express'
import { UserWatchingVideo } from '../../../../shared'
+import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
import {
asyncMiddleware,
asyncRetryTransactionMiddleware,
@@ -8,7 +9,6 @@ import {
videoWatchingValidator
} from '../../../middlewares'
import { UserVideoHistoryModel } from '../../../models/user/user-video-history'
-import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
const watchingRouter = express.Router()
diff --git a/server/controllers/download.ts b/server/controllers/download.ts
index 13bc669002..ddacc1b68a 100644
--- a/server/controllers/download.ts
+++ b/server/controllers/download.ts
@@ -5,8 +5,7 @@ import { VideosTorrentCache } from '@server/lib/files-cache/videos-torrent-cache
import { Hooks } from '@server/lib/plugins/hooks'
import { getVideoFilePath } from '@server/lib/video-paths'
import { MStreamingPlaylist, MVideo, MVideoFile, MVideoFullLight } from '@server/types/models'
-import { HttpStatusCode } from '@shared/models'
-import { VideoStreamingPlaylistType } from '@shared/models'
+import { HttpStatusCode, VideoStreamingPlaylistType } from '@shared/models'
import { STATIC_DOWNLOAD_PATHS } from '../initializers/constants'
import { asyncMiddleware, videosDownloadValidator } from '../middlewares'
diff --git a/server/middlewares/cache.ts b/server/middlewares/cache.ts
index 1ced060424..e508b22a6d 100644
--- a/server/middlewares/cache.ts
+++ b/server/middlewares/cache.ts
@@ -1,6 +1,6 @@
-import { Redis } from '../lib/redis'
import * as apicache from 'apicache'
import { HttpStatusCode } from '../../shared/models/http/http-error-codes'
+import { Redis } from '../lib/redis'
// Ensure Redis is initialized
Redis.Instance.init()
diff --git a/server/middlewares/servers.ts b/server/middlewares/servers.ts
index 49a2241b32..cf70d901e3 100644
--- a/server/middlewares/servers.ts
+++ b/server/middlewares/servers.ts
@@ -1,6 +1,6 @@
import * as express from 'express'
-import { getHostWithPort } from '../helpers/express-utils'
import { HttpStatusCode } from '../../shared/models/http/http-error-codes'
+import { getHostWithPort } from '../helpers/express-utils'
function setBodyHostsPort (req: express.Request, res: express.Response, next: express.NextFunction) {
if (!req.body.hosts) return next()
diff --git a/server/middlewares/user-right.ts b/server/middlewares/user-right.ts
index 87a1766cfa..c8c694f055 100644
--- a/server/middlewares/user-right.ts
+++ b/server/middlewares/user-right.ts
@@ -1,7 +1,7 @@
import * as express from 'express'
import { UserRight } from '../../shared'
-import { logger } from '../helpers/logger'
import { HttpStatusCode } from '../../shared/models/http/http-error-codes'
+import { logger } from '../helpers/logger'
function ensureUserHasRight (userRight: UserRight) {
return function (req: express.Request, res: express.Response, next: express.NextFunction) {
diff --git a/server/middlewares/validators/activitypub/activity.ts b/server/middlewares/validators/activitypub/activity.ts
index d65a8e4558..d24e4427b7 100644
--- a/server/middlewares/validators/activitypub/activity.ts
+++ b/server/middlewares/validators/activitypub/activity.ts
@@ -1,8 +1,8 @@
import * as express from 'express'
-import { isRootActivityValid } from '../../../helpers/custom-validators/activitypub/activity'
-import { logger } from '../../../helpers/logger'
import { getServerActor } from '@server/models/application/application'
import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
+import { isRootActivityValid } from '../../../helpers/custom-validators/activitypub/activity'
+import { logger } from '../../../helpers/logger'
async function activityPubValidator (req: express.Request, res: express.Response, next: express.NextFunction) {
logger.debug('Checking activity pub parameters')
diff --git a/server/middlewares/validators/bulk.ts b/server/middlewares/validators/bulk.ts
index 4057b1e012..6fec581493 100644
--- a/server/middlewares/validators/bulk.ts
+++ b/server/middlewares/validators/bulk.ts
@@ -1,8 +1,7 @@
import * as express from 'express'
import { body } from 'express-validator'
import { isBulkRemoveCommentsOfScopeValid } from '@server/helpers/custom-validators/bulk'
-import { HttpStatusCode } from '@shared/models'
-import { UserRight } from '@shared/models'
+import { HttpStatusCode, UserRight } from '@shared/models'
import { BulkRemoveCommentsOfBody } from '@shared/models/bulk/bulk-remove-comments-of-body.model'
import { logger } from '../../helpers/logger'
import { areValidationErrors, doesAccountNameWithHostExist } from './shared'
diff --git a/server/middlewares/validators/feeds.ts b/server/middlewares/validators/feeds.ts
index 1a5a8ffa0a..d29bebf647 100644
--- a/server/middlewares/validators/feeds.ts
+++ b/server/middlewares/validators/feeds.ts
@@ -1,6 +1,5 @@
import * as express from 'express'
import { param, query } from 'express-validator'
-
import { HttpStatusCode } from '../../../shared/models/http/http-error-codes'
import { isValidRSSFeed } from '../../helpers/custom-validators/feeds'
import { exists, isIdOrUUIDValid, isIdValid, toCompleteUUID } from '../../helpers/custom-validators/misc'
diff --git a/server/middlewares/validators/shared/videos.ts b/server/middlewares/validators/shared/videos.ts
index 7f42a4893b..71b81654f5 100644
--- a/server/middlewares/validators/shared/videos.ts
+++ b/server/middlewares/validators/shared/videos.ts
@@ -12,8 +12,7 @@ import {
MVideoImmutable,
MVideoThumbnail
} from '@server/types/models'
-import { HttpStatusCode } from '@shared/models'
-import { UserRight } from '@shared/models'
+import { HttpStatusCode, UserRight } from '@shared/models'
async function doesVideoExist (id: number | string, res: Response, fetchType: VideoLoadType = 'all') {
const userId = res.locals.oauth ? res.locals.oauth.token.User.id : undefined
diff --git a/server/middlewares/validators/videos/video-live.ts b/server/middlewares/validators/videos/video-live.ts
index 5c8a4269d6..97e8b4510a 100644
--- a/server/middlewares/validators/videos/video-live.ts
+++ b/server/middlewares/validators/videos/video-live.ts
@@ -5,8 +5,7 @@ import { isLocalLiveVideoAccepted } from '@server/lib/moderation'
import { Hooks } from '@server/lib/plugins/hooks'
import { VideoModel } from '@server/models/video/video'
import { VideoLiveModel } from '@server/models/video/video-live'
-import { HttpStatusCode } from '@shared/models'
-import { ServerErrorCode, UserRight, VideoState } from '@shared/models'
+import { HttpStatusCode, ServerErrorCode, UserRight, VideoState } from '@shared/models'
import { isBooleanValid, isIdValid, toBooleanOrNull, toIntOrNull } from '../../../helpers/custom-validators/misc'
import { isVideoNameValid } from '../../../helpers/custom-validators/videos'
import { cleanUpReqFiles } from '../../../helpers/express-utils'
diff --git a/server/middlewares/validators/videos/video-ownership-changes.ts b/server/middlewares/validators/videos/video-ownership-changes.ts
index 06f86a4c8b..a7f0b72c38 100644
--- a/server/middlewares/validators/videos/video-ownership-changes.ts
+++ b/server/middlewares/validators/videos/video-ownership-changes.ts
@@ -6,8 +6,14 @@ import { logger } from '@server/helpers/logger'
import { isAbleToUploadVideo } from '@server/lib/user'
import { AccountModel } from '@server/models/account/account'
import { MVideoWithAllFiles } from '@server/types/models'
-import { HttpStatusCode } from '@shared/models'
-import { ServerErrorCode, UserRight, VideoChangeOwnershipAccept, VideoChangeOwnershipStatus, VideoState } from '@shared/models'
+import {
+ HttpStatusCode,
+ ServerErrorCode,
+ UserRight,
+ VideoChangeOwnershipAccept,
+ VideoChangeOwnershipStatus,
+ VideoState
+} from '@shared/models'
import {
areValidationErrors,
checkUserCanManageVideo,
diff --git a/server/tests/api/activitypub/cleaner.ts b/server/tests/api/activitypub/cleaner.ts
index a5ce449f38..51cf6e599e 100644
--- a/server/tests/api/activitypub/cleaner.ts
+++ b/server/tests/api/activitypub/cleaner.ts
@@ -4,8 +4,8 @@ import 'mocha'
import * as chai from 'chai'
import {
cleanupTests,
- doubleFollow,
createMultipleServers,
+ doubleFollow,
PeerTubeServer,
setAccessTokensToServers,
wait,
diff --git a/server/tests/api/activitypub/client.ts b/server/tests/api/activitypub/client.ts
index 53cc406638..c3e4b7f74a 100644
--- a/server/tests/api/activitypub/client.ts
+++ b/server/tests/api/activitypub/client.ts
@@ -2,17 +2,16 @@
import 'mocha'
import * as chai from 'chai'
-import { HttpStatusCode } from '@shared/models'
import {
cleanupTests,
- doubleFollow,
createMultipleServers,
+ doubleFollow,
makeActivityPubGetRequest,
PeerTubeServer,
setAccessTokensToServers,
setDefaultVideoChannel
} from '@shared/extra-utils'
-import { VideoPlaylistPrivacy } from '@shared/models'
+import { HttpStatusCode, VideoPlaylistPrivacy } from '@shared/models'
const expect = chai.expect
diff --git a/server/tests/api/activitypub/fetch.ts b/server/tests/api/activitypub/fetch.ts
index ddfe6cfe0a..422a75d6e1 100644
--- a/server/tests/api/activitypub/fetch.ts
+++ b/server/tests/api/activitypub/fetch.ts
@@ -2,7 +2,7 @@
import 'mocha'
import * as chai from 'chai'
-import { cleanupTests, doubleFollow, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
+import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
const expect = chai.expect
diff --git a/server/tests/api/activitypub/refresher.ts b/server/tests/api/activitypub/refresher.ts
index a0b72c7e6d..81fee00447 100644
--- a/server/tests/api/activitypub/refresher.ts
+++ b/server/tests/api/activitypub/refresher.ts
@@ -1,11 +1,10 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha'
-import { HttpStatusCode } from '@shared/models'
import {
cleanupTests,
- doubleFollow,
createMultipleServers,
+ doubleFollow,
killallServers,
PeerTubeServer,
setAccessTokensToServers,
@@ -13,7 +12,7 @@ import {
wait,
waitJobs
} from '@shared/extra-utils'
-import { VideoPlaylistPrivacy } from '@shared/models'
+import { HttpStatusCode, VideoPlaylistPrivacy } from '@shared/models'
describe('Test AP refresher', function () {
let servers: PeerTubeServer[] = []
diff --git a/server/tests/api/check-params/abuses.ts b/server/tests/api/check-params/abuses.ts
index 87d93195cb..72f2cbd8fa 100644
--- a/server/tests/api/check-params/abuses.ts
+++ b/server/tests/api/check-params/abuses.ts
@@ -1,22 +1,21 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha'
-import { HttpStatusCode } from '@shared/models'
import {
AbusesCommand,
checkBadCountPagination,
checkBadSortPagination,
checkBadStartPagination,
cleanupTests,
- doubleFollow,
createSingleServer,
+ doubleFollow,
makeGetRequest,
makePostBodyRequest,
PeerTubeServer,
setAccessTokensToServers,
waitJobs
} from '@shared/extra-utils'
-import { AbuseCreate, AbuseState } from '@shared/models'
+import { AbuseCreate, AbuseState, HttpStatusCode } from '@shared/models'
describe('Test abuses API validators', function () {
const basePath = '/api/v1/abuses/'
diff --git a/server/tests/api/check-params/accounts.ts b/server/tests/api/check-params/accounts.ts
index 0cae485d92..141d869b76 100644
--- a/server/tests/api/check-params/accounts.ts
+++ b/server/tests/api/check-params/accounts.ts
@@ -1,7 +1,6 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha'
-import { HttpStatusCode } from '@shared/models'
import {
checkBadCountPagination,
checkBadSortPagination,
@@ -10,6 +9,7 @@ import {
createSingleServer,
PeerTubeServer
} from '@shared/extra-utils'
+import { HttpStatusCode } from '@shared/models'
describe('Test accounts API validators', function () {
const path = '/api/v1/accounts/'
diff --git a/server/tests/api/check-params/config.ts b/server/tests/api/check-params/config.ts
index c3438917ec..87cb2287e8 100644
--- a/server/tests/api/check-params/config.ts
+++ b/server/tests/api/check-params/config.ts
@@ -2,7 +2,6 @@
import 'mocha'
import { omit } from 'lodash'
-import { HttpStatusCode } from '@shared/models'
import {
cleanupTests,
createSingleServer,
@@ -12,7 +11,7 @@ import {
PeerTubeServer,
setAccessTokensToServers
} from '@shared/extra-utils'
-import { CustomConfig } from '@shared/models'
+import { CustomConfig, HttpStatusCode } from '@shared/models'
describe('Test config API validators', function () {
const path = '/api/v1/config/custom'
diff --git a/server/tests/api/check-params/contact-form.ts b/server/tests/api/check-params/contact-form.ts
index 8e755c69bf..1df9993da0 100644
--- a/server/tests/api/check-params/contact-form.ts
+++ b/server/tests/api/check-params/contact-form.ts
@@ -1,9 +1,9 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha'
-import { HttpStatusCode } from '@shared/models'
import { cleanupTests, createSingleServer, killallServers, MockSmtpServer, PeerTubeServer } from '@shared/extra-utils'
import { ContactFormCommand } from '@shared/extra-utils/server'
+import { HttpStatusCode } from '@shared/models'
describe('Test contact form API validators', function () {
let server: PeerTubeServer
diff --git a/server/tests/api/check-params/live.ts b/server/tests/api/check-params/live.ts
index 0ef86a5387..700b4724df 100644
--- a/server/tests/api/check-params/live.ts
+++ b/server/tests/api/check-params/live.ts
@@ -2,7 +2,6 @@
import 'mocha'
import { omit } from 'lodash'
-import { HttpStatusCode } from '@shared/models'
import {
buildAbsoluteFixturePath,
cleanupTests,
@@ -10,12 +9,12 @@ import {
LiveCommand,
makePostBodyRequest,
makeUploadRequest,
- sendRTMPStream,
PeerTubeServer,
+ sendRTMPStream,
setAccessTokensToServers,
stopFfmpeg
} from '@shared/extra-utils'
-import { VideoCreateResult, VideoPrivacy } from '@shared/models'
+import { HttpStatusCode, VideoCreateResult, VideoPrivacy } from '@shared/models'
describe('Test video lives API validator', function () {
const path = '/api/v1/videos/live'
diff --git a/server/tests/api/check-params/plugins.ts b/server/tests/api/check-params/plugins.ts
index d3dda7fce6..33f84ecbc4 100644
--- a/server/tests/api/check-params/plugins.ts
+++ b/server/tests/api/check-params/plugins.ts
@@ -1,7 +1,6 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha'
-import { HttpStatusCode } from '@shared/models'
import {
checkBadCountPagination,
checkBadSortPagination,
@@ -14,7 +13,7 @@ import {
PeerTubeServer,
setAccessTokensToServers
} from '@shared/extra-utils'
-import { PeerTubePlugin, PluginType } from '@shared/models'
+import { HttpStatusCode, PeerTubePlugin, PluginType } from '@shared/models'
describe('Test server plugins API validators', function () {
let server: PeerTubeServer
diff --git a/server/tests/api/check-params/search.ts b/server/tests/api/check-params/search.ts
index b49169e381..a3da54e1f3 100644
--- a/server/tests/api/check-params/search.ts
+++ b/server/tests/api/check-params/search.ts
@@ -1,7 +1,6 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha'
-import { HttpStatusCode } from '@shared/models'
import {
checkBadCountPagination,
checkBadSortPagination,
@@ -12,6 +11,7 @@ import {
PeerTubeServer,
setAccessTokensToServers
} from '@shared/extra-utils'
+import { HttpStatusCode } from '@shared/models'
function updateSearchIndex (server: PeerTubeServer, enabled: boolean, disableLocalSearch = false) {
return server.config.updateCustomSubConfig({
diff --git a/server/tests/api/check-params/services.ts b/server/tests/api/check-params/services.ts
index 973b255982..4c4a5cade8 100644
--- a/server/tests/api/check-params/services.ts
+++ b/server/tests/api/check-params/services.ts
@@ -1,7 +1,6 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha'
-import { HttpStatusCode } from '@shared/models'
import {
cleanupTests,
createSingleServer,
@@ -10,7 +9,7 @@ import {
setAccessTokensToServers,
setDefaultVideoChannel
} from '@shared/extra-utils'
-import { VideoPlaylistPrivacy } from '@shared/models'
+import { HttpStatusCode, VideoPlaylistPrivacy } from '@shared/models'
describe('Test services API validators', function () {
let server: PeerTubeServer
diff --git a/server/tests/api/check-params/user-notifications.ts b/server/tests/api/check-params/user-notifications.ts
index 3b709ee5a2..17edf5aa17 100644
--- a/server/tests/api/check-params/user-notifications.ts
+++ b/server/tests/api/check-params/user-notifications.ts
@@ -2,7 +2,6 @@
import 'mocha'
import { io } from 'socket.io-client'
-import { HttpStatusCode } from '@shared/models'
import {
checkBadCountPagination,
checkBadSortPagination,
@@ -16,7 +15,7 @@ import {
setAccessTokensToServers,
wait
} from '@shared/extra-utils'
-import { UserNotificationSetting, UserNotificationSettingValue } from '@shared/models'
+import { HttpStatusCode, UserNotificationSetting, UserNotificationSettingValue } from '@shared/models'
describe('Test user notifications API validators', function () {
let server: PeerTubeServer
diff --git a/server/tests/api/check-params/users.ts b/server/tests/api/check-params/users.ts
index 34fe309f9e..9d8f933db2 100644
--- a/server/tests/api/check-params/users.ts
+++ b/server/tests/api/check-params/users.ts
@@ -2,7 +2,6 @@
import 'mocha'
import { omit } from 'lodash'
-import { HttpStatusCode } from '@shared/models'
import {
buildAbsoluteFixturePath,
checkBadCountPagination,
@@ -20,7 +19,7 @@ import {
setAccessTokensToServers,
UsersCommand
} from '@shared/extra-utils'
-import { UserAdminFlag, UserRole, VideoCreateResult } from '@shared/models'
+import { HttpStatusCode, UserAdminFlag, UserRole, VideoCreateResult } from '@shared/models'
describe('Test users API validators', function () {
const path = '/api/v1/users/'
diff --git a/server/tests/api/check-params/video-blacklist.ts b/server/tests/api/check-params/video-blacklist.ts
index 2072df4b64..d28c6a9527 100644
--- a/server/tests/api/check-params/video-blacklist.ts
+++ b/server/tests/api/check-params/video-blacklist.ts
@@ -2,22 +2,21 @@
import 'mocha'
import { expect } from 'chai'
-import { HttpStatusCode } from '@shared/models'
import {
BlacklistCommand,
checkBadCountPagination,
checkBadSortPagination,
checkBadStartPagination,
cleanupTests,
- doubleFollow,
createMultipleServers,
+ doubleFollow,
makePostBodyRequest,
makePutBodyRequest,
PeerTubeServer,
setAccessTokensToServers,
waitJobs
} from '@shared/extra-utils'
-import { VideoBlacklistType } from '@shared/models'
+import { HttpStatusCode, VideoBlacklistType } from '@shared/models'
describe('Test video blacklist API validators', function () {
let servers: PeerTubeServer[]
diff --git a/server/tests/api/check-params/video-captions.ts b/server/tests/api/check-params/video-captions.ts
index 1b3d1aa951..5aaeb27fe9 100644
--- a/server/tests/api/check-params/video-captions.ts
+++ b/server/tests/api/check-params/video-captions.ts
@@ -1,7 +1,6 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha'
-import { HttpStatusCode } from '@shared/models'
import {
buildAbsoluteFixturePath,
cleanupTests,
@@ -12,7 +11,7 @@ import {
PeerTubeServer,
setAccessTokensToServers
} from '@shared/extra-utils'
-import { VideoCreateResult } from '@shared/models'
+import { HttpStatusCode, VideoCreateResult } from '@shared/models'
describe('Test video captions API validator', function () {
const path = '/api/v1/videos/'
diff --git a/server/tests/api/check-params/video-channels.ts b/server/tests/api/check-params/video-channels.ts
index bbe42e43df..2e63916d43 100644
--- a/server/tests/api/check-params/video-channels.ts
+++ b/server/tests/api/check-params/video-channels.ts
@@ -3,7 +3,6 @@
import 'mocha'
import * as chai from 'chai'
import { omit } from 'lodash'
-import { HttpStatusCode } from '@shared/models'
import {
buildAbsoluteFixturePath,
ChannelsCommand,
@@ -19,7 +18,7 @@ import {
PeerTubeServer,
setAccessTokensToServers
} from '@shared/extra-utils'
-import { VideoChannelUpdate } from '@shared/models'
+import { HttpStatusCode, VideoChannelUpdate } from '@shared/models'
const expect = chai.expect
diff --git a/server/tests/api/check-params/video-comments.ts b/server/tests/api/check-params/video-comments.ts
index bfd9e01723..2d9ee1e0d2 100644
--- a/server/tests/api/check-params/video-comments.ts
+++ b/server/tests/api/check-params/video-comments.ts
@@ -2,7 +2,6 @@
import 'mocha'
import * as chai from 'chai'
-import { HttpStatusCode } from '@shared/models'
import {
checkBadCountPagination,
checkBadSortPagination,
@@ -15,7 +14,7 @@ import {
PeerTubeServer,
setAccessTokensToServers
} from '@shared/extra-utils'
-import { VideoCreateResult } from '@shared/models'
+import { HttpStatusCode, VideoCreateResult } from '@shared/models'
const expect = chai.expect
diff --git a/server/tests/api/check-params/video-imports.ts b/server/tests/api/check-params/video-imports.ts
index 957556c9b6..d6d745488c 100644
--- a/server/tests/api/check-params/video-imports.ts
+++ b/server/tests/api/check-params/video-imports.ts
@@ -2,7 +2,6 @@
import 'mocha'
import { omit } from 'lodash'
-import { HttpStatusCode } from '@shared/models'
import {
buildAbsoluteFixturePath,
checkBadCountPagination,
@@ -17,7 +16,7 @@ import {
PeerTubeServer,
setAccessTokensToServers
} from '@shared/extra-utils'
-import { VideoPrivacy } from '@shared/models'
+import { HttpStatusCode, VideoPrivacy } from '@shared/models'
describe('Test video imports API validator', function () {
const path = '/api/v1/videos/imports'
diff --git a/server/tests/api/check-params/video-playlists.ts b/server/tests/api/check-params/video-playlists.ts
index 7dcb4935a3..e4d541b480 100644
--- a/server/tests/api/check-params/video-playlists.ts
+++ b/server/tests/api/check-params/video-playlists.ts
@@ -1,7 +1,6 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha'
-import { HttpStatusCode } from '@shared/models'
import {
checkBadCountPagination,
checkBadSortPagination,
@@ -9,12 +8,13 @@ import {
cleanupTests,
createSingleServer,
makeGetRequest,
- PlaylistsCommand,
PeerTubeServer,
+ PlaylistsCommand,
setAccessTokensToServers,
setDefaultVideoChannel
} from '@shared/extra-utils'
import {
+ HttpStatusCode,
VideoPlaylistCreate,
VideoPlaylistCreateResult,
VideoPlaylistElementCreate,
diff --git a/server/tests/api/check-params/videos-filter.ts b/server/tests/api/check-params/videos-filter.ts
index c2c69904f6..d08570bbea 100644
--- a/server/tests/api/check-params/videos-filter.ts
+++ b/server/tests/api/check-params/videos-filter.ts
@@ -1,7 +1,6 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha'
-import { HttpStatusCode } from '@shared/models'
import {
cleanupTests,
createSingleServer,
@@ -10,7 +9,7 @@ import {
setAccessTokensToServers,
setDefaultVideoChannel
} from '@shared/extra-utils'
-import { UserRole } from '@shared/models'
+import { HttpStatusCode, UserRole } from '@shared/models'
async function testEndpoints (server: PeerTubeServer, token: string, filter: string, expectedStatus: HttpStatusCode) {
const paths = [
diff --git a/server/tests/api/check-params/videos-history.ts b/server/tests/api/check-params/videos-history.ts
index 7283a4d285..c3c309ed28 100644
--- a/server/tests/api/check-params/videos-history.ts
+++ b/server/tests/api/check-params/videos-history.ts
@@ -1,7 +1,6 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha'
-import { HttpStatusCode } from '@shared/models'
import {
checkBadCountPagination,
checkBadStartPagination,
@@ -13,6 +12,7 @@ import {
PeerTubeServer,
setAccessTokensToServers
} from '@shared/extra-utils'
+import { HttpStatusCode } from '@shared/models'
describe('Test videos history API validator', function () {
const myHistoryPath = '/api/v1/users/me/history/videos'
diff --git a/server/tests/api/live/live-constraints.ts b/server/tests/api/live/live-constraints.ts
index a008335690..20346113df 100644
--- a/server/tests/api/live/live-constraints.ts
+++ b/server/tests/api/live/live-constraints.ts
@@ -7,8 +7,8 @@ import {
checkLiveCleanup,
cleanupTests,
ConfigCommand,
- doubleFollow,
createMultipleServers,
+ doubleFollow,
PeerTubeServer,
setAccessTokensToServers,
setDefaultVideoChannel,
diff --git a/server/tests/api/live/live-permanent.ts b/server/tests/api/live/live-permanent.ts
index 30d499e205..f07d4cfecc 100644
--- a/server/tests/api/live/live-permanent.ts
+++ b/server/tests/api/live/live-permanent.ts
@@ -6,8 +6,8 @@ import { LiveVideoCreate, VideoPrivacy, VideoState } from '@shared/models'
import {
cleanupTests,
ConfigCommand,
- doubleFollow,
createMultipleServers,
+ doubleFollow,
PeerTubeServer,
setAccessTokensToServers,
setDefaultVideoChannel,
diff --git a/server/tests/api/live/live-save-replay.ts b/server/tests/api/live/live-save-replay.ts
index 095c51b979..bd15396ec6 100644
--- a/server/tests/api/live/live-save-replay.ts
+++ b/server/tests/api/live/live-save-replay.ts
@@ -3,13 +3,12 @@
import 'mocha'
import * as chai from 'chai'
import { FfmpegCommand } from 'fluent-ffmpeg'
-import { HttpStatusCode } from '@shared/models'
import {
checkLiveCleanup,
cleanupTests,
ConfigCommand,
- doubleFollow,
createMultipleServers,
+ doubleFollow,
PeerTubeServer,
setAccessTokensToServers,
setDefaultVideoChannel,
@@ -18,7 +17,7 @@ import {
wait,
waitJobs
} from '@shared/extra-utils'
-import { LiveVideoCreate, VideoPrivacy, VideoState } from '@shared/models'
+import { HttpStatusCode, LiveVideoCreate, VideoPrivacy, VideoState } from '@shared/models'
const expect = chai.expect
diff --git a/server/tests/api/live/live-socket-messages.ts b/server/tests/api/live/live-socket-messages.ts
index 3808964d14..2a1f9f108b 100644
--- a/server/tests/api/live/live-socket-messages.ts
+++ b/server/tests/api/live/live-socket-messages.ts
@@ -5,8 +5,8 @@ import * as chai from 'chai'
import { VideoPrivacy, VideoState } from '@shared/models'
import {
cleanupTests,
- doubleFollow,
createMultipleServers,
+ doubleFollow,
PeerTubeServer,
setAccessTokensToServers,
setDefaultVideoChannel,
diff --git a/server/tests/api/live/live-views.ts b/server/tests/api/live/live-views.ts
index 4a137b1858..5e3a79c641 100644
--- a/server/tests/api/live/live-views.ts
+++ b/server/tests/api/live/live-views.ts
@@ -6,8 +6,8 @@ import { FfmpegCommand } from 'fluent-ffmpeg'
import { VideoPrivacy } from '@shared/models'
import {
cleanupTests,
- doubleFollow,
createMultipleServers,
+ doubleFollow,
PeerTubeServer,
setAccessTokensToServers,
setDefaultVideoChannel,
diff --git a/server/tests/api/live/live.ts b/server/tests/api/live/live.ts
index 88995910c4..4676a840a5 100644
--- a/server/tests/api/live/live.ts
+++ b/server/tests/api/live/live.ts
@@ -4,19 +4,18 @@ import 'mocha'
import * as chai from 'chai'
import { join } from 'path'
import { ffprobePromise, getVideoStreamFromFile } from '@server/helpers/ffprobe-utils'
-import { HttpStatusCode } from '@shared/models'
import {
checkLiveCleanup,
checkLiveSegmentHash,
checkResolutionsInMasterPlaylist,
cleanupTests,
- doubleFollow,
createMultipleServers,
+ doubleFollow,
killallServers,
LiveCommand,
makeRawRequest,
- sendRTMPStream,
PeerTubeServer,
+ sendRTMPStream,
setAccessTokensToServers,
setDefaultVideoChannel,
stopFfmpeg,
@@ -26,7 +25,15 @@ import {
waitJobs,
waitUntilLivePublishedOnAllServers
} from '@shared/extra-utils'
-import { LiveVideo, LiveVideoCreate, VideoDetails, VideoPrivacy, VideoState, VideoStreamingPlaylistType } from '@shared/models'
+import {
+ HttpStatusCode,
+ LiveVideo,
+ LiveVideoCreate,
+ VideoDetails,
+ VideoPrivacy,
+ VideoState,
+ VideoStreamingPlaylistType
+} from '@shared/models'
const expect = chai.expect
diff --git a/server/tests/api/moderation/blocklist-notification.ts b/server/tests/api/moderation/blocklist-notification.ts
index fdfbcbced3..75b15c2987 100644
--- a/server/tests/api/moderation/blocklist-notification.ts
+++ b/server/tests/api/moderation/blocklist-notification.ts
@@ -2,7 +2,7 @@
import 'mocha'
import * as chai from 'chai'
-import { cleanupTests, doubleFollow, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
+import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
import { UserNotificationType } from '@shared/models'
const expect = chai.expect
diff --git a/server/tests/api/moderation/blocklist.ts b/server/tests/api/moderation/blocklist.ts
index 593291e87a..8ed5ad9e58 100644
--- a/server/tests/api/moderation/blocklist.ts
+++ b/server/tests/api/moderation/blocklist.ts
@@ -6,8 +6,8 @@ import {
BlocklistCommand,
cleanupTests,
CommentsCommand,
- doubleFollow,
createMultipleServers,
+ doubleFollow,
PeerTubeServer,
setAccessTokensToServers,
waitJobs
diff --git a/server/tests/api/notifications/admin-notifications.ts b/server/tests/api/notifications/admin-notifications.ts
index d65551f0a2..b36ba11a9d 100644
--- a/server/tests/api/notifications/admin-notifications.ts
+++ b/server/tests/api/notifications/admin-notifications.ts
@@ -9,8 +9,8 @@ import {
cleanupTests,
MockJoinPeerTubeVersions,
MockSmtpServer,
- prepareNotificationsTest,
PeerTubeServer,
+ prepareNotificationsTest,
wait
} from '@shared/extra-utils'
import { PluginType, UserNotification, UserNotificationType } from '@shared/models'
diff --git a/server/tests/api/notifications/comments-notifications.ts b/server/tests/api/notifications/comments-notifications.ts
index d54819aaab..cbb46e510b 100644
--- a/server/tests/api/notifications/comments-notifications.ts
+++ b/server/tests/api/notifications/comments-notifications.ts
@@ -8,8 +8,8 @@ import {
checkNewCommentOnMyVideo,
cleanupTests,
MockSmtpServer,
- prepareNotificationsTest,
PeerTubeServer,
+ prepareNotificationsTest,
waitJobs
} from '@shared/extra-utils'
import { UserNotification } from '@shared/models'
diff --git a/server/tests/api/notifications/moderation-notifications.ts b/server/tests/api/notifications/moderation-notifications.ts
index 3a294192b3..6e8f8a2b4b 100644
--- a/server/tests/api/notifications/moderation-notifications.ts
+++ b/server/tests/api/notifications/moderation-notifications.ts
@@ -19,8 +19,8 @@ import {
cleanupTests,
MockInstancesIndex,
MockSmtpServer,
- prepareNotificationsTest,
PeerTubeServer,
+ prepareNotificationsTest,
wait,
waitJobs
} from '@shared/extra-utils'
diff --git a/server/tests/api/notifications/notifications-api.ts b/server/tests/api/notifications/notifications-api.ts
index 178b206876..fa4b53db6c 100644
--- a/server/tests/api/notifications/notifications-api.ts
+++ b/server/tests/api/notifications/notifications-api.ts
@@ -8,8 +8,8 @@ import {
cleanupTests,
getAllNotificationsSettings,
MockSmtpServer,
- prepareNotificationsTest,
PeerTubeServer,
+ prepareNotificationsTest,
waitJobs
} from '@shared/extra-utils'
import { UserNotification, UserNotificationSettingValue } from '@shared/models'
diff --git a/server/tests/api/redundancy/manage-redundancy.ts b/server/tests/api/redundancy/manage-redundancy.ts
index aff64e2ebe..5fd464dedb 100644
--- a/server/tests/api/redundancy/manage-redundancy.ts
+++ b/server/tests/api/redundancy/manage-redundancy.ts
@@ -4,10 +4,10 @@ import 'mocha'
import * as chai from 'chai'
import {
cleanupTests,
- doubleFollow,
createMultipleServers,
- RedundancyCommand,
+ doubleFollow,
PeerTubeServer,
+ RedundancyCommand,
setAccessTokensToServers,
waitJobs
} from '@shared/extra-utils'
diff --git a/server/tests/api/redundancy/redundancy-constraints.ts b/server/tests/api/redundancy/redundancy-constraints.ts
index 71b93901eb..25cd11658d 100644
--- a/server/tests/api/redundancy/redundancy-constraints.ts
+++ b/server/tests/api/redundancy/redundancy-constraints.ts
@@ -2,14 +2,7 @@
import 'mocha'
import { expect } from 'chai'
-import {
- cleanupTests,
- createSingleServer,
- killallServers,
- PeerTubeServer,
- setAccessTokensToServers,
- waitJobs
-} from '@shared/extra-utils'
+import { cleanupTests, createSingleServer, killallServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
import { VideoPrivacy } from '@shared/models'
describe('Test redundancy constraints', function () {
diff --git a/server/tests/api/redundancy/redundancy.ts b/server/tests/api/redundancy/redundancy.ts
index 921a488561..a6559d304f 100644
--- a/server/tests/api/redundancy/redundancy.ts
+++ b/server/tests/api/redundancy/redundancy.ts
@@ -5,22 +5,21 @@ import * as chai from 'chai'
import { readdir } from 'fs-extra'
import * as magnetUtil from 'magnet-uri'
import { join } from 'path'
-import { HttpStatusCode } from '@shared/models'
import {
checkSegmentHash,
checkVideoFilesWereRemoved,
cleanupTests,
- doubleFollow,
createMultipleServers,
+ doubleFollow,
killallServers,
makeGetRequest,
- root,
PeerTubeServer,
+ root,
setAccessTokensToServers,
wait,
waitJobs
} from '@shared/extra-utils'
-import { VideoPrivacy, VideoRedundancyStrategy, VideoRedundancyStrategyWithManual } from '@shared/models'
+import { HttpStatusCode, VideoPrivacy, VideoRedundancyStrategy, VideoRedundancyStrategyWithManual } from '@shared/models'
const expect = chai.expect
diff --git a/server/tests/api/search/search-activitypub-video-channels.ts b/server/tests/api/search/search-activitypub-video-channels.ts
index b33f282663..426cbc8e1b 100644
--- a/server/tests/api/search/search-activitypub-video-channels.ts
+++ b/server/tests/api/search/search-activitypub-video-channels.ts
@@ -5,8 +5,8 @@ import * as chai from 'chai'
import {
cleanupTests,
createMultipleServers,
- SearchCommand,
PeerTubeServer,
+ SearchCommand,
setAccessTokensToServers,
wait,
waitJobs
diff --git a/server/tests/api/search/search-activitypub-video-playlists.ts b/server/tests/api/search/search-activitypub-video-playlists.ts
index ada2d3d6ca..33ca7be12a 100644
--- a/server/tests/api/search/search-activitypub-video-playlists.ts
+++ b/server/tests/api/search/search-activitypub-video-playlists.ts
@@ -5,8 +5,8 @@ import * as chai from 'chai'
import {
cleanupTests,
createMultipleServers,
- SearchCommand,
PeerTubeServer,
+ SearchCommand,
setAccessTokensToServers,
setDefaultVideoChannel,
wait,
diff --git a/server/tests/api/search/search-activitypub-videos.ts b/server/tests/api/search/search-activitypub-videos.ts
index a015b72a74..b3cfcacca9 100644
--- a/server/tests/api/search/search-activitypub-videos.ts
+++ b/server/tests/api/search/search-activitypub-videos.ts
@@ -5,8 +5,8 @@ import * as chai from 'chai'
import {
cleanupTests,
createMultipleServers,
- SearchCommand,
PeerTubeServer,
+ SearchCommand,
setAccessTokensToServers,
wait,
waitJobs
diff --git a/server/tests/api/search/search-channels.ts b/server/tests/api/search/search-channels.ts
index 07e00a2147..4da2d0ecef 100644
--- a/server/tests/api/search/search-channels.ts
+++ b/server/tests/api/search/search-channels.ts
@@ -2,7 +2,7 @@
import 'mocha'
import * as chai from 'chai'
-import { cleanupTests, createSingleServer, SearchCommand, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils'
+import { cleanupTests, createSingleServer, PeerTubeServer, SearchCommand, setAccessTokensToServers } from '@shared/extra-utils'
import { VideoChannel } from '@shared/models'
const expect = chai.expect
diff --git a/server/tests/api/search/search-index.ts b/server/tests/api/search/search-index.ts
index 38edcf7c67..feb35411f5 100644
--- a/server/tests/api/search/search-index.ts
+++ b/server/tests/api/search/search-index.ts
@@ -2,7 +2,7 @@
import 'mocha'
import * as chai from 'chai'
-import { cleanupTests, createSingleServer, SearchCommand, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils'
+import { cleanupTests, createSingleServer, PeerTubeServer, SearchCommand, setAccessTokensToServers } from '@shared/extra-utils'
import { BooleanBothQuery, VideoPlaylistPrivacy, VideoPlaylistType, VideosSearchQuery } from '@shared/models'
const expect = chai.expect
diff --git a/server/tests/api/search/search-playlists.ts b/server/tests/api/search/search-playlists.ts
index b29c2d127f..22e9b8fca0 100644
--- a/server/tests/api/search/search-playlists.ts
+++ b/server/tests/api/search/search-playlists.ts
@@ -5,8 +5,8 @@ import * as chai from 'chai'
import {
cleanupTests,
createSingleServer,
- SearchCommand,
PeerTubeServer,
+ SearchCommand,
setAccessTokensToServers,
setDefaultVideoChannel
} from '@shared/extra-utils'
diff --git a/server/tests/api/search/search-videos.ts b/server/tests/api/search/search-videos.ts
index a9b0a4fcd1..f834c7f367 100644
--- a/server/tests/api/search/search-videos.ts
+++ b/server/tests/api/search/search-videos.ts
@@ -5,8 +5,8 @@ import * as chai from 'chai'
import {
cleanupTests,
createSingleServer,
- SearchCommand,
PeerTubeServer,
+ SearchCommand,
setAccessTokensToServers,
setDefaultVideoChannel,
stopFfmpeg,
diff --git a/server/tests/api/server/bulk.ts b/server/tests/api/server/bulk.ts
index 5d8c87983c..16cbcd5c38 100644
--- a/server/tests/api/server/bulk.ts
+++ b/server/tests/api/server/bulk.ts
@@ -5,8 +5,8 @@ import * as chai from 'chai'
import {
BulkCommand,
cleanupTests,
- doubleFollow,
createMultipleServers,
+ doubleFollow,
PeerTubeServer,
setAccessTokensToServers,
waitJobs
diff --git a/server/tests/api/server/config.ts b/server/tests/api/server/config.ts
index a1c2f0f391..fd61e95df2 100644
--- a/server/tests/api/server/config.ts
+++ b/server/tests/api/server/config.ts
@@ -2,7 +2,6 @@
import 'mocha'
import * as chai from 'chai'
-import { HttpStatusCode } from '@shared/models'
import {
cleanupTests,
createSingleServer,
@@ -12,7 +11,7 @@ import {
PeerTubeServer,
setAccessTokensToServers
} from '@shared/extra-utils'
-import { CustomConfig } from '@shared/models'
+import { CustomConfig, HttpStatusCode } from '@shared/models'
const expect = chai.expect
diff --git a/server/tests/api/server/contact-form.ts b/server/tests/api/server/contact-form.ts
index fc5d0ad6a4..c555661adc 100644
--- a/server/tests/api/server/contact-form.ts
+++ b/server/tests/api/server/contact-form.ts
@@ -2,7 +2,6 @@
import 'mocha'
import * as chai from 'chai'
-import { HttpStatusCode } from '@shared/models'
import {
cleanupTests,
ContactFormCommand,
@@ -13,6 +12,7 @@ import {
wait,
waitJobs
} from '@shared/extra-utils'
+import { HttpStatusCode } from '@shared/models'
const expect = chai.expect
diff --git a/server/tests/api/server/email.ts b/server/tests/api/server/email.ts
index 4c5b296ee5..ae86b380fd 100644
--- a/server/tests/api/server/email.ts
+++ b/server/tests/api/server/email.ts
@@ -2,8 +2,8 @@
import 'mocha'
import * as chai from 'chai'
-import { HttpStatusCode } from '@shared/models'
import { cleanupTests, createSingleServer, MockSmtpServer, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
+import { HttpStatusCode } from '@shared/models'
const expect = chai.expect
diff --git a/server/tests/api/server/follow-constraints.ts b/server/tests/api/server/follow-constraints.ts
index bd7b215dbd..471f5d8d08 100644
--- a/server/tests/api/server/follow-constraints.ts
+++ b/server/tests/api/server/follow-constraints.ts
@@ -2,9 +2,8 @@
import 'mocha'
import * as chai from 'chai'
-import { HttpStatusCode } from '@shared/models'
-import { cleanupTests, doubleFollow, createMultipleServers, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils'
-import { PeerTubeProblemDocument, ServerErrorCode } from '@shared/models'
+import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils'
+import { HttpStatusCode, PeerTubeProblemDocument, ServerErrorCode } from '@shared/models'
const expect = chai.expect
@@ -157,7 +156,7 @@ describe('Test follow constraints', function () {
it('Should list local account videos', async function () {
const { total, data } = await servers[0].videos.listByAccount({
- token: undefined,
+ token: null,
handle: 'root@localhost:' + servers[0].port
})
@@ -167,7 +166,7 @@ describe('Test follow constraints', function () {
it('Should not list remote account videos', async function () {
const { total, data } = await servers[0].videos.listByAccount({
- token: undefined,
+ token: null,
handle: 'root@localhost:' + servers[1].port
})
@@ -177,7 +176,7 @@ describe('Test follow constraints', function () {
it('Should list local channel videos', async function () {
const handle = 'root_channel@localhost:' + servers[0].port
- const { total, data } = await servers[0].videos.listByChannel({ token: undefined, handle })
+ const { total, data } = await servers[0].videos.listByChannel({ token: null, handle })
expect(total).to.equal(1)
expect(data).to.have.lengthOf(1)
@@ -185,7 +184,7 @@ describe('Test follow constraints', function () {
it('Should not list remote channel videos', async function () {
const handle = 'root_channel@localhost:' + servers[1].port
- const { total, data } = await servers[0].videos.listByChannel({ token: undefined, handle })
+ const { total, data } = await servers[0].videos.listByChannel({ token: null, handle })
expect(total).to.equal(0)
expect(data).to.have.lengthOf(0)
diff --git a/server/tests/api/server/follows.ts b/server/tests/api/server/follows.ts
index 8856177b8b..ff8f880a65 100644
--- a/server/tests/api/server/follows.ts
+++ b/server/tests/api/server/follows.ts
@@ -5,9 +5,9 @@ import * as chai from 'chai'
import {
cleanupTests,
completeVideoCheck,
+ createMultipleServers,
dateIsValid,
expectAccountFollows,
- createMultipleServers,
FollowsCommand,
PeerTubeServer,
setAccessTokensToServers,
diff --git a/server/tests/api/server/handle-down.ts b/server/tests/api/server/handle-down.ts
index d22e843e02..1f751c9570 100644
--- a/server/tests/api/server/handle-down.ts
+++ b/server/tests/api/server/handle-down.ts
@@ -2,7 +2,6 @@
import 'mocha'
import * as chai from 'chai'
-import { HttpStatusCode } from '@shared/models'
import {
cleanupTests,
CommentsCommand,
@@ -14,7 +13,7 @@ import {
wait,
waitJobs
} from '@shared/extra-utils'
-import { JobState, VideoCreateResult, VideoPrivacy } from '@shared/models'
+import { HttpStatusCode, JobState, VideoCreateResult, VideoPrivacy } from '@shared/models'
const expect = chai.expect
diff --git a/server/tests/api/server/homepage.ts b/server/tests/api/server/homepage.ts
index 7eae3df200..cb3ba56778 100644
--- a/server/tests/api/server/homepage.ts
+++ b/server/tests/api/server/homepage.ts
@@ -5,8 +5,8 @@ import * as chai from 'chai'
import { HttpStatusCode } from '@shared/models'
import {
cleanupTests,
- CustomPagesCommand,
createSingleServer,
+ CustomPagesCommand,
killallServers,
PeerTubeServer,
setAccessTokensToServers
diff --git a/server/tests/api/server/jobs.ts b/server/tests/api/server/jobs.ts
index 376cd10d09..c10c154c2a 100644
--- a/server/tests/api/server/jobs.ts
+++ b/server/tests/api/server/jobs.ts
@@ -4,9 +4,9 @@ import 'mocha'
import * as chai from 'chai'
import {
cleanupTests,
+ createMultipleServers,
dateIsValid,
doubleFollow,
- createMultipleServers,
PeerTubeServer,
setAccessTokensToServers,
waitJobs
diff --git a/server/tests/api/server/plugins.ts b/server/tests/api/server/plugins.ts
index 334adfe9d5..5f9f4ffddf 100644
--- a/server/tests/api/server/plugins.ts
+++ b/server/tests/api/server/plugins.ts
@@ -2,18 +2,17 @@
import 'mocha'
import * as chai from 'chai'
-import { HttpStatusCode } from '@shared/models'
import {
cleanupTests,
createSingleServer,
killallServers,
- PluginsCommand,
PeerTubeServer,
+ PluginsCommand,
setAccessTokensToServers,
testHelloWorldRegisteredSettings,
wait
} from '@shared/extra-utils'
-import { PluginType } from '@shared/models'
+import { HttpStatusCode, PluginType } from '@shared/models'
const expect = chai.expect
diff --git a/server/tests/api/server/reverse-proxy.ts b/server/tests/api/server/reverse-proxy.ts
index 13b22bc0ec..484f88d674 100644
--- a/server/tests/api/server/reverse-proxy.ts
+++ b/server/tests/api/server/reverse-proxy.ts
@@ -1,8 +1,8 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import { expect } from 'chai'
-import { HttpStatusCode } from '@shared/models'
import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers, wait } from '@shared/extra-utils'
+import { HttpStatusCode } from '@shared/models'
describe('Test application behind a reverse proxy', function () {
let server: PeerTubeServer
diff --git a/server/tests/api/server/stats.ts b/server/tests/api/server/stats.ts
index f07d0fd398..942602b70c 100644
--- a/server/tests/api/server/stats.ts
+++ b/server/tests/api/server/stats.ts
@@ -4,8 +4,8 @@ import 'mocha'
import * as chai from 'chai'
import {
cleanupTests,
- doubleFollow,
createMultipleServers,
+ doubleFollow,
PeerTubeServer,
setAccessTokensToServers,
wait,
diff --git a/server/tests/api/users/user-subscriptions.ts b/server/tests/api/users/user-subscriptions.ts
index d2bb9c387d..565b4bd779 100644
--- a/server/tests/api/users/user-subscriptions.ts
+++ b/server/tests/api/users/user-subscriptions.ts
@@ -4,8 +4,8 @@ import 'mocha'
import * as chai from 'chai'
import {
cleanupTests,
- doubleFollow,
createMultipleServers,
+ doubleFollow,
PeerTubeServer,
setAccessTokensToServers,
SubscriptionsCommand,
@@ -67,7 +67,8 @@ describe('Test users subscriptions', function () {
await waitJobs(servers)
- const { uuid } = await servers[2].videos.upload({ attributes: { name: 'video server 3 added after follow' } })
+ const attributes = { name: 'video server 3 added after follow' }
+ const { uuid } = await servers[2].videos.upload({ token: users[2].accessToken, attributes })
video3UUID = uuid
await waitJobs(servers)
diff --git a/server/tests/api/users/users-multiple-servers.ts b/server/tests/api/users/users-multiple-servers.ts
index e304e5d67f..225145957f 100644
--- a/server/tests/api/users/users-multiple-servers.ts
+++ b/server/tests/api/users/users-multiple-servers.ts
@@ -7,8 +7,8 @@ import {
checkTmpIsEmpty,
checkVideoFilesWereRemoved,
cleanupTests,
- doubleFollow,
createMultipleServers,
+ doubleFollow,
PeerTubeServer,
setAccessTokensToServers,
testImage,
diff --git a/server/tests/api/users/users-verification.ts b/server/tests/api/users/users-verification.ts
index 56fc25048e..f54463359d 100644
--- a/server/tests/api/users/users-verification.ts
+++ b/server/tests/api/users/users-verification.ts
@@ -2,8 +2,8 @@
import 'mocha'
import * as chai from 'chai'
-import { HttpStatusCode } from '@shared/models'
import { cleanupTests, createSingleServer, MockSmtpServer, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
+import { HttpStatusCode } from '@shared/models'
const expect = chai.expect
diff --git a/server/tests/api/users/users.ts b/server/tests/api/users/users.ts
index be80c26165..066da88eef 100644
--- a/server/tests/api/users/users.ts
+++ b/server/tests/api/users/users.ts
@@ -2,7 +2,6 @@
import 'mocha'
import * as chai from 'chai'
-import { HttpStatusCode } from '@shared/models'
import {
cleanupTests,
createSingleServer,
@@ -13,7 +12,7 @@ import {
testImage,
waitJobs
} from '@shared/extra-utils'
-import { AbuseState, OAuth2ErrorCode, UserAdminFlag, UserRole, Video, VideoPlaylistType } from '@shared/models'
+import { AbuseState, HttpStatusCode, OAuth2ErrorCode, UserAdminFlag, UserRole, Video, VideoPlaylistType } from '@shared/models'
const expect = chai.expect
diff --git a/server/tests/api/videos/audio-only.ts b/server/tests/api/videos/audio-only.ts
index b9bf96650e..15c3ae6d69 100644
--- a/server/tests/api/videos/audio-only.ts
+++ b/server/tests/api/videos/audio-only.ts
@@ -4,7 +4,7 @@ import 'mocha'
import * as chai from 'chai'
import { join } from 'path'
import { getAudioStream, getVideoStreamSize } from '@server/helpers/ffprobe-utils'
-import { cleanupTests, doubleFollow, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
+import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
const expect = chai.expect
diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts
index edf2773cd4..d916abb091 100644
--- a/server/tests/api/videos/multiple-servers.ts
+++ b/server/tests/api/videos/multiple-servers.ts
@@ -3,16 +3,15 @@
import 'mocha'
import * as chai from 'chai'
import * as request from 'supertest'
-import { HttpStatusCode } from '@shared/models'
import {
buildAbsoluteFixturePath,
checkTmpIsEmpty,
checkVideoFilesWereRemoved,
cleanupTests,
completeVideoCheck,
+ createMultipleServers,
dateIsValid,
doubleFollow,
- createMultipleServers,
PeerTubeServer,
setAccessTokensToServers,
testImage,
@@ -20,7 +19,7 @@ import {
waitJobs,
webtorrentAdd
} from '@shared/extra-utils'
-import { VideoCommentThreadTree, VideoPrivacy } from '@shared/models'
+import { HttpStatusCode, VideoCommentThreadTree, VideoPrivacy } from '@shared/models'
const expect = chai.expect
diff --git a/server/tests/api/videos/resumable-upload.ts b/server/tests/api/videos/resumable-upload.ts
index 0e62972c26..13e47c85e7 100644
--- a/server/tests/api/videos/resumable-upload.ts
+++ b/server/tests/api/videos/resumable-upload.ts
@@ -4,7 +4,6 @@ import 'mocha'
import * as chai from 'chai'
import { pathExists, readdir, stat } from 'fs-extra'
import { join } from 'path'
-import { HttpStatusCode } from '@shared/models'
import {
buildAbsoluteFixturePath,
cleanupTests,
@@ -13,7 +12,7 @@ import {
setAccessTokensToServers,
setDefaultVideoChannel
} from '@shared/extra-utils'
-import { VideoPrivacy } from '@shared/models'
+import { HttpStatusCode, VideoPrivacy } from '@shared/models'
const expect = chai.expect
diff --git a/server/tests/api/videos/video-captions.ts b/server/tests/api/videos/video-captions.ts
index 6caba6aa6f..e3d46e6199 100644
--- a/server/tests/api/videos/video-captions.ts
+++ b/server/tests/api/videos/video-captions.ts
@@ -5,8 +5,8 @@ import * as chai from 'chai'
import {
checkVideoFilesWereRemoved,
cleanupTests,
- doubleFollow,
createMultipleServers,
+ doubleFollow,
PeerTubeServer,
setAccessTokensToServers,
testCaptionFile,
diff --git a/server/tests/api/videos/video-change-ownership.ts b/server/tests/api/videos/video-change-ownership.ts
index 792550101c..6ae6d3004b 100644
--- a/server/tests/api/videos/video-change-ownership.ts
+++ b/server/tests/api/videos/video-change-ownership.ts
@@ -2,19 +2,18 @@
import 'mocha'
import * as chai from 'chai'
-import { HttpStatusCode } from '@shared/models'
import {
ChangeOwnershipCommand,
cleanupTests,
- doubleFollow,
createMultipleServers,
createSingleServer,
+ doubleFollow,
PeerTubeServer,
setAccessTokensToServers,
setDefaultVideoChannel,
waitJobs
} from '@shared/extra-utils'
-import { VideoPrivacy } from '@shared/models'
+import { HttpStatusCode, VideoPrivacy } from '@shared/models'
const expect = chai.expect
diff --git a/server/tests/api/videos/video-channels.ts b/server/tests/api/videos/video-channels.ts
index eeaec5ad29..c25754eb6a 100644
--- a/server/tests/api/videos/video-channels.ts
+++ b/server/tests/api/videos/video-channels.ts
@@ -6,8 +6,8 @@ import { basename } from 'path'
import { ACTOR_IMAGES_SIZE } from '@server/initializers/constants'
import {
cleanupTests,
- doubleFollow,
createMultipleServers,
+ doubleFollow,
PeerTubeServer,
setAccessTokensToServers,
setDefaultVideoChannel,
diff --git a/server/tests/api/videos/video-comments.ts b/server/tests/api/videos/video-comments.ts
index 9709e06288..61ee545409 100644
--- a/server/tests/api/videos/video-comments.ts
+++ b/server/tests/api/videos/video-comments.ts
@@ -5,8 +5,8 @@ import * as chai from 'chai'
import {
cleanupTests,
CommentsCommand,
- dateIsValid,
createSingleServer,
+ dateIsValid,
PeerTubeServer,
setAccessTokensToServers,
testImage
diff --git a/server/tests/api/videos/video-description.ts b/server/tests/api/videos/video-description.ts
index ce45eac80a..d22b4ed962 100644
--- a/server/tests/api/videos/video-description.ts
+++ b/server/tests/api/videos/video-description.ts
@@ -2,7 +2,7 @@
import 'mocha'
import * as chai from 'chai'
-import { cleanupTests, doubleFollow, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
+import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
const expect = chai.expect
diff --git a/server/tests/api/videos/video-hls.ts b/server/tests/api/videos/video-hls.ts
index df030110b9..7845f73341 100644
--- a/server/tests/api/videos/video-hls.ts
+++ b/server/tests/api/videos/video-hls.ts
@@ -3,22 +3,21 @@
import 'mocha'
import * as chai from 'chai'
import { join } from 'path'
-import { HttpStatusCode } from '@shared/models'
import {
checkDirectoryIsEmpty,
checkResolutionsInMasterPlaylist,
checkSegmentHash,
checkTmpIsEmpty,
cleanupTests,
- doubleFollow,
createMultipleServers,
+ doubleFollow,
makeRawRequest,
PeerTubeServer,
setAccessTokensToServers,
waitJobs,
webtorrentAdd
} from '@shared/extra-utils'
-import { VideoStreamingPlaylistType } from '@shared/models'
+import { HttpStatusCode, VideoStreamingPlaylistType } from '@shared/models'
import { DEFAULT_AUDIO_RESOLUTION } from '../../../initializers/constants'
const expect = chai.expect
diff --git a/server/tests/api/videos/video-nsfw.ts b/server/tests/api/videos/video-nsfw.ts
index 0a9e5ce3fa..b5d183d627 100644
--- a/server/tests/api/videos/video-nsfw.ts
+++ b/server/tests/api/videos/video-nsfw.ts
@@ -30,8 +30,8 @@ describe('Test video NSFW policy', function () {
promises = [
server.search.advancedVideoSearch({ token, search: { search: 'n', sort: '-publishedAt', ...query } }),
server.videos.listWithToken({ token, ...query }),
- server.videos.listByAccount({ token, handle: channelName, ...query }),
- server.videos.listByChannel({ token, handle: accountName, ...query })
+ server.videos.listByAccount({ token, handle: accountName, ...query }),
+ server.videos.listByChannel({ token, handle: channelName, ...query })
]
// Overviews do not support video filters
@@ -47,8 +47,8 @@ describe('Test video NSFW policy', function () {
promises = [
server.search.searchVideos({ search: 'n', sort: '-publishedAt' }),
server.videos.list(),
- server.videos.listByAccount({ handle: channelName }),
- server.videos.listByChannel({ handle: accountName })
+ server.videos.listByAccount({ token: null, handle: accountName }),
+ server.videos.listByChannel({ token: null, handle: channelName })
]
// Overviews do not support video filters
@@ -82,6 +82,7 @@ describe('Test video NSFW policy', function () {
})
describe('Instance default NSFW policy', function () {
+
it('Should display NSFW videos with display default NSFW policy', async function () {
const serverConfig = await server.config.getConfig()
expect(serverConfig.instance.defaultNSFWPolicy).to.equal('display')
diff --git a/server/tests/api/videos/video-playlist-thumbnails.ts b/server/tests/api/videos/video-playlist-thumbnails.ts
index 9a682c12b8..f0b2ca169f 100644
--- a/server/tests/api/videos/video-playlist-thumbnails.ts
+++ b/server/tests/api/videos/video-playlist-thumbnails.ts
@@ -4,8 +4,8 @@ import 'mocha'
import * as chai from 'chai'
import {
cleanupTests,
- doubleFollow,
createMultipleServers,
+ doubleFollow,
PeerTubeServer,
setAccessTokensToServers,
setDefaultVideoChannel,
diff --git a/server/tests/api/videos/video-playlists.ts b/server/tests/api/videos/video-playlists.ts
index 9a28a421ad..f42aee2ffb 100644
--- a/server/tests/api/videos/video-playlists.ts
+++ b/server/tests/api/videos/video-playlists.ts
@@ -2,14 +2,13 @@
import 'mocha'
import * as chai from 'chai'
-import { HttpStatusCode } from '@shared/models'
import {
checkPlaylistFilesWereRemoved,
cleanupTests,
- doubleFollow,
createMultipleServers,
- PlaylistsCommand,
+ doubleFollow,
PeerTubeServer,
+ PlaylistsCommand,
setAccessTokensToServers,
setDefaultVideoChannel,
testImage,
@@ -17,6 +16,7 @@ import {
waitJobs
} from '@shared/extra-utils'
import {
+ HttpStatusCode,
VideoPlaylist,
VideoPlaylistCreateResult,
VideoPlaylistElementType,
diff --git a/server/tests/api/videos/video-privacy.ts b/server/tests/api/videos/video-privacy.ts
index 06011082d2..b51b3bcddb 100644
--- a/server/tests/api/videos/video-privacy.ts
+++ b/server/tests/api/videos/video-privacy.ts
@@ -2,9 +2,8 @@
import 'mocha'
import * as chai from 'chai'
-import { HttpStatusCode } from '@shared/models'
-import { cleanupTests, doubleFollow, createSingleServer, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
-import { VideoCreateResult, VideoPrivacy } from '@shared/models'
+import { cleanupTests, createSingleServer, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
+import { HttpStatusCode, VideoCreateResult, VideoPrivacy } from '@shared/models'
const expect = chai.expect
@@ -162,7 +161,7 @@ describe('Test video privacy', function () {
})
it('Should not be able to get this unlisted video using its id', async function () {
- await servers[1].videos.get({ id: unlistedVideo.id, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
+ await servers[1].videos.get({ id: unlistedVideo.id, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
})
it('Should be able to get this unlisted video using its uuid/shortUUID', async function () {
diff --git a/server/tests/api/videos/video-schedule-update.ts b/server/tests/api/videos/video-schedule-update.ts
index 22b5cf1c22..3f77387842 100644
--- a/server/tests/api/videos/video-schedule-update.ts
+++ b/server/tests/api/videos/video-schedule-update.ts
@@ -4,8 +4,8 @@ import 'mocha'
import * as chai from 'chai'
import {
cleanupTests,
- doubleFollow,
createMultipleServers,
+ doubleFollow,
PeerTubeServer,
setAccessTokensToServers,
wait,
diff --git a/server/tests/api/videos/video-transcoder.ts b/server/tests/api/videos/video-transcoder.ts
index 7510472e3f..e4892bb24d 100644
--- a/server/tests/api/videos/video-transcoder.ts
+++ b/server/tests/api/videos/video-transcoder.ts
@@ -4,12 +4,11 @@ import 'mocha'
import * as chai from 'chai'
import { omit } from 'lodash'
import { join } from 'path'
-import { HttpStatusCode } from '@shared/models'
import {
buildAbsoluteFixturePath,
cleanupTests,
- doubleFollow,
createMultipleServers,
+ doubleFollow,
generateHighBitrateVideo,
generateVideoWithFramerate,
makeGetRequest,
@@ -18,7 +17,7 @@ import {
waitJobs,
webtorrentAdd
} from '@shared/extra-utils'
-import { getMaxBitrate, VideoResolution, VideoState } from '@shared/models'
+import { getMaxBitrate, HttpStatusCode, VideoResolution, VideoState } from '@shared/models'
import { VIDEO_TRANSCODING_FPS } from '../../../../server/initializers/constants'
import {
canDoQuickTranscode,
diff --git a/server/tests/api/videos/videos-filter.ts b/server/tests/api/videos/videos-filter.ts
index 88dff3e7f7..2306807bf9 100644
--- a/server/tests/api/videos/videos-filter.ts
+++ b/server/tests/api/videos/videos-filter.ts
@@ -2,16 +2,15 @@
import 'mocha'
import { expect } from 'chai'
-import { HttpStatusCode } from '@shared/models'
import {
cleanupTests,
- doubleFollow,
createMultipleServers,
+ doubleFollow,
makeGetRequest,
PeerTubeServer,
setAccessTokensToServers
} from '@shared/extra-utils'
-import { UserRole, Video, VideoPrivacy } from '@shared/models'
+import { HttpStatusCode, UserRole, Video, VideoPrivacy } from '@shared/models'
async function getVideosNames (server: PeerTubeServer, token: string, filter: string, expectedStatus = HttpStatusCode.OK_200) {
const paths = [
diff --git a/server/tests/api/videos/videos-history.ts b/server/tests/api/videos/videos-history.ts
index acb9d1a461..e4bc0bb3a3 100644
--- a/server/tests/api/videos/videos-history.ts
+++ b/server/tests/api/videos/videos-history.ts
@@ -2,7 +2,6 @@
import 'mocha'
import * as chai from 'chai'
-import { HttpStatusCode } from '@shared/models'
import {
cleanupTests,
createSingleServer,
@@ -12,7 +11,7 @@ import {
setAccessTokensToServers,
wait
} from '@shared/extra-utils'
-import { Video } from '@shared/models'
+import { HttpStatusCode, Video } from '@shared/models'
const expect = chai.expect
diff --git a/server/tests/api/videos/videos-views-cleaner.ts b/server/tests/api/videos/videos-views-cleaner.ts
index 0be03ddd2a..82268b1bed 100644
--- a/server/tests/api/videos/videos-views-cleaner.ts
+++ b/server/tests/api/videos/videos-views-cleaner.ts
@@ -4,8 +4,8 @@ import 'mocha'
import * as chai from 'chai'
import {
cleanupTests,
- doubleFollow,
createMultipleServers,
+ doubleFollow,
killallServers,
PeerTubeServer,
setAccessTokensToServers,
diff --git a/server/tests/cli/create-import-video-file-job.ts b/server/tests/cli/create-import-video-file-job.ts
index e8cd71e090..bddcff5e70 100644
--- a/server/tests/cli/create-import-video-file-job.ts
+++ b/server/tests/cli/create-import-video-file-job.ts
@@ -2,7 +2,7 @@
import 'mocha'
import * as chai from 'chai'
-import { cleanupTests, doubleFollow, createMultipleServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
+import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
import { VideoFile } from '@shared/models'
const expect = chai.expect
diff --git a/server/tests/cli/create-transcoding-job.ts b/server/tests/cli/create-transcoding-job.ts
index 53f187f90a..df787ccdca 100644
--- a/server/tests/cli/create-transcoding-job.ts
+++ b/server/tests/cli/create-transcoding-job.ts
@@ -4,8 +4,8 @@ import 'mocha'
import * as chai from 'chai'
import {
cleanupTests,
- doubleFollow,
createMultipleServers,
+ doubleFollow,
PeerTubeServer,
setAccessTokensToServers,
waitJobs
diff --git a/server/tests/cli/optimize-old-videos.ts b/server/tests/cli/optimize-old-videos.ts
index 53f47a85e0..685b3b7b8e 100644
--- a/server/tests/cli/optimize-old-videos.ts
+++ b/server/tests/cli/optimize-old-videos.ts
@@ -5,8 +5,8 @@ import * as chai from 'chai'
import { join } from 'path'
import {
cleanupTests,
- doubleFollow,
createMultipleServers,
+ doubleFollow,
generateHighBitrateVideo,
PeerTubeServer,
setAccessTokensToServers,
diff --git a/server/tests/cli/plugins.ts b/server/tests/cli/plugins.ts
index 42651d79c7..07c78cc89e 100644
--- a/server/tests/cli/plugins.ts
+++ b/server/tests/cli/plugins.ts
@@ -6,8 +6,8 @@ import {
cleanupTests,
createSingleServer,
killallServers,
- PluginsCommand,
PeerTubeServer,
+ PluginsCommand,
setAccessTokensToServers
} from '../../../shared/extra-utils'
diff --git a/server/tests/cli/prune-storage.ts b/server/tests/cli/prune-storage.ts
index 2bd4a466b8..954a87833e 100644
--- a/server/tests/cli/prune-storage.ts
+++ b/server/tests/cli/prune-storage.ts
@@ -5,12 +5,11 @@ import * as chai from 'chai'
import { createFile, readdir } from 'fs-extra'
import { join } from 'path'
import { buildUUID } from '@server/helpers/uuid'
-import { HttpStatusCode } from '@shared/models'
import {
cleanupTests,
CLICommand,
- doubleFollow,
createMultipleServers,
+ doubleFollow,
killallServers,
makeGetRequest,
PeerTubeServer,
@@ -19,7 +18,7 @@ import {
wait,
waitJobs
} from '@shared/extra-utils'
-import { VideoPlaylistPrivacy } from '@shared/models'
+import { HttpStatusCode, VideoPlaylistPrivacy } from '@shared/models'
const expect = chai.expect
diff --git a/server/tests/cli/regenerate-thumbnails.ts b/server/tests/cli/regenerate-thumbnails.ts
index 595d842ef3..780c9b4bd8 100644
--- a/server/tests/cli/regenerate-thumbnails.ts
+++ b/server/tests/cli/regenerate-thumbnails.ts
@@ -2,12 +2,11 @@ import 'mocha'
import { expect } from 'chai'
import { writeFile } from 'fs-extra'
import { basename, join } from 'path'
-import { HttpStatusCode } from '@shared/models'
-import { Video } from '@shared/models'
+import { HttpStatusCode, Video } from '@shared/models'
import {
cleanupTests,
- doubleFollow,
createMultipleServers,
+ doubleFollow,
makeRawRequest,
PeerTubeServer,
setAccessTokensToServers,
diff --git a/server/tests/client.ts b/server/tests/client.ts
index 6255c69612..9c27a7aae0 100644
--- a/server/tests/client.ts
+++ b/server/tests/client.ts
@@ -3,12 +3,11 @@
import 'mocha'
import * as chai from 'chai'
import { omit } from 'lodash'
-import { HttpStatusCode } from '@shared/models'
-import { Account, HTMLServerConfig, ServerConfig, VideoPlaylistCreateResult, VideoPlaylistPrivacy } from '@shared/models'
+import { Account, HTMLServerConfig, HttpStatusCode, ServerConfig, VideoPlaylistCreateResult, VideoPlaylistPrivacy } from '@shared/models'
import {
cleanupTests,
- doubleFollow,
createMultipleServers,
+ doubleFollow,
makeGetRequest,
makeHTMLRequest,
PeerTubeServer,
diff --git a/server/tests/external-plugins/auth-ldap.ts b/server/tests/external-plugins/auth-ldap.ts
index 12b4a1b8d2..acec69df59 100644
--- a/server/tests/external-plugins/auth-ldap.ts
+++ b/server/tests/external-plugins/auth-ldap.ts
@@ -2,8 +2,8 @@
import 'mocha'
import { expect } from 'chai'
-import { HttpStatusCode } from '@shared/models'
import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils'
+import { HttpStatusCode } from '@shared/models'
describe('Official plugin auth-ldap', function () {
let server: PeerTubeServer
diff --git a/server/tests/external-plugins/auto-block-videos.ts b/server/tests/external-plugins/auto-block-videos.ts
index 78b13eded7..0eb4bda9ad 100644
--- a/server/tests/external-plugins/auto-block-videos.ts
+++ b/server/tests/external-plugins/auto-block-videos.ts
@@ -4,8 +4,8 @@ import 'mocha'
import { expect } from 'chai'
import {
cleanupTests,
- doubleFollow,
createMultipleServers,
+ doubleFollow,
killallServers,
MockBlocklist,
PeerTubeServer,
diff --git a/server/tests/external-plugins/auto-mute.ts b/server/tests/external-plugins/auto-mute.ts
index b2046313b5..271779dd4c 100644
--- a/server/tests/external-plugins/auto-mute.ts
+++ b/server/tests/external-plugins/auto-mute.ts
@@ -2,11 +2,10 @@
import 'mocha'
import { expect } from 'chai'
-import { HttpStatusCode } from '@shared/models'
import {
cleanupTests,
- doubleFollow,
createMultipleServers,
+ doubleFollow,
killallServers,
makeGetRequest,
MockBlocklist,
@@ -14,6 +13,7 @@ import {
setAccessTokensToServers,
wait
} from '@shared/extra-utils'
+import { HttpStatusCode } from '@shared/models'
describe('Official plugin auto-mute', function () {
const autoMuteListPath = '/plugins/auto-mute/router/api/v1/mute-list'
diff --git a/server/tests/feeds/feeds.ts b/server/tests/feeds/feeds.ts
index 543c431ddc..5667207c05 100644
--- a/server/tests/feeds/feeds.ts
+++ b/server/tests/feeds/feeds.ts
@@ -3,17 +3,16 @@
import 'mocha'
import * as chai from 'chai'
import * as xmlParser from 'fast-xml-parser'
-import { HttpStatusCode } from '@shared/models'
import {
cleanupTests,
- doubleFollow,
createMultipleServers,
createSingleServer,
+ doubleFollow,
PeerTubeServer,
setAccessTokensToServers,
waitJobs
} from '@shared/extra-utils'
-import { VideoPrivacy } from '@shared/models'
+import { HttpStatusCode, VideoPrivacy } from '@shared/models'
chai.use(require('chai-xml'))
chai.use(require('chai-json-schema'))
diff --git a/server/tests/helpers/comment-model.ts b/server/tests/helpers/comment-model.ts
index 4c51b70003..31dc6ec72f 100644
--- a/server/tests/helpers/comment-model.ts
+++ b/server/tests/helpers/comment-model.ts
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
-import * as chai from 'chai'
import 'mocha'
+import * as chai from 'chai'
import { VideoCommentModel } from '../../models/video/video-comment'
const expect = chai.expect
diff --git a/server/tests/helpers/core-utils.ts b/server/tests/helpers/core-utils.ts
index c028b316d9..d5cac51a32 100644
--- a/server/tests/helpers/core-utils.ts
+++ b/server/tests/helpers/core-utils.ts
@@ -1,10 +1,10 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
-import * as chai from 'chai'
import 'mocha'
+import * as chai from 'chai'
import { snakeCase } from 'lodash'
-import { objectConverter, parseBytes } from '../../helpers/core-utils'
import validator from 'validator'
+import { objectConverter, parseBytes } from '../../helpers/core-utils'
const expect = chai.expect
diff --git a/server/tests/helpers/image.ts b/server/tests/helpers/image.ts
index 54911697fe..9fe9aa4cba 100644
--- a/server/tests/helpers/image.ts
+++ b/server/tests/helpers/image.ts
@@ -1,11 +1,11 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha'
+import { expect } from 'chai'
import { readFile, remove } from 'fs-extra'
import { join } from 'path'
import { processImage } from '../../../server/helpers/image-utils'
import { buildAbsoluteFixturePath, root } from '../../../shared/extra-utils'
-import { expect } from 'chai'
async function checkBuffers (path1: string, path2: string, equals: boolean) {
const [ buf1, buf2 ] = await Promise.all([
diff --git a/server/tests/misc-endpoints.ts b/server/tests/misc-endpoints.ts
index 4d9c07f1a8..4968eef089 100644
--- a/server/tests/misc-endpoints.ts
+++ b/server/tests/misc-endpoints.ts
@@ -2,9 +2,8 @@
import 'mocha'
import * as chai from 'chai'
-import { HttpStatusCode } from '@shared/models'
import { cleanupTests, createSingleServer, makeGetRequest, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils'
-import { VideoPrivacy } from '@shared/models'
+import { HttpStatusCode, VideoPrivacy } from '@shared/models'
const expect = chai.expect
diff --git a/server/tests/plugins/action-hooks.ts b/server/tests/plugins/action-hooks.ts
index b96de4e902..4c1bc7d063 100644
--- a/server/tests/plugins/action-hooks.ts
+++ b/server/tests/plugins/action-hooks.ts
@@ -120,7 +120,7 @@ describe('Test plugin action hooks', function () {
})
it('Should run action:api.user.oauth2-got-token', async function () {
- await servers[0].login.getAccessToken('created_user', 'super_password')
+ await servers[0].login.login({ user: { username: 'created_user' } })
await checkHook('action:api.user.oauth2-got-token')
})
diff --git a/server/tests/plugins/external-auth.ts b/server/tests/plugins/external-auth.ts
index a2828603a6..f3e018d437 100644
--- a/server/tests/plugins/external-auth.ts
+++ b/server/tests/plugins/external-auth.ts
@@ -2,17 +2,16 @@
import 'mocha'
import { expect } from 'chai'
-import { HttpStatusCode } from '@shared/models'
import {
cleanupTests,
- decodeQueryString,
createSingleServer,
- PluginsCommand,
+ decodeQueryString,
PeerTubeServer,
+ PluginsCommand,
setAccessTokensToServers,
wait
} from '@shared/extra-utils'
-import { UserRole } from '@shared/models'
+import { HttpStatusCode, UserRole } from '@shared/models'
async function loginExternal (options: {
server: PeerTubeServer
diff --git a/server/tests/plugins/filter-hooks.ts b/server/tests/plugins/filter-hooks.ts
index ba84dd27a1..c00ac8f917 100644
--- a/server/tests/plugins/filter-hooks.ts
+++ b/server/tests/plugins/filter-hooks.ts
@@ -2,7 +2,6 @@
import 'mocha'
import * as chai from 'chai'
-import { HttpStatusCode } from '@shared/models'
import {
cleanupTests,
createMultipleServers,
@@ -15,7 +14,7 @@ import {
setDefaultVideoChannel,
waitJobs
} from '@shared/extra-utils'
-import { VideoDetails, VideoImportState, VideoPlaylist, VideoPlaylistPrivacy, VideoPrivacy } from '@shared/models'
+import { HttpStatusCode, VideoDetails, VideoImportState, VideoPlaylist, VideoPlaylistPrivacy, VideoPrivacy } from '@shared/models'
const expect = chai.expect
diff --git a/server/tests/plugins/html-injection.ts b/server/tests/plugins/html-injection.ts
index 2902c39b7d..95c0cd687b 100644
--- a/server/tests/plugins/html-injection.ts
+++ b/server/tests/plugins/html-injection.ts
@@ -6,8 +6,8 @@ import {
cleanupTests,
createSingleServer,
makeHTMLRequest,
- PluginsCommand,
PeerTubeServer,
+ PluginsCommand,
setAccessTokensToServers
} from '../../../shared/extra-utils'
diff --git a/server/tests/plugins/id-and-pass-auth.ts b/server/tests/plugins/id-and-pass-auth.ts
index a73d76caac..fde0166f9a 100644
--- a/server/tests/plugins/id-and-pass-auth.ts
+++ b/server/tests/plugins/id-and-pass-auth.ts
@@ -2,9 +2,8 @@
import 'mocha'
import { expect } from 'chai'
-import { HttpStatusCode } from '@shared/models'
-import { cleanupTests, createSingleServer, PluginsCommand, PeerTubeServer, setAccessTokensToServers, wait } from '@shared/extra-utils'
-import { UserRole } from '@shared/models'
+import { cleanupTests, createSingleServer, PeerTubeServer, PluginsCommand, setAccessTokensToServers, wait } from '@shared/extra-utils'
+import { HttpStatusCode, UserRole } from '@shared/models'
describe('Test id and pass auth plugins', function () {
let server: PeerTubeServer
diff --git a/server/tests/plugins/plugin-helpers.ts b/server/tests/plugins/plugin-helpers.ts
index 5cb664bda3..2429942732 100644
--- a/server/tests/plugins/plugin-helpers.ts
+++ b/server/tests/plugins/plugin-helpers.ts
@@ -2,19 +2,19 @@
import 'mocha'
import { expect } from 'chai'
-import { HttpStatusCode } from '@shared/models'
import {
checkVideoFilesWereRemoved,
cleanupTests,
- doubleFollow,
createMultipleServers,
+ doubleFollow,
makeGetRequest,
makePostBodyRequest,
- PluginsCommand,
PeerTubeServer,
+ PluginsCommand,
setAccessTokensToServers,
waitJobs
} from '@shared/extra-utils'
+import { HttpStatusCode } from '@shared/models'
function postCommand (server: PeerTubeServer, command: string, bodyArg?: object) {
const body = { command }
diff --git a/server/tests/plugins/plugin-router.ts b/server/tests/plugins/plugin-router.ts
index becb7c47bf..b1ac9e2fe7 100644
--- a/server/tests/plugins/plugin-router.ts
+++ b/server/tests/plugins/plugin-router.ts
@@ -2,16 +2,16 @@
import 'mocha'
import { expect } from 'chai'
-import { HttpStatusCode } from '@shared/models'
import {
cleanupTests,
createSingleServer,
makeGetRequest,
makePostBodyRequest,
- PluginsCommand,
PeerTubeServer,
+ PluginsCommand,
setAccessTokensToServers
} from '@shared/extra-utils'
+import { HttpStatusCode } from '@shared/models'
describe('Test plugin helpers', function () {
let server: PeerTubeServer
diff --git a/server/tests/plugins/plugin-storage.ts b/server/tests/plugins/plugin-storage.ts
index 90dafa3e1c..e20c36dbac 100644
--- a/server/tests/plugins/plugin-storage.ts
+++ b/server/tests/plugins/plugin-storage.ts
@@ -4,7 +4,6 @@ import 'mocha'
import { expect } from 'chai'
import { pathExists, readdir, readFile } from 'fs-extra'
import { join } from 'path'
-import { HttpStatusCode } from '@shared/models'
import {
cleanupTests,
createSingleServer,
@@ -13,6 +12,7 @@ import {
PluginsCommand,
setAccessTokensToServers
} from '@shared/extra-utils'
+import { HttpStatusCode } from '@shared/models'
describe('Test plugin storage', function () {
let server: PeerTubeServer
diff --git a/server/tests/plugins/plugin-transcoding.ts b/server/tests/plugins/plugin-transcoding.ts
index 3c54d37966..0bf1fab01b 100644
--- a/server/tests/plugins/plugin-transcoding.ts
+++ b/server/tests/plugins/plugin-transcoding.ts
@@ -7,8 +7,8 @@ import { getAudioStream, getVideoFileFPS, getVideoStreamFromFile } from '@server
import {
cleanupTests,
createSingleServer,
- PluginsCommand,
PeerTubeServer,
+ PluginsCommand,
setAccessTokensToServers,
setDefaultVideoChannel,
testFfmpegStreamError,
diff --git a/server/tests/plugins/plugin-unloading.ts b/server/tests/plugins/plugin-unloading.ts
index faf9cc5994..6bf2fda9b3 100644
--- a/server/tests/plugins/plugin-unloading.ts
+++ b/server/tests/plugins/plugin-unloading.ts
@@ -2,7 +2,6 @@
import 'mocha'
import { expect } from 'chai'
-import { HttpStatusCode } from '@shared/models'
import {
cleanupTests,
createSingleServer,
@@ -11,6 +10,7 @@ import {
PluginsCommand,
setAccessTokensToServers
} from '@shared/extra-utils'
+import { HttpStatusCode } from '@shared/models'
describe('Test plugins module unloading', function () {
let server: PeerTubeServer = null
diff --git a/server/tests/plugins/video-constants.ts b/server/tests/plugins/video-constants.ts
index dd3b40225e..f527a2b301 100644
--- a/server/tests/plugins/video-constants.ts
+++ b/server/tests/plugins/video-constants.ts
@@ -2,9 +2,8 @@
import 'mocha'
import * as chai from 'chai'
-import { HttpStatusCode } from '@shared/models'
-import { cleanupTests, createSingleServer, PluginsCommand, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils'
-import { VideoPlaylistPrivacy } from '@shared/models'
+import { cleanupTests, createSingleServer, PeerTubeServer, PluginsCommand, setAccessTokensToServers } from '@shared/extra-utils'
+import { HttpStatusCode, VideoPlaylistPrivacy } from '@shared/models'
const expect = chai.expect
diff --git a/server/tools/peertube-redundancy.ts b/server/tools/peertube-redundancy.ts
index bcaae63a3c..73b026ac8f 100644
--- a/server/tools/peertube-redundancy.ts
+++ b/server/tools/peertube-redundancy.ts
@@ -6,8 +6,7 @@ import { Command, program } from 'commander'
import { uniq } from 'lodash'
import { URL } from 'url'
import validator from 'validator'
-import { HttpStatusCode } from '@shared/models'
-import { VideoRedundanciesTarget } from '@shared/models'
+import { HttpStatusCode, VideoRedundanciesTarget } from '@shared/models'
import { assignToken, buildServer, getServerCredentials } from './cli'
import bytes = require('bytes')
diff --git a/shared/extra-utils/custom-pages/custom-pages-command.ts b/shared/extra-utils/custom-pages/custom-pages-command.ts
index 6042233d40..cd869a8de6 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 @@
-import { CustomPage } from '@shared/models'
-import { HttpStatusCode } from '@shared/models'
+import { CustomPage, HttpStatusCode } from '@shared/models'
import { AbstractCommand, OverrideCommandOptions } from '../shared'
export class CustomPagesCommand extends AbstractCommand {
diff --git a/shared/extra-utils/miscs/generate.ts b/shared/extra-utils/miscs/generate.ts
index 4e70ab853c..8d64354816 100644
--- a/shared/extra-utils/miscs/generate.ts
+++ b/shared/extra-utils/miscs/generate.ts
@@ -1,7 +1,7 @@
+import * as ffmpeg from 'fluent-ffmpeg'
import { ensureDir, pathExists } from 'fs-extra'
import { dirname } from 'path'
import { buildAbsoluteFixturePath } from './tests'
-import * as ffmpeg from 'fluent-ffmpeg'
async function generateHighBitrateVideo () {
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 72f2c9951a..7b3abb0567 100644
--- a/shared/extra-utils/moderation/abuses-command.ts
+++ b/shared/extra-utils/moderation/abuses-command.ts
@@ -7,12 +7,12 @@ import {
AbuseUpdate,
AbuseVideoIs,
AdminAbuse,
+ HttpStatusCode,
ResultList,
UserAbuse
} from '@shared/models'
-import { HttpStatusCode } from '@shared/models'
-import { AbstractCommand, OverrideCommandOptions } from '../shared'
import { unwrapBody } from '../requests/requests'
+import { AbstractCommand, OverrideCommandOptions } from '../shared'
export class AbusesCommand extends AbstractCommand {
diff --git a/shared/extra-utils/overviews/overviews-command.ts b/shared/extra-utils/overviews/overviews-command.ts
index d4a2ac2541..06b4892d2f 100644
--- a/shared/extra-utils/overviews/overviews-command.ts
+++ b/shared/extra-utils/overviews/overviews-command.ts
@@ -1,5 +1,4 @@
-import { HttpStatusCode } from '@shared/models'
-import { VideosOverview } from '@shared/models'
+import { HttpStatusCode, VideosOverview } from '@shared/models'
import { AbstractCommand, OverrideCommandOptions } from '../shared'
export class OverviewsCommand extends AbstractCommand {
diff --git a/shared/extra-utils/requests/activitypub.ts b/shared/extra-utils/requests/activitypub.ts
index ecd8ce8238..4ae878384b 100644
--- a/shared/extra-utils/requests/activitypub.ts
+++ b/shared/extra-utils/requests/activitypub.ts
@@ -1,7 +1,7 @@
+import { activityPubContextify } from '../../../server/helpers/activitypub'
import { doRequest } from '../../../server/helpers/requests'
import { HTTP_SIGNATURE } from '../../../server/initializers/constants'
import { buildGlobalHeaders } from '../../../server/lib/job-queue/handlers/utils/activitypub-http-utils'
-import { activityPubContextify } from '../../../server/helpers/activitypub'
function makePOSTAPRequest (url: string, body: any, httpSignature: any, headers: any) {
const options = {
diff --git a/shared/extra-utils/search/search-command.ts b/shared/extra-utils/search/search-command.ts
index 09f5d3f1d8..0fbbcd6efe 100644
--- a/shared/extra-utils/search/search-command.ts
+++ b/shared/extra-utils/search/search-command.ts
@@ -1,4 +1,5 @@
import {
+ HttpStatusCode,
ResultList,
Video,
VideoChannel,
@@ -7,7 +8,6 @@ import {
VideoPlaylistsSearchQuery,
VideosSearchQuery
} from '@shared/models'
-import { HttpStatusCode } from '@shared/models'
import { AbstractCommand, OverrideCommandOptions } from '../shared'
export class SearchCommand extends AbstractCommand {
diff --git a/shared/extra-utils/server/config-command.ts b/shared/extra-utils/server/config-command.ts
index 6e875fdf60..11148aa466 100644
--- a/shared/extra-utils/server/config-command.ts
+++ b/shared/extra-utils/server/config-command.ts
@@ -1,6 +1,6 @@
import { merge } from 'lodash'
import { DeepPartial } from '@shared/core-utils'
-import { About, ServerConfig, HttpStatusCode } from '@shared/models'
+import { About, HttpStatusCode, ServerConfig } from '@shared/models'
import { CustomConfig } from '../../models/server/custom-config.model'
import { AbstractCommand, OverrideCommandOptions } from '../shared'
diff --git a/shared/extra-utils/server/debug-command.ts b/shared/extra-utils/server/debug-command.ts
index 36704836da..3c5a785bbf 100644
--- a/shared/extra-utils/server/debug-command.ts
+++ b/shared/extra-utils/server/debug-command.ts
@@ -1,5 +1,4 @@
-import { Debug, SendDebugCommand } from '@shared/models'
-import { HttpStatusCode } from '@shared/models'
+import { Debug, HttpStatusCode, SendDebugCommand } from '@shared/models'
import { AbstractCommand, OverrideCommandOptions } from '../shared'
export class DebugCommand extends AbstractCommand {
diff --git a/shared/extra-utils/server/follows-command.ts b/shared/extra-utils/server/follows-command.ts
index 694f5ea244..dce674ac5c 100644
--- a/shared/extra-utils/server/follows-command.ts
+++ b/shared/extra-utils/server/follows-command.ts
@@ -1,6 +1,5 @@
import { pick } from 'lodash'
-import { ActivityPubActorType, ActorFollow, FollowState, ResultList } from '@shared/models'
-import { HttpStatusCode } from '@shared/models'
+import { ActivityPubActorType, ActorFollow, FollowState, HttpStatusCode, ResultList } from '@shared/models'
import { AbstractCommand, OverrideCommandOptions } from '../shared'
import { PeerTubeServer } from './server'
diff --git a/shared/extra-utils/server/plugins-command.ts b/shared/extra-utils/server/plugins-command.ts
index 59bc79b3d2..b944475a26 100644
--- a/shared/extra-utils/server/plugins-command.ts
+++ b/shared/extra-utils/server/plugins-command.ts
@@ -3,8 +3,8 @@
import { readJSON, writeJSON } from 'fs-extra'
import { join } from 'path'
import { root } from '@server/helpers/core-utils'
-import { HttpStatusCode } from '@shared/models'
import {
+ HttpStatusCode,
PeerTubePlugin,
PeerTubePluginIndex,
PeertubePluginIndexList,
diff --git a/shared/extra-utils/server/redundancy-command.ts b/shared/extra-utils/server/redundancy-command.ts
index 137d7f01c5..e7a8b3c29e 100644
--- a/shared/extra-utils/server/redundancy-command.ts
+++ b/shared/extra-utils/server/redundancy-command.ts
@@ -1,5 +1,4 @@
-import { ResultList, VideoRedundanciesTarget, VideoRedundancy } from '@shared/models'
-import { HttpStatusCode } from '@shared/models'
+import { HttpStatusCode, ResultList, VideoRedundanciesTarget, VideoRedundancy } from '@shared/models'
import { AbstractCommand, OverrideCommandOptions } from '../shared'
export class RedundancyCommand extends AbstractCommand {
diff --git a/shared/extra-utils/server/stats-command.ts b/shared/extra-utils/server/stats-command.ts
index 6db4735882..64a4523063 100644
--- a/shared/extra-utils/server/stats-command.ts
+++ b/shared/extra-utils/server/stats-command.ts
@@ -1,5 +1,4 @@
-import { ServerStats } from '@shared/models'
-import { HttpStatusCode } from '@shared/models'
+import { HttpStatusCode, ServerStats } from '@shared/models'
import { AbstractCommand, OverrideCommandOptions } from '../shared'
export class StatsCommand extends AbstractCommand {
diff --git a/shared/extra-utils/users/accounts-command.ts b/shared/extra-utils/users/accounts-command.ts
index 08977e58b7..2f586104eb 100644
--- a/shared/extra-utils/users/accounts-command.ts
+++ b/shared/extra-utils/users/accounts-command.ts
@@ -1,5 +1,4 @@
-import { ResultList } from '@shared/models'
-import { HttpStatusCode } from '@shared/models'
+import { HttpStatusCode, ResultList } from '@shared/models'
import { Account } from '../../models/actors'
import { AccountVideoRate, VideoRateType } from '../../models/videos'
import { AbstractCommand, OverrideCommandOptions } from '../shared'
diff --git a/shared/extra-utils/users/blocklist-command.ts b/shared/extra-utils/users/blocklist-command.ts
index a9431acf3d..14491a1aee 100644
--- a/shared/extra-utils/users/blocklist-command.ts
+++ b/shared/extra-utils/users/blocklist-command.ts
@@ -1,7 +1,6 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
-import { HttpStatusCode } from '@shared/models'
-import { AccountBlock, ResultList, ServerBlock } from '@shared/models'
+import { AccountBlock, HttpStatusCode, ResultList, ServerBlock } from '@shared/models'
import { AbstractCommand, OverrideCommandOptions } from '../shared'
type ListBlocklistOptions = OverrideCommandOptions & {
diff --git a/shared/extra-utils/users/login-command.ts b/shared/extra-utils/users/login-command.ts
index b39577260e..143f72a59c 100644
--- a/shared/extra-utils/users/login-command.ts
+++ b/shared/extra-utils/users/login-command.ts
@@ -1,5 +1,4 @@
-import { HttpStatusCode } from '@shared/models'
-import { PeerTubeProblemDocument } from '@shared/models'
+import { HttpStatusCode, PeerTubeProblemDocument } from '@shared/models'
import { unwrapBody } from '../requests'
import { AbstractCommand, OverrideCommandOptions } from '../shared'
diff --git a/shared/extra-utils/users/notifications-command.ts b/shared/extra-utils/users/notifications-command.ts
index a51fcc3af7..2d79a37475 100644
--- a/shared/extra-utils/users/notifications-command.ts
+++ b/shared/extra-utils/users/notifications-command.ts
@@ -1,5 +1,4 @@
-import { ResultList } from '@shared/models'
-import { HttpStatusCode } from '@shared/models'
+import { HttpStatusCode, ResultList } from '@shared/models'
import { UserNotification, UserNotificationSetting } from '../../models/users'
import { AbstractCommand, OverrideCommandOptions } from '../shared'
diff --git a/shared/extra-utils/users/subscriptions-command.ts b/shared/extra-utils/users/subscriptions-command.ts
index a69d2a1948..edc60e612f 100644
--- a/shared/extra-utils/users/subscriptions-command.ts
+++ b/shared/extra-utils/users/subscriptions-command.ts
@@ -1,5 +1,4 @@
-import { ResultList, Video, VideoChannel } from '@shared/models'
-import { HttpStatusCode } from '@shared/models'
+import { HttpStatusCode, ResultList, Video, VideoChannel } from '@shared/models'
import { AbstractCommand, OverrideCommandOptions } from '../shared'
export class SubscriptionsCommand extends AbstractCommand {
diff --git a/shared/extra-utils/users/users-command.ts b/shared/extra-utils/users/users-command.ts
index f3a251e65f..d66ad15f26 100644
--- a/shared/extra-utils/users/users-command.ts
+++ b/shared/extra-utils/users/users-command.ts
@@ -1,6 +1,6 @@
import { omit, pick } from 'lodash'
-import { HttpStatusCode } from '@shared/models'
import {
+ HttpStatusCode,
MyUser,
ResultList,
User,
diff --git a/shared/extra-utils/videos/blacklist-command.ts b/shared/extra-utils/videos/blacklist-command.ts
index 9404d4c08f..3a2ef89ba1 100644
--- a/shared/extra-utils/videos/blacklist-command.ts
+++ b/shared/extra-utils/videos/blacklist-command.ts
@@ -1,6 +1,5 @@
-import { ResultList } from '@shared/models'
-import { HttpStatusCode } from '@shared/models'
+import { HttpStatusCode, ResultList } from '@shared/models'
import { VideoBlacklist, VideoBlacklistType } from '../../models/videos'
import { AbstractCommand, OverrideCommandOptions } from '../shared'
diff --git a/shared/extra-utils/videos/captions-command.ts b/shared/extra-utils/videos/captions-command.ts
index 04dd32f844..a0608e1a63 100644
--- a/shared/extra-utils/videos/captions-command.ts
+++ b/shared/extra-utils/videos/captions-command.ts
@@ -1,5 +1,4 @@
-import { HttpStatusCode } from '@shared/models'
-import { ResultList, VideoCaption } from '@shared/models'
+import { HttpStatusCode, ResultList, VideoCaption } from '@shared/models'
import { buildAbsoluteFixturePath } from '../miscs'
import { AbstractCommand, OverrideCommandOptions } from '../shared'
diff --git a/shared/extra-utils/videos/change-ownership-command.ts b/shared/extra-utils/videos/change-ownership-command.ts
index ef6f075365..ad4c726efa 100644
--- a/shared/extra-utils/videos/change-ownership-command.ts
+++ b/shared/extra-utils/videos/change-ownership-command.ts
@@ -1,6 +1,5 @@
-import { ResultList, VideoChangeOwnership } from '@shared/models'
-import { HttpStatusCode } from '@shared/models'
+import { HttpStatusCode, ResultList, VideoChangeOwnership } from '@shared/models'
import { AbstractCommand, OverrideCommandOptions } from '../shared'
export class ChangeOwnershipCommand extends AbstractCommand {
diff --git a/shared/extra-utils/videos/channels-command.ts b/shared/extra-utils/videos/channels-command.ts
index e5393ff564..f8eb3f8853 100644
--- a/shared/extra-utils/videos/channels-command.ts
+++ b/shared/extra-utils/videos/channels-command.ts
@@ -1,6 +1,5 @@
import { pick } from 'lodash'
-import { ResultList, VideoChannel, VideoChannelCreateResult } from '@shared/models'
-import { HttpStatusCode } from '@shared/models'
+import { HttpStatusCode, ResultList, VideoChannel, VideoChannelCreateResult } from '@shared/models'
import { VideoChannelCreate } from '../../models/videos/channel/video-channel-create.model'
import { VideoChannelUpdate } from '../../models/videos/channel/video-channel-update.model'
import { unwrapBody } from '../requests'
diff --git a/shared/extra-utils/videos/comments-command.ts b/shared/extra-utils/videos/comments-command.ts
index 7368f3ea21..dd14e4b641 100644
--- a/shared/extra-utils/videos/comments-command.ts
+++ b/shared/extra-utils/videos/comments-command.ts
@@ -1,6 +1,5 @@
import { pick } from 'lodash'
-import { HttpStatusCode } from '@shared/models'
-import { ResultList, VideoComment, VideoCommentThreads, VideoCommentThreadTree } from '@shared/models'
+import { HttpStatusCode, ResultList, VideoComment, VideoCommentThreads, VideoCommentThreadTree } from '@shared/models'
import { unwrapBody } from '../requests'
import { AbstractCommand, OverrideCommandOptions } from '../shared'
diff --git a/shared/extra-utils/videos/history-command.ts b/shared/extra-utils/videos/history-command.ts
index 41afc6bc6a..13b7150c1c 100644
--- a/shared/extra-utils/videos/history-command.ts
+++ b/shared/extra-utils/videos/history-command.ts
@@ -1,5 +1,4 @@
-import { HttpStatusCode } from '@shared/models'
-import { ResultList, Video } from '@shared/models'
+import { HttpStatusCode, ResultList, Video } from '@shared/models'
import { AbstractCommand, OverrideCommandOptions } from '../shared'
export class HistoryCommand extends AbstractCommand {
diff --git a/shared/extra-utils/videos/imports-command.ts b/shared/extra-utils/videos/imports-command.ts
index d30f9745b6..e4944694d9 100644
--- a/shared/extra-utils/videos/imports-command.ts
+++ b/shared/extra-utils/videos/imports-command.ts
@@ -1,6 +1,5 @@
-import { HttpStatusCode } from '@shared/models'
-import { ResultList } from '@shared/models'
+import { HttpStatusCode, ResultList } from '@shared/models'
import { VideoImport, VideoImportCreate } from '../../models/videos'
import { unwrapBody } from '../requests'
import { AbstractCommand, OverrideCommandOptions } from '../shared'
diff --git a/shared/extra-utils/videos/live-command.ts b/shared/extra-utils/videos/live-command.ts
index 9dfe3087ee..bf9486a057 100644
--- a/shared/extra-utils/videos/live-command.ts
+++ b/shared/extra-utils/videos/live-command.ts
@@ -3,8 +3,7 @@
import { readdir } from 'fs-extra'
import { omit } from 'lodash'
import { join } from 'path'
-import { HttpStatusCode } from '@shared/models'
-import { LiveVideo, LiveVideoCreate, LiveVideoUpdate, VideoCreateResult, VideoDetails, VideoState } from '@shared/models'
+import { HttpStatusCode, LiveVideo, LiveVideoCreate, LiveVideoUpdate, VideoCreateResult, VideoDetails, VideoState } from '@shared/models'
import { wait } from '../miscs'
import { unwrapBody } from '../requests'
import { AbstractCommand, OverrideCommandOptions } from '../shared'
diff --git a/shared/extra-utils/videos/playlists-command.ts b/shared/extra-utils/videos/playlists-command.ts
index 40162c30d5..6f329800e5 100644
--- a/shared/extra-utils/videos/playlists-command.ts
+++ b/shared/extra-utils/videos/playlists-command.ts
@@ -1,7 +1,7 @@
import { omit, pick } from 'lodash'
-import { HttpStatusCode } from '@shared/models'
import {
BooleanBothQuery,
+ HttpStatusCode,
ResultList,
VideoExistInPlaylist,
VideoPlaylist,
diff --git a/shared/extra-utils/videos/streaming-playlists.ts b/shared/extra-utils/videos/streaming-playlists.ts
index 007d3d98d0..1ae3fefc1d 100644
--- a/shared/extra-utils/videos/streaming-playlists.ts
+++ b/shared/extra-utils/videos/streaming-playlists.ts
@@ -1,7 +1,6 @@
import { expect } from 'chai'
import { sha256 } from '@server/helpers/core-utils'
-import { HttpStatusCode } from '@shared/models'
-import { VideoStreamingPlaylist } from '@shared/models'
+import { HttpStatusCode, VideoStreamingPlaylist } from '@shared/models'
import { PeerTubeServer } from '../server'
async function checkSegmentHash (options: {
diff --git a/shared/extra-utils/videos/videos-command.ts b/shared/extra-utils/videos/videos-command.ts
index f46d386f4f..40cc4dc28d 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'
import validator from 'validator'
import { buildUUID } from '@server/helpers/uuid'
import { loadLanguages } from '@server/initializers/constants'
-import { HttpStatusCode } from '@shared/models'
import {
+ HttpStatusCode,
ResultList,
UserVideoRateType,
Video,
@@ -332,7 +332,7 @@ export class VideosCommand extends AbstractCommand {
attributes?: VideoEdit
mode?: 'legacy' | 'resumable' // default legacy
} = {}) {
- const { mode = 'legacy', expectedStatus } = options
+ const { mode = 'legacy' } = options
let defaultChannelId = 1
try {
@@ -360,22 +360,23 @@ export class VideosCommand extends AbstractCommand {
...options.attributes
}
- const res = mode === 'legacy'
+ const created = mode === 'legacy'
? await this.buildLegacyUpload({ ...options, attributes })
: await this.buildResumeUpload({ ...options, attributes })
// Wait torrent generation
+ const expectedStatus = this.buildExpectedStatus({ ...options, defaultExpectedStatus: HttpStatusCode.OK_200 })
if (expectedStatus === HttpStatusCode.OK_200) {
let video: VideoDetails
do {
- video = await this.getWithToken({ ...options, id: video.uuid })
+ video = await this.getWithToken({ ...options, id: created.uuid })
await wait(50)
} while (!video.files[0].torrentUrl)
}
- return res
+ return created
}
async buildLegacyUpload (options: OverrideCommandOptions & {
@@ -535,13 +536,13 @@ export class VideosCommand extends AbstractCommand {
async randomUpload (options: OverrideCommandOptions & {
wait?: boolean // default true
- additionalParams?: VideoEdit & { prefixName: string }
+ additionalParams?: VideoEdit & { prefixName?: string }
} = {}) {
const { wait = true, additionalParams } = options
const prefixName = additionalParams?.prefixName || ''
const name = prefixName + buildUUID()
- const attributes = { name, additionalParams }
+ const attributes = { name, ...additionalParams }
const result = await this.upload({ ...options, attributes })
diff --git a/shared/extra-utils/videos/videos.ts b/shared/extra-utils/videos/videos.ts
index a96073c564..9a9bfb3cff 100644
--- a/shared/extra-utils/videos/videos.ts
+++ b/shared/extra-utils/videos/videos.ts
@@ -202,7 +202,7 @@ async function uploadRandomVideoOnServers (
additionalParams?: VideoEdit & { prefixName?: string }
) {
const server = servers.find(s => s.serverNumber === serverNumber)
- const res = await server.videos.randomUpload({ wait: false, ...additionalParams })
+ const res = await server.videos.randomUpload({ wait: false, additionalParams })
await waitJobs(servers)