Reorganize imports

This commit is contained in:
Chocobozzz 2021-07-16 14:27:30 +02:00
parent c0e8b12e7f
commit 4c7e60bc17
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
165 changed files with 268 additions and 328 deletions

View File

@ -1,10 +1,10 @@
import * as express from 'express' 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 { bulkRemoveCommentsOfValidator } from '@server/middlewares/validators/bulk'
import { VideoCommentModel } from '@server/models/video/video-comment' 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 { 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() const bulkRouter = express.Router()

View File

@ -1,8 +1,8 @@
import { ServerConfigManager } from '@server/lib/server-config-manager'
import * as express from 'express' import * as express from 'express'
import { remove, writeJSON } from 'fs-extra' import { remove, writeJSON } from 'fs-extra'
import { snakeCase } from 'lodash' import { snakeCase } from 'lodash'
import validator from 'validator' import validator from 'validator'
import { ServerConfigManager } from '@server/lib/server-config-manager'
import { UserRight } from '../../../shared' import { UserRight } from '../../../shared'
import { About } from '../../../shared/models/server/about.model' import { About } from '../../../shared/models/server/about.model'
import { CustomConfig } from '../../../shared/models/server/custom-config.model' import { CustomConfig } from '../../../shared/models/server/custom-config.model'

View File

@ -1,8 +1,7 @@
import * as express from 'express' import * as express from 'express'
import { ServerConfigManager } from '@server/lib/server-config-manager' import { ServerConfigManager } from '@server/lib/server-config-manager'
import { ActorCustomPageModel } from '@server/models/account/actor-custom-page' import { ActorCustomPageModel } from '@server/models/account/actor-custom-page'
import { HttpStatusCode } from '@shared/models' import { HttpStatusCode, UserRight } from '@shared/models'
import { UserRight } from '@shared/models'
import { asyncMiddleware, authenticate, ensureUserHasRight } from '../../middlewares' import { asyncMiddleware, authenticate, ensureUserHasRight } from '../../middlewares'
const customPageRouter = express.Router() const customPageRouter = express.Router()

View File

@ -1,12 +1,12 @@
import * as express from 'express' import * as express from 'express'
import { buildNSFWFilter } from '../../helpers/express-utils'
import { VideoModel } from '../../models/video/video'
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 * as memoizee from 'memoizee'
import { logger } from '@server/helpers/logger' import { logger } from '@server/helpers/logger'
import { CategoryOverview, ChannelOverview, TagOverview, VideosOverview } from '../../../shared/models/overviews'
import { buildNSFWFilter } from '../../helpers/express-utils'
import { MEMOIZE_TTL, OVERVIEWS } from '../../initializers/constants'
import { asyncMiddleware, optionalAuthenticate, videosOverviewValidator } from '../../middlewares'
import { TagModel } from '../../models/video/tag'
import { VideoModel } from '../../models/video/video'
const overviewsRouter = express.Router() const overviewsRouter = express.Router()

View File

@ -23,8 +23,8 @@ import {
updatePluginSettingsValidator updatePluginSettingsValidator
} from '@server/middlewares/validators/plugins' } from '@server/middlewares/validators/plugins'
import { PluginModel } from '@server/models/server/plugin' import { PluginModel } from '@server/models/server/plugin'
import { HttpStatusCode } from '@shared/models'
import { import {
HttpStatusCode,
InstallOrUpdatePlugin, InstallOrUpdatePlugin,
ManagePlugin, ManagePlugin,
PeertubePluginIndexList, PeertubePluginIndexList,

View File

@ -6,8 +6,7 @@ import { WEBSERVER } from '@server/initializers/constants'
import { Hooks } from '@server/lib/plugins/hooks' import { Hooks } from '@server/lib/plugins/hooks'
import { buildMutedForSearchIndex, isSearchIndexSearch, isURISearch } from '@server/lib/search' import { buildMutedForSearchIndex, isSearchIndexSearch, isURISearch } from '@server/lib/search'
import { getServerActor } from '@server/models/application/application' import { getServerActor } from '@server/models/application/application'
import { HttpStatusCode } from '@shared/models' import { HttpStatusCode, ResultList, VideoChannel } from '@shared/models'
import { ResultList, VideoChannel } from '@shared/models'
import { VideoChannelsSearchQuery } from '../../../../shared/models/search' import { VideoChannelsSearchQuery } from '../../../../shared/models/search'
import { isUserAbleToSearchRemoteURI } from '../../../helpers/express-utils' import { isUserAbleToSearchRemoteURI } from '../../../helpers/express-utils'
import { logger } from '../../../helpers/logger' import { logger } from '../../../helpers/logger'

View File

@ -5,14 +5,14 @@ import { logger } from '@server/helpers/logger'
import { doJSONRequest } from '@server/helpers/requests' import { doJSONRequest } from '@server/helpers/requests'
import { getFormattedObjects } from '@server/helpers/utils' import { getFormattedObjects } from '@server/helpers/utils'
import { CONFIG } from '@server/initializers/config' import { CONFIG } from '@server/initializers/config'
import { WEBSERVER } from '@server/initializers/constants'
import { getOrCreateAPVideoPlaylist } from '@server/lib/activitypub/playlists/get' import { getOrCreateAPVideoPlaylist } from '@server/lib/activitypub/playlists/get'
import { Hooks } from '@server/lib/plugins/hooks' import { Hooks } from '@server/lib/plugins/hooks'
import { buildMutedForSearchIndex, isSearchIndexSearch, isURISearch } from '@server/lib/search' import { buildMutedForSearchIndex, isSearchIndexSearch, isURISearch } from '@server/lib/search'
import { getServerActor } from '@server/models/application/application' import { getServerActor } from '@server/models/application/application'
import { VideoPlaylistModel } from '@server/models/video/video-playlist' import { VideoPlaylistModel } from '@server/models/video/video-playlist'
import { MVideoPlaylistFullSummary } from '@server/types/models' import { MVideoPlaylistFullSummary } from '@server/types/models'
import { HttpStatusCode } from '@shared/models' import { HttpStatusCode, ResultList, VideoPlaylist, VideoPlaylistsSearchQuery } from '@shared/models'
import { ResultList, VideoPlaylist, VideoPlaylistsSearchQuery } from '@shared/models'
import { import {
asyncMiddleware, asyncMiddleware,
openapiOperationDoc, openapiOperationDoc,
@ -23,7 +23,6 @@ import {
videoPlaylistsListSearchValidator, videoPlaylistsListSearchValidator,
videoPlaylistsSearchSortValidator videoPlaylistsSearchSortValidator
} from '../../../middlewares' } from '../../../middlewares'
import { WEBSERVER } from '@server/initializers/constants'
const searchPlaylistsRouter = express.Router() const searchPlaylistsRouter = express.Router()

View File

@ -6,8 +6,7 @@ import { WEBSERVER } from '@server/initializers/constants'
import { getOrCreateAPVideo } from '@server/lib/activitypub/videos' import { getOrCreateAPVideo } from '@server/lib/activitypub/videos'
import { Hooks } from '@server/lib/plugins/hooks' import { Hooks } from '@server/lib/plugins/hooks'
import { buildMutedForSearchIndex, isSearchIndexSearch, isURISearch } from '@server/lib/search' import { buildMutedForSearchIndex, isSearchIndexSearch, isURISearch } from '@server/lib/search'
import { HttpStatusCode } from '@shared/models' import { HttpStatusCode, ResultList, Video } from '@shared/models'
import { ResultList, Video } from '@shared/models'
import { VideosSearchQuery } from '../../../../shared/models/search' import { VideosSearchQuery } from '../../../../shared/models/search'
import { buildNSFWFilter, isUserAbleToSearchRemoteURI } from '../../../helpers/express-utils' import { buildNSFWFilter, isUserAbleToSearchRemoteURI } from '../../../helpers/express-utils'
import { logger } from '../../../helpers/logger' import { logger } from '../../../helpers/logger'

View File

@ -1,9 +1,9 @@
import * as express from 'express' 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 { 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() const contactRouter = express.Router()

View File

@ -1,11 +1,11 @@
import * as express from 'express' import * as express from 'express'
import { contactRouter } from './contact'
import { debugRouter } from './debug'
import { serverFollowsRouter } from './follows' import { serverFollowsRouter } from './follows'
import { statsRouter } from './stats' import { logsRouter } from './logs'
import { serverRedundancyRouter } from './redundancy' import { serverRedundancyRouter } from './redundancy'
import { serverBlocklistRouter } from './server-blocklist' import { serverBlocklistRouter } from './server-blocklist'
import { contactRouter } from './contact' import { statsRouter } from './stats'
import { logsRouter } from './logs'
import { debugRouter } from './debug'
const serverRouter = express.Router() const serverRouter = express.Router()

View File

@ -1,14 +1,14 @@
import * as express from 'express' 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 { readdir, readFile } from 'fs-extra'
import { AUDIT_LOG_FILENAME, MAX_LOGS_OUTPUT_CHARACTERS, LOG_FILENAME } from '../../../initializers/constants'
import { join } from 'path' import { join } from 'path'
import { getAuditLogsValidator, getLogsValidator } from '../../../middlewares/validators/logs'
import { LogLevel } from '../../../../shared/models/server/log-level.type'
import { CONFIG } from '../../../initializers/config'
import { logger } from '@server/helpers/logger' 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 { 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() const logsRouter = express.Router()

View File

@ -2,6 +2,7 @@ import 'multer'
import * as express from 'express' import * as express from 'express'
import { auditLoggerFactory, getAuditIdFromRes, UserAuditView } from '@server/helpers/audit-logger' import { auditLoggerFactory, getAuditIdFromRes, UserAuditView } from '@server/helpers/audit-logger'
import { Hooks } from '@server/lib/plugins/hooks' import { Hooks } from '@server/lib/plugins/hooks'
import { AttributesOnly } from '@shared/core-utils'
import { ActorImageType, UserUpdateMe, UserVideoRate as FormattedUserVideoRate } from '../../../../shared' import { ActorImageType, UserUpdateMe, UserVideoRate as FormattedUserVideoRate } from '../../../../shared'
import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
import { UserVideoQuota } from '../../../../shared/models/users/user-video-quota.model' 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 { UserModel } from '../../../models/user/user'
import { VideoModel } from '../../../models/video/video' import { VideoModel } from '../../../models/video/video'
import { VideoImportModel } from '../../../models/video/video-import' import { VideoImportModel } from '../../../models/video/video-import'
import { AttributesOnly } from '@shared/core-utils'
const auditLogger = auditLoggerFactory('users') const auditLogger = auditLoggerFactory('users')

View File

@ -1,6 +1,10 @@
import * as express from 'express'
import 'multer' 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 { getFormattedObjects } from '../../../helpers/utils'
import { addAccountInBlocklist, addServerInBlocklist, removeAccountFromBlocklist, removeServerFromBlocklist } from '../../../lib/blocklist'
import { import {
asyncMiddleware, asyncMiddleware,
asyncRetryTransactionMiddleware, asyncRetryTransactionMiddleware,
@ -18,11 +22,7 @@ import {
unblockServerByAccountValidator unblockServerByAccountValidator
} from '../../../middlewares/validators' } from '../../../middlewares/validators'
import { AccountBlocklistModel } from '../../../models/account/account-blocklist' import { AccountBlocklistModel } from '../../../models/account/account-blocklist'
import { addAccountInBlocklist, addServerInBlocklist, removeAccountFromBlocklist, removeServerFromBlocklist } from '../../../lib/blocklist'
import { ServerBlocklistModel } from '../../../models/server/server-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() const myBlocklistRouter = express.Router()

View File

@ -1,4 +1,7 @@
import * as express from 'express' 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 { import {
asyncMiddleware, asyncMiddleware,
asyncRetryTransactionMiddleware, asyncRetryTransactionMiddleware,
@ -8,10 +11,7 @@ import {
userHistoryListValidator, userHistoryListValidator,
userHistoryRemoveValidator userHistoryRemoveValidator
} from '../../../middlewares' } from '../../../middlewares'
import { getFormattedObjects } from '../../../helpers/utils'
import { UserVideoHistoryModel } from '../../../models/user/user-video-history' 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() const myVideosHistoryRouter = express.Router()

View File

@ -1,8 +1,8 @@
import * as express from 'express' import * as express from 'express'
import { VideosExistInPlaylists } from '../../../../shared/models/videos/playlist/video-exist-in-playlist.model'
import { asyncMiddleware, authenticate } from '../../../middlewares' import { asyncMiddleware, authenticate } from '../../../middlewares'
import { doVideosInPlaylistExistValidator } from '../../../middlewares/validators/videos/video-playlists' import { doVideosInPlaylistExistValidator } from '../../../middlewares/validators/videos/video-playlists'
import { VideoPlaylistModel } from '../../../models/video/video-playlist' import { VideoPlaylistModel } from '../../../models/video/video-playlist'
import { VideosExistInPlaylists } from '../../../../shared/models/videos/playlist/video-exist-in-playlist.model'
const myVideoPlaylistsRouter = express.Router() const myVideoPlaylistsRouter = express.Router()

View File

@ -1,6 +1,7 @@
import * as express from 'express' import * as express from 'express'
import { blacklistVideo, unblacklistVideo } from '@server/lib/video-blacklist' import { blacklistVideo, unblacklistVideo } from '@server/lib/video-blacklist'
import { UserRight, VideoBlacklistCreate } from '../../../../shared' import { UserRight, VideoBlacklistCreate } from '../../../../shared'
import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
import { logger } from '../../../helpers/logger' import { logger } from '../../../helpers/logger'
import { getFormattedObjects } from '../../../helpers/utils' import { getFormattedObjects } from '../../../helpers/utils'
import { sequelizeTypescript } from '../../../initializers/database' import { sequelizeTypescript } from '../../../initializers/database'
@ -19,7 +20,6 @@ import {
videosBlacklistUpdateValidator videosBlacklistUpdateValidator
} from '../../../middlewares' } from '../../../middlewares'
import { VideoBlacklistModel } from '../../../models/video/video-blacklist' import { VideoBlacklistModel } from '../../../models/video/video-blacklist'
import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
const blacklistRouter = express.Router() const blacklistRouter = express.Router()

View File

@ -1,6 +1,6 @@
import * as express from 'express' import * as express from 'express'
import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
import { ResultList, ThreadsResultList, UserRight, VideoCommentCreate } from '../../../../shared/models' 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 { VideoCommentThreads } from '../../../../shared/models/videos/comment/video-comment.model'
import { auditLoggerFactory, CommentAuditView, getAuditIdFromRes } from '../../../helpers/audit-logger' import { auditLoggerFactory, CommentAuditView, getAuditIdFromRes } from '../../../helpers/audit-logger'
import { getFormattedObjects } from '../../../helpers/utils' import { getFormattedObjects } from '../../../helpers/utils'

View File

@ -1,6 +1,12 @@
import * as express from 'express' 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 { logger } from '../../../helpers/logger'
import { getFormattedObjects } from '../../../helpers/utils'
import { sequelizeTypescript } from '../../../initializers/database' import { sequelizeTypescript } from '../../../initializers/database'
import { sendUpdateVideo } from '../../../lib/activitypub/send'
import { changeVideoChannelShare } from '../../../lib/activitypub/share'
import { import {
asyncMiddleware, asyncMiddleware,
asyncRetryTransactionMiddleware, asyncRetryTransactionMiddleware,
@ -11,15 +17,9 @@ import {
videosChangeOwnershipValidator, videosChangeOwnershipValidator,
videosTerminateChangeOwnershipValidator videosTerminateChangeOwnershipValidator
} from '../../../middlewares' } from '../../../middlewares'
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 { VideoModel } from '../../../models/video/video'
import { MVideoFullLight } from '@server/types/models' import { VideoChangeOwnershipModel } from '../../../models/video/video-change-ownership'
import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' import { VideoChannelModel } from '../../../models/video/video-channel'
const ownershipVideoRouter = express.Router() const ownershipVideoRouter = express.Router()

View File

@ -1,13 +1,13 @@
import * as express from 'express' import * as express from 'express'
import { UserVideoRateUpdate } from '../../../../shared' import { UserVideoRateUpdate } from '../../../../shared'
import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
import { logger } from '../../../helpers/logger' import { logger } from '../../../helpers/logger'
import { VIDEO_RATE_TYPES } from '../../../initializers/constants' import { VIDEO_RATE_TYPES } from '../../../initializers/constants'
import { sequelizeTypescript } from '../../../initializers/database'
import { getLocalRateUrl, sendVideoRateChange } from '../../../lib/activitypub/video-rates' import { getLocalRateUrl, sendVideoRateChange } from '../../../lib/activitypub/video-rates'
import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate, videoUpdateRateValidator } from '../../../middlewares' import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate, videoUpdateRateValidator } from '../../../middlewares'
import { AccountModel } from '../../../models/account/account' import { AccountModel } from '../../../models/account/account'
import { AccountVideoRateModel } from '../../../models/account/account-video-rate' 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() const rateVideoRouter = express.Router()

View File

@ -1,5 +1,6 @@
import * as express from 'express' import * as express from 'express'
import { UserWatchingVideo } from '../../../../shared' import { UserWatchingVideo } from '../../../../shared'
import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
import { import {
asyncMiddleware, asyncMiddleware,
asyncRetryTransactionMiddleware, asyncRetryTransactionMiddleware,
@ -8,7 +9,6 @@ import {
videoWatchingValidator videoWatchingValidator
} from '../../../middlewares' } from '../../../middlewares'
import { UserVideoHistoryModel } from '../../../models/user/user-video-history' import { UserVideoHistoryModel } from '../../../models/user/user-video-history'
import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
const watchingRouter = express.Router() const watchingRouter = express.Router()

View File

@ -5,8 +5,7 @@ import { VideosTorrentCache } from '@server/lib/files-cache/videos-torrent-cache
import { Hooks } from '@server/lib/plugins/hooks' import { Hooks } from '@server/lib/plugins/hooks'
import { getVideoFilePath } from '@server/lib/video-paths' import { getVideoFilePath } from '@server/lib/video-paths'
import { MStreamingPlaylist, MVideo, MVideoFile, MVideoFullLight } from '@server/types/models' import { MStreamingPlaylist, MVideo, MVideoFile, MVideoFullLight } from '@server/types/models'
import { HttpStatusCode } from '@shared/models' import { HttpStatusCode, VideoStreamingPlaylistType } from '@shared/models'
import { VideoStreamingPlaylistType } from '@shared/models'
import { STATIC_DOWNLOAD_PATHS } from '../initializers/constants' import { STATIC_DOWNLOAD_PATHS } from '../initializers/constants'
import { asyncMiddleware, videosDownloadValidator } from '../middlewares' import { asyncMiddleware, videosDownloadValidator } from '../middlewares'

View File

@ -1,6 +1,6 @@
import { Redis } from '../lib/redis'
import * as apicache from 'apicache' import * as apicache from 'apicache'
import { HttpStatusCode } from '../../shared/models/http/http-error-codes' import { HttpStatusCode } from '../../shared/models/http/http-error-codes'
import { Redis } from '../lib/redis'
// Ensure Redis is initialized // Ensure Redis is initialized
Redis.Instance.init() Redis.Instance.init()

View File

@ -1,6 +1,6 @@
import * as express from 'express' import * as express from 'express'
import { getHostWithPort } from '../helpers/express-utils'
import { HttpStatusCode } from '../../shared/models/http/http-error-codes' 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) { function setBodyHostsPort (req: express.Request, res: express.Response, next: express.NextFunction) {
if (!req.body.hosts) return next() if (!req.body.hosts) return next()

View File

@ -1,7 +1,7 @@
import * as express from 'express' import * as express from 'express'
import { UserRight } from '../../shared' import { UserRight } from '../../shared'
import { logger } from '../helpers/logger'
import { HttpStatusCode } from '../../shared/models/http/http-error-codes' import { HttpStatusCode } from '../../shared/models/http/http-error-codes'
import { logger } from '../helpers/logger'
function ensureUserHasRight (userRight: UserRight) { function ensureUserHasRight (userRight: UserRight) {
return function (req: express.Request, res: express.Response, next: express.NextFunction) { return function (req: express.Request, res: express.Response, next: express.NextFunction) {

View File

@ -1,8 +1,8 @@
import * as express from 'express' 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 { getServerActor } from '@server/models/application/application'
import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' 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) { async function activityPubValidator (req: express.Request, res: express.Response, next: express.NextFunction) {
logger.debug('Checking activity pub parameters') logger.debug('Checking activity pub parameters')

View File

@ -1,8 +1,7 @@
import * as express from 'express' import * as express from 'express'
import { body } from 'express-validator' import { body } from 'express-validator'
import { isBulkRemoveCommentsOfScopeValid } from '@server/helpers/custom-validators/bulk' import { isBulkRemoveCommentsOfScopeValid } from '@server/helpers/custom-validators/bulk'
import { HttpStatusCode } from '@shared/models' import { HttpStatusCode, UserRight } from '@shared/models'
import { UserRight } from '@shared/models'
import { BulkRemoveCommentsOfBody } from '@shared/models/bulk/bulk-remove-comments-of-body.model' import { BulkRemoveCommentsOfBody } from '@shared/models/bulk/bulk-remove-comments-of-body.model'
import { logger } from '../../helpers/logger' import { logger } from '../../helpers/logger'
import { areValidationErrors, doesAccountNameWithHostExist } from './shared' import { areValidationErrors, doesAccountNameWithHostExist } from './shared'

View File

@ -1,6 +1,5 @@
import * as express from 'express' import * as express from 'express'
import { param, query } from 'express-validator' import { param, query } from 'express-validator'
import { HttpStatusCode } from '../../../shared/models/http/http-error-codes' import { HttpStatusCode } from '../../../shared/models/http/http-error-codes'
import { isValidRSSFeed } from '../../helpers/custom-validators/feeds' import { isValidRSSFeed } from '../../helpers/custom-validators/feeds'
import { exists, isIdOrUUIDValid, isIdValid, toCompleteUUID } from '../../helpers/custom-validators/misc' import { exists, isIdOrUUIDValid, isIdValid, toCompleteUUID } from '../../helpers/custom-validators/misc'

View File

@ -12,8 +12,7 @@ import {
MVideoImmutable, MVideoImmutable,
MVideoThumbnail MVideoThumbnail
} from '@server/types/models' } from '@server/types/models'
import { HttpStatusCode } from '@shared/models' import { HttpStatusCode, UserRight } from '@shared/models'
import { UserRight } from '@shared/models'
async function doesVideoExist (id: number | string, res: Response, fetchType: VideoLoadType = 'all') { async function doesVideoExist (id: number | string, res: Response, fetchType: VideoLoadType = 'all') {
const userId = res.locals.oauth ? res.locals.oauth.token.User.id : undefined const userId = res.locals.oauth ? res.locals.oauth.token.User.id : undefined

View File

@ -5,8 +5,7 @@ import { isLocalLiveVideoAccepted } from '@server/lib/moderation'
import { Hooks } from '@server/lib/plugins/hooks' import { Hooks } from '@server/lib/plugins/hooks'
import { VideoModel } from '@server/models/video/video' import { VideoModel } from '@server/models/video/video'
import { VideoLiveModel } from '@server/models/video/video-live' import { VideoLiveModel } from '@server/models/video/video-live'
import { HttpStatusCode } from '@shared/models' import { HttpStatusCode, ServerErrorCode, UserRight, VideoState } from '@shared/models'
import { ServerErrorCode, UserRight, VideoState } from '@shared/models'
import { isBooleanValid, isIdValid, toBooleanOrNull, toIntOrNull } from '../../../helpers/custom-validators/misc' import { isBooleanValid, isIdValid, toBooleanOrNull, toIntOrNull } from '../../../helpers/custom-validators/misc'
import { isVideoNameValid } from '../../../helpers/custom-validators/videos' import { isVideoNameValid } from '../../../helpers/custom-validators/videos'
import { cleanUpReqFiles } from '../../../helpers/express-utils' import { cleanUpReqFiles } from '../../../helpers/express-utils'

View File

@ -6,8 +6,14 @@ import { logger } from '@server/helpers/logger'
import { isAbleToUploadVideo } from '@server/lib/user' import { isAbleToUploadVideo } from '@server/lib/user'
import { AccountModel } from '@server/models/account/account' import { AccountModel } from '@server/models/account/account'
import { MVideoWithAllFiles } from '@server/types/models' import { MVideoWithAllFiles } from '@server/types/models'
import { HttpStatusCode } from '@shared/models' import {
import { ServerErrorCode, UserRight, VideoChangeOwnershipAccept, VideoChangeOwnershipStatus, VideoState } from '@shared/models' HttpStatusCode,
ServerErrorCode,
UserRight,
VideoChangeOwnershipAccept,
VideoChangeOwnershipStatus,
VideoState
} from '@shared/models'
import { import {
areValidationErrors, areValidationErrors,
checkUserCanManageVideo, checkUserCanManageVideo,

View File

@ -4,8 +4,8 @@ import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { import {
cleanupTests, cleanupTests,
doubleFollow,
createMultipleServers, createMultipleServers,
doubleFollow,
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
wait, wait,

View File

@ -2,17 +2,16 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { HttpStatusCode } from '@shared/models'
import { import {
cleanupTests, cleanupTests,
doubleFollow,
createMultipleServers, createMultipleServers,
doubleFollow,
makeActivityPubGetRequest, makeActivityPubGetRequest,
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
setDefaultVideoChannel setDefaultVideoChannel
} from '@shared/extra-utils' } from '@shared/extra-utils'
import { VideoPlaylistPrivacy } from '@shared/models' import { HttpStatusCode, VideoPlaylistPrivacy } from '@shared/models'
const expect = chai.expect const expect = chai.expect

View File

@ -2,7 +2,7 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' 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 const expect = chai.expect

View File

@ -1,11 +1,10 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha' import 'mocha'
import { HttpStatusCode } from '@shared/models'
import { import {
cleanupTests, cleanupTests,
doubleFollow,
createMultipleServers, createMultipleServers,
doubleFollow,
killallServers, killallServers,
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
@ -13,7 +12,7 @@ import {
wait, wait,
waitJobs waitJobs
} from '@shared/extra-utils' } from '@shared/extra-utils'
import { VideoPlaylistPrivacy } from '@shared/models' import { HttpStatusCode, VideoPlaylistPrivacy } from '@shared/models'
describe('Test AP refresher', function () { describe('Test AP refresher', function () {
let servers: PeerTubeServer[] = [] let servers: PeerTubeServer[] = []

View File

@ -1,22 +1,21 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha' import 'mocha'
import { HttpStatusCode } from '@shared/models'
import { import {
AbusesCommand, AbusesCommand,
checkBadCountPagination, checkBadCountPagination,
checkBadSortPagination, checkBadSortPagination,
checkBadStartPagination, checkBadStartPagination,
cleanupTests, cleanupTests,
doubleFollow,
createSingleServer, createSingleServer,
doubleFollow,
makeGetRequest, makeGetRequest,
makePostBodyRequest, makePostBodyRequest,
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
waitJobs waitJobs
} from '@shared/extra-utils' } from '@shared/extra-utils'
import { AbuseCreate, AbuseState } from '@shared/models' import { AbuseCreate, AbuseState, HttpStatusCode } from '@shared/models'
describe('Test abuses API validators', function () { describe('Test abuses API validators', function () {
const basePath = '/api/v1/abuses/' const basePath = '/api/v1/abuses/'

View File

@ -1,7 +1,6 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha' import 'mocha'
import { HttpStatusCode } from '@shared/models'
import { import {
checkBadCountPagination, checkBadCountPagination,
checkBadSortPagination, checkBadSortPagination,
@ -10,6 +9,7 @@ import {
createSingleServer, createSingleServer,
PeerTubeServer PeerTubeServer
} from '@shared/extra-utils' } from '@shared/extra-utils'
import { HttpStatusCode } from '@shared/models'
describe('Test accounts API validators', function () { describe('Test accounts API validators', function () {
const path = '/api/v1/accounts/' const path = '/api/v1/accounts/'

View File

@ -2,7 +2,6 @@
import 'mocha' import 'mocha'
import { omit } from 'lodash' import { omit } from 'lodash'
import { HttpStatusCode } from '@shared/models'
import { import {
cleanupTests, cleanupTests,
createSingleServer, createSingleServer,
@ -12,7 +11,7 @@ import {
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers setAccessTokensToServers
} from '@shared/extra-utils' } from '@shared/extra-utils'
import { CustomConfig } from '@shared/models' import { CustomConfig, HttpStatusCode } from '@shared/models'
describe('Test config API validators', function () { describe('Test config API validators', function () {
const path = '/api/v1/config/custom' const path = '/api/v1/config/custom'

View File

@ -1,9 +1,9 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha' import 'mocha'
import { HttpStatusCode } from '@shared/models'
import { cleanupTests, createSingleServer, killallServers, MockSmtpServer, PeerTubeServer } from '@shared/extra-utils' import { cleanupTests, createSingleServer, killallServers, MockSmtpServer, PeerTubeServer } from '@shared/extra-utils'
import { ContactFormCommand } from '@shared/extra-utils/server' import { ContactFormCommand } from '@shared/extra-utils/server'
import { HttpStatusCode } from '@shared/models'
describe('Test contact form API validators', function () { describe('Test contact form API validators', function () {
let server: PeerTubeServer let server: PeerTubeServer

View File

@ -2,7 +2,6 @@
import 'mocha' import 'mocha'
import { omit } from 'lodash' import { omit } from 'lodash'
import { HttpStatusCode } from '@shared/models'
import { import {
buildAbsoluteFixturePath, buildAbsoluteFixturePath,
cleanupTests, cleanupTests,
@ -10,12 +9,12 @@ import {
LiveCommand, LiveCommand,
makePostBodyRequest, makePostBodyRequest,
makeUploadRequest, makeUploadRequest,
sendRTMPStream,
PeerTubeServer, PeerTubeServer,
sendRTMPStream,
setAccessTokensToServers, setAccessTokensToServers,
stopFfmpeg stopFfmpeg
} from '@shared/extra-utils' } from '@shared/extra-utils'
import { VideoCreateResult, VideoPrivacy } from '@shared/models' import { HttpStatusCode, VideoCreateResult, VideoPrivacy } from '@shared/models'
describe('Test video lives API validator', function () { describe('Test video lives API validator', function () {
const path = '/api/v1/videos/live' const path = '/api/v1/videos/live'

View File

@ -1,7 +1,6 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha' import 'mocha'
import { HttpStatusCode } from '@shared/models'
import { import {
checkBadCountPagination, checkBadCountPagination,
checkBadSortPagination, checkBadSortPagination,
@ -14,7 +13,7 @@ import {
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers setAccessTokensToServers
} from '@shared/extra-utils' } from '@shared/extra-utils'
import { PeerTubePlugin, PluginType } from '@shared/models' import { HttpStatusCode, PeerTubePlugin, PluginType } from '@shared/models'
describe('Test server plugins API validators', function () { describe('Test server plugins API validators', function () {
let server: PeerTubeServer let server: PeerTubeServer

View File

@ -1,7 +1,6 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha' import 'mocha'
import { HttpStatusCode } from '@shared/models'
import { import {
checkBadCountPagination, checkBadCountPagination,
checkBadSortPagination, checkBadSortPagination,
@ -12,6 +11,7 @@ import {
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers setAccessTokensToServers
} from '@shared/extra-utils' } from '@shared/extra-utils'
import { HttpStatusCode } from '@shared/models'
function updateSearchIndex (server: PeerTubeServer, enabled: boolean, disableLocalSearch = false) { function updateSearchIndex (server: PeerTubeServer, enabled: boolean, disableLocalSearch = false) {
return server.config.updateCustomSubConfig({ return server.config.updateCustomSubConfig({

View File

@ -1,7 +1,6 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha' import 'mocha'
import { HttpStatusCode } from '@shared/models'
import { import {
cleanupTests, cleanupTests,
createSingleServer, createSingleServer,
@ -10,7 +9,7 @@ import {
setAccessTokensToServers, setAccessTokensToServers,
setDefaultVideoChannel setDefaultVideoChannel
} from '@shared/extra-utils' } from '@shared/extra-utils'
import { VideoPlaylistPrivacy } from '@shared/models' import { HttpStatusCode, VideoPlaylistPrivacy } from '@shared/models'
describe('Test services API validators', function () { describe('Test services API validators', function () {
let server: PeerTubeServer let server: PeerTubeServer

View File

@ -2,7 +2,6 @@
import 'mocha' import 'mocha'
import { io } from 'socket.io-client' import { io } from 'socket.io-client'
import { HttpStatusCode } from '@shared/models'
import { import {
checkBadCountPagination, checkBadCountPagination,
checkBadSortPagination, checkBadSortPagination,
@ -16,7 +15,7 @@ import {
setAccessTokensToServers, setAccessTokensToServers,
wait wait
} from '@shared/extra-utils' } from '@shared/extra-utils'
import { UserNotificationSetting, UserNotificationSettingValue } from '@shared/models' import { HttpStatusCode, UserNotificationSetting, UserNotificationSettingValue } from '@shared/models'
describe('Test user notifications API validators', function () { describe('Test user notifications API validators', function () {
let server: PeerTubeServer let server: PeerTubeServer

View File

@ -2,7 +2,6 @@
import 'mocha' import 'mocha'
import { omit } from 'lodash' import { omit } from 'lodash'
import { HttpStatusCode } from '@shared/models'
import { import {
buildAbsoluteFixturePath, buildAbsoluteFixturePath,
checkBadCountPagination, checkBadCountPagination,
@ -20,7 +19,7 @@ import {
setAccessTokensToServers, setAccessTokensToServers,
UsersCommand UsersCommand
} from '@shared/extra-utils' } 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 () { describe('Test users API validators', function () {
const path = '/api/v1/users/' const path = '/api/v1/users/'

View File

@ -2,22 +2,21 @@
import 'mocha' import 'mocha'
import { expect } from 'chai' import { expect } from 'chai'
import { HttpStatusCode } from '@shared/models'
import { import {
BlacklistCommand, BlacklistCommand,
checkBadCountPagination, checkBadCountPagination,
checkBadSortPagination, checkBadSortPagination,
checkBadStartPagination, checkBadStartPagination,
cleanupTests, cleanupTests,
doubleFollow,
createMultipleServers, createMultipleServers,
doubleFollow,
makePostBodyRequest, makePostBodyRequest,
makePutBodyRequest, makePutBodyRequest,
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
waitJobs waitJobs
} from '@shared/extra-utils' } from '@shared/extra-utils'
import { VideoBlacklistType } from '@shared/models' import { HttpStatusCode, VideoBlacklistType } from '@shared/models'
describe('Test video blacklist API validators', function () { describe('Test video blacklist API validators', function () {
let servers: PeerTubeServer[] let servers: PeerTubeServer[]

View File

@ -1,7 +1,6 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha' import 'mocha'
import { HttpStatusCode } from '@shared/models'
import { import {
buildAbsoluteFixturePath, buildAbsoluteFixturePath,
cleanupTests, cleanupTests,
@ -12,7 +11,7 @@ import {
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers setAccessTokensToServers
} from '@shared/extra-utils' } from '@shared/extra-utils'
import { VideoCreateResult } from '@shared/models' import { HttpStatusCode, VideoCreateResult } from '@shared/models'
describe('Test video captions API validator', function () { describe('Test video captions API validator', function () {
const path = '/api/v1/videos/' const path = '/api/v1/videos/'

View File

@ -3,7 +3,6 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { omit } from 'lodash' import { omit } from 'lodash'
import { HttpStatusCode } from '@shared/models'
import { import {
buildAbsoluteFixturePath, buildAbsoluteFixturePath,
ChannelsCommand, ChannelsCommand,
@ -19,7 +18,7 @@ import {
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers setAccessTokensToServers
} from '@shared/extra-utils' } from '@shared/extra-utils'
import { VideoChannelUpdate } from '@shared/models' import { HttpStatusCode, VideoChannelUpdate } from '@shared/models'
const expect = chai.expect const expect = chai.expect

View File

@ -2,7 +2,6 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { HttpStatusCode } from '@shared/models'
import { import {
checkBadCountPagination, checkBadCountPagination,
checkBadSortPagination, checkBadSortPagination,
@ -15,7 +14,7 @@ import {
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers setAccessTokensToServers
} from '@shared/extra-utils' } from '@shared/extra-utils'
import { VideoCreateResult } from '@shared/models' import { HttpStatusCode, VideoCreateResult } from '@shared/models'
const expect = chai.expect const expect = chai.expect

View File

@ -2,7 +2,6 @@
import 'mocha' import 'mocha'
import { omit } from 'lodash' import { omit } from 'lodash'
import { HttpStatusCode } from '@shared/models'
import { import {
buildAbsoluteFixturePath, buildAbsoluteFixturePath,
checkBadCountPagination, checkBadCountPagination,
@ -17,7 +16,7 @@ import {
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers setAccessTokensToServers
} from '@shared/extra-utils' } from '@shared/extra-utils'
import { VideoPrivacy } from '@shared/models' import { HttpStatusCode, VideoPrivacy } from '@shared/models'
describe('Test video imports API validator', function () { describe('Test video imports API validator', function () {
const path = '/api/v1/videos/imports' const path = '/api/v1/videos/imports'

View File

@ -1,7 +1,6 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha' import 'mocha'
import { HttpStatusCode } from '@shared/models'
import { import {
checkBadCountPagination, checkBadCountPagination,
checkBadSortPagination, checkBadSortPagination,
@ -9,12 +8,13 @@ import {
cleanupTests, cleanupTests,
createSingleServer, createSingleServer,
makeGetRequest, makeGetRequest,
PlaylistsCommand,
PeerTubeServer, PeerTubeServer,
PlaylistsCommand,
setAccessTokensToServers, setAccessTokensToServers,
setDefaultVideoChannel setDefaultVideoChannel
} from '@shared/extra-utils' } from '@shared/extra-utils'
import { import {
HttpStatusCode,
VideoPlaylistCreate, VideoPlaylistCreate,
VideoPlaylistCreateResult, VideoPlaylistCreateResult,
VideoPlaylistElementCreate, VideoPlaylistElementCreate,

View File

@ -1,7 +1,6 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha' import 'mocha'
import { HttpStatusCode } from '@shared/models'
import { import {
cleanupTests, cleanupTests,
createSingleServer, createSingleServer,
@ -10,7 +9,7 @@ import {
setAccessTokensToServers, setAccessTokensToServers,
setDefaultVideoChannel setDefaultVideoChannel
} from '@shared/extra-utils' } 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) { async function testEndpoints (server: PeerTubeServer, token: string, filter: string, expectedStatus: HttpStatusCode) {
const paths = [ const paths = [

View File

@ -1,7 +1,6 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import 'mocha' import 'mocha'
import { HttpStatusCode } from '@shared/models'
import { import {
checkBadCountPagination, checkBadCountPagination,
checkBadStartPagination, checkBadStartPagination,
@ -13,6 +12,7 @@ import {
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers setAccessTokensToServers
} from '@shared/extra-utils' } from '@shared/extra-utils'
import { HttpStatusCode } from '@shared/models'
describe('Test videos history API validator', function () { describe('Test videos history API validator', function () {
const myHistoryPath = '/api/v1/users/me/history/videos' const myHistoryPath = '/api/v1/users/me/history/videos'

View File

@ -7,8 +7,8 @@ import {
checkLiveCleanup, checkLiveCleanup,
cleanupTests, cleanupTests,
ConfigCommand, ConfigCommand,
doubleFollow,
createMultipleServers, createMultipleServers,
doubleFollow,
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
setDefaultVideoChannel, setDefaultVideoChannel,

View File

@ -6,8 +6,8 @@ import { LiveVideoCreate, VideoPrivacy, VideoState } from '@shared/models'
import { import {
cleanupTests, cleanupTests,
ConfigCommand, ConfigCommand,
doubleFollow,
createMultipleServers, createMultipleServers,
doubleFollow,
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
setDefaultVideoChannel, setDefaultVideoChannel,

View File

@ -3,13 +3,12 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { FfmpegCommand } from 'fluent-ffmpeg' import { FfmpegCommand } from 'fluent-ffmpeg'
import { HttpStatusCode } from '@shared/models'
import { import {
checkLiveCleanup, checkLiveCleanup,
cleanupTests, cleanupTests,
ConfigCommand, ConfigCommand,
doubleFollow,
createMultipleServers, createMultipleServers,
doubleFollow,
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
setDefaultVideoChannel, setDefaultVideoChannel,
@ -18,7 +17,7 @@ import {
wait, wait,
waitJobs waitJobs
} from '@shared/extra-utils' } from '@shared/extra-utils'
import { LiveVideoCreate, VideoPrivacy, VideoState } from '@shared/models' import { HttpStatusCode, LiveVideoCreate, VideoPrivacy, VideoState } from '@shared/models'
const expect = chai.expect const expect = chai.expect

View File

@ -5,8 +5,8 @@ import * as chai from 'chai'
import { VideoPrivacy, VideoState } from '@shared/models' import { VideoPrivacy, VideoState } from '@shared/models'
import { import {
cleanupTests, cleanupTests,
doubleFollow,
createMultipleServers, createMultipleServers,
doubleFollow,
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
setDefaultVideoChannel, setDefaultVideoChannel,

View File

@ -6,8 +6,8 @@ import { FfmpegCommand } from 'fluent-ffmpeg'
import { VideoPrivacy } from '@shared/models' import { VideoPrivacy } from '@shared/models'
import { import {
cleanupTests, cleanupTests,
doubleFollow,
createMultipleServers, createMultipleServers,
doubleFollow,
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
setDefaultVideoChannel, setDefaultVideoChannel,

View File

@ -4,19 +4,18 @@ import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { join } from 'path' import { join } from 'path'
import { ffprobePromise, getVideoStreamFromFile } from '@server/helpers/ffprobe-utils' import { ffprobePromise, getVideoStreamFromFile } from '@server/helpers/ffprobe-utils'
import { HttpStatusCode } from '@shared/models'
import { import {
checkLiveCleanup, checkLiveCleanup,
checkLiveSegmentHash, checkLiveSegmentHash,
checkResolutionsInMasterPlaylist, checkResolutionsInMasterPlaylist,
cleanupTests, cleanupTests,
doubleFollow,
createMultipleServers, createMultipleServers,
doubleFollow,
killallServers, killallServers,
LiveCommand, LiveCommand,
makeRawRequest, makeRawRequest,
sendRTMPStream,
PeerTubeServer, PeerTubeServer,
sendRTMPStream,
setAccessTokensToServers, setAccessTokensToServers,
setDefaultVideoChannel, setDefaultVideoChannel,
stopFfmpeg, stopFfmpeg,
@ -26,7 +25,15 @@ import {
waitJobs, waitJobs,
waitUntilLivePublishedOnAllServers waitUntilLivePublishedOnAllServers
} from '@shared/extra-utils' } 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 const expect = chai.expect

View File

@ -2,7 +2,7 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' 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' import { UserNotificationType } from '@shared/models'
const expect = chai.expect const expect = chai.expect

View File

@ -6,8 +6,8 @@ import {
BlocklistCommand, BlocklistCommand,
cleanupTests, cleanupTests,
CommentsCommand, CommentsCommand,
doubleFollow,
createMultipleServers, createMultipleServers,
doubleFollow,
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
waitJobs waitJobs

View File

@ -9,8 +9,8 @@ import {
cleanupTests, cleanupTests,
MockJoinPeerTubeVersions, MockJoinPeerTubeVersions,
MockSmtpServer, MockSmtpServer,
prepareNotificationsTest,
PeerTubeServer, PeerTubeServer,
prepareNotificationsTest,
wait wait
} from '@shared/extra-utils' } from '@shared/extra-utils'
import { PluginType, UserNotification, UserNotificationType } from '@shared/models' import { PluginType, UserNotification, UserNotificationType } from '@shared/models'

View File

@ -8,8 +8,8 @@ import {
checkNewCommentOnMyVideo, checkNewCommentOnMyVideo,
cleanupTests, cleanupTests,
MockSmtpServer, MockSmtpServer,
prepareNotificationsTest,
PeerTubeServer, PeerTubeServer,
prepareNotificationsTest,
waitJobs waitJobs
} from '@shared/extra-utils' } from '@shared/extra-utils'
import { UserNotification } from '@shared/models' import { UserNotification } from '@shared/models'

View File

@ -19,8 +19,8 @@ import {
cleanupTests, cleanupTests,
MockInstancesIndex, MockInstancesIndex,
MockSmtpServer, MockSmtpServer,
prepareNotificationsTest,
PeerTubeServer, PeerTubeServer,
prepareNotificationsTest,
wait, wait,
waitJobs waitJobs
} from '@shared/extra-utils' } from '@shared/extra-utils'

View File

@ -8,8 +8,8 @@ import {
cleanupTests, cleanupTests,
getAllNotificationsSettings, getAllNotificationsSettings,
MockSmtpServer, MockSmtpServer,
prepareNotificationsTest,
PeerTubeServer, PeerTubeServer,
prepareNotificationsTest,
waitJobs waitJobs
} from '@shared/extra-utils' } from '@shared/extra-utils'
import { UserNotification, UserNotificationSettingValue } from '@shared/models' import { UserNotification, UserNotificationSettingValue } from '@shared/models'

View File

@ -4,10 +4,10 @@ import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { import {
cleanupTests, cleanupTests,
doubleFollow,
createMultipleServers, createMultipleServers,
RedundancyCommand, doubleFollow,
PeerTubeServer, PeerTubeServer,
RedundancyCommand,
setAccessTokensToServers, setAccessTokensToServers,
waitJobs waitJobs
} from '@shared/extra-utils' } from '@shared/extra-utils'

View File

@ -2,14 +2,7 @@
import 'mocha' import 'mocha'
import { expect } from 'chai' import { expect } from 'chai'
import { import { cleanupTests, createSingleServer, killallServers, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
cleanupTests,
createSingleServer,
killallServers,
PeerTubeServer,
setAccessTokensToServers,
waitJobs
} from '@shared/extra-utils'
import { VideoPrivacy } from '@shared/models' import { VideoPrivacy } from '@shared/models'
describe('Test redundancy constraints', function () { describe('Test redundancy constraints', function () {

View File

@ -5,22 +5,21 @@ import * as chai from 'chai'
import { readdir } from 'fs-extra' import { readdir } from 'fs-extra'
import * as magnetUtil from 'magnet-uri' import * as magnetUtil from 'magnet-uri'
import { join } from 'path' import { join } from 'path'
import { HttpStatusCode } from '@shared/models'
import { import {
checkSegmentHash, checkSegmentHash,
checkVideoFilesWereRemoved, checkVideoFilesWereRemoved,
cleanupTests, cleanupTests,
doubleFollow,
createMultipleServers, createMultipleServers,
doubleFollow,
killallServers, killallServers,
makeGetRequest, makeGetRequest,
root,
PeerTubeServer, PeerTubeServer,
root,
setAccessTokensToServers, setAccessTokensToServers,
wait, wait,
waitJobs waitJobs
} from '@shared/extra-utils' } from '@shared/extra-utils'
import { VideoPrivacy, VideoRedundancyStrategy, VideoRedundancyStrategyWithManual } from '@shared/models' import { HttpStatusCode, VideoPrivacy, VideoRedundancyStrategy, VideoRedundancyStrategyWithManual } from '@shared/models'
const expect = chai.expect const expect = chai.expect

View File

@ -5,8 +5,8 @@ import * as chai from 'chai'
import { import {
cleanupTests, cleanupTests,
createMultipleServers, createMultipleServers,
SearchCommand,
PeerTubeServer, PeerTubeServer,
SearchCommand,
setAccessTokensToServers, setAccessTokensToServers,
wait, wait,
waitJobs waitJobs

View File

@ -5,8 +5,8 @@ import * as chai from 'chai'
import { import {
cleanupTests, cleanupTests,
createMultipleServers, createMultipleServers,
SearchCommand,
PeerTubeServer, PeerTubeServer,
SearchCommand,
setAccessTokensToServers, setAccessTokensToServers,
setDefaultVideoChannel, setDefaultVideoChannel,
wait, wait,

View File

@ -5,8 +5,8 @@ import * as chai from 'chai'
import { import {
cleanupTests, cleanupTests,
createMultipleServers, createMultipleServers,
SearchCommand,
PeerTubeServer, PeerTubeServer,
SearchCommand,
setAccessTokensToServers, setAccessTokensToServers,
wait, wait,
waitJobs waitJobs

View File

@ -2,7 +2,7 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' 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' import { VideoChannel } from '@shared/models'
const expect = chai.expect const expect = chai.expect

View File

@ -2,7 +2,7 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' 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' import { BooleanBothQuery, VideoPlaylistPrivacy, VideoPlaylistType, VideosSearchQuery } from '@shared/models'
const expect = chai.expect const expect = chai.expect

View File

@ -5,8 +5,8 @@ import * as chai from 'chai'
import { import {
cleanupTests, cleanupTests,
createSingleServer, createSingleServer,
SearchCommand,
PeerTubeServer, PeerTubeServer,
SearchCommand,
setAccessTokensToServers, setAccessTokensToServers,
setDefaultVideoChannel setDefaultVideoChannel
} from '@shared/extra-utils' } from '@shared/extra-utils'

View File

@ -5,8 +5,8 @@ import * as chai from 'chai'
import { import {
cleanupTests, cleanupTests,
createSingleServer, createSingleServer,
SearchCommand,
PeerTubeServer, PeerTubeServer,
SearchCommand,
setAccessTokensToServers, setAccessTokensToServers,
setDefaultVideoChannel, setDefaultVideoChannel,
stopFfmpeg, stopFfmpeg,

View File

@ -5,8 +5,8 @@ import * as chai from 'chai'
import { import {
BulkCommand, BulkCommand,
cleanupTests, cleanupTests,
doubleFollow,
createMultipleServers, createMultipleServers,
doubleFollow,
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
waitJobs waitJobs

View File

@ -2,7 +2,6 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { HttpStatusCode } from '@shared/models'
import { import {
cleanupTests, cleanupTests,
createSingleServer, createSingleServer,
@ -12,7 +11,7 @@ import {
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers setAccessTokensToServers
} from '@shared/extra-utils' } from '@shared/extra-utils'
import { CustomConfig } from '@shared/models' import { CustomConfig, HttpStatusCode } from '@shared/models'
const expect = chai.expect const expect = chai.expect

View File

@ -2,7 +2,6 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { HttpStatusCode } from '@shared/models'
import { import {
cleanupTests, cleanupTests,
ContactFormCommand, ContactFormCommand,
@ -13,6 +12,7 @@ import {
wait, wait,
waitJobs waitJobs
} from '@shared/extra-utils' } from '@shared/extra-utils'
import { HttpStatusCode } from '@shared/models'
const expect = chai.expect const expect = chai.expect

View File

@ -2,8 +2,8 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { HttpStatusCode } from '@shared/models'
import { cleanupTests, createSingleServer, MockSmtpServer, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' import { cleanupTests, createSingleServer, MockSmtpServer, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
import { HttpStatusCode } from '@shared/models'
const expect = chai.expect const expect = chai.expect

View File

@ -2,9 +2,8 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { HttpStatusCode } from '@shared/models' import { cleanupTests, createMultipleServers, doubleFollow, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils'
import { cleanupTests, doubleFollow, createMultipleServers, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils' import { HttpStatusCode, PeerTubeProblemDocument, ServerErrorCode } from '@shared/models'
import { PeerTubeProblemDocument, ServerErrorCode } from '@shared/models'
const expect = chai.expect const expect = chai.expect
@ -157,7 +156,7 @@ describe('Test follow constraints', function () {
it('Should list local account videos', async function () { it('Should list local account videos', async function () {
const { total, data } = await servers[0].videos.listByAccount({ const { total, data } = await servers[0].videos.listByAccount({
token: undefined, token: null,
handle: 'root@localhost:' + servers[0].port handle: 'root@localhost:' + servers[0].port
}) })
@ -167,7 +166,7 @@ describe('Test follow constraints', function () {
it('Should not list remote account videos', async function () { it('Should not list remote account videos', async function () {
const { total, data } = await servers[0].videos.listByAccount({ const { total, data } = await servers[0].videos.listByAccount({
token: undefined, token: null,
handle: 'root@localhost:' + servers[1].port handle: 'root@localhost:' + servers[1].port
}) })
@ -177,7 +176,7 @@ describe('Test follow constraints', function () {
it('Should list local channel videos', async function () { it('Should list local channel videos', async function () {
const handle = 'root_channel@localhost:' + servers[0].port 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(total).to.equal(1)
expect(data).to.have.lengthOf(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 () { it('Should not list remote channel videos', async function () {
const handle = 'root_channel@localhost:' + servers[1].port 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(total).to.equal(0)
expect(data).to.have.lengthOf(0) expect(data).to.have.lengthOf(0)

View File

@ -5,9 +5,9 @@ import * as chai from 'chai'
import { import {
cleanupTests, cleanupTests,
completeVideoCheck, completeVideoCheck,
createMultipleServers,
dateIsValid, dateIsValid,
expectAccountFollows, expectAccountFollows,
createMultipleServers,
FollowsCommand, FollowsCommand,
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,

View File

@ -2,7 +2,6 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { HttpStatusCode } from '@shared/models'
import { import {
cleanupTests, cleanupTests,
CommentsCommand, CommentsCommand,
@ -14,7 +13,7 @@ import {
wait, wait,
waitJobs waitJobs
} from '@shared/extra-utils' } from '@shared/extra-utils'
import { JobState, VideoCreateResult, VideoPrivacy } from '@shared/models' import { HttpStatusCode, JobState, VideoCreateResult, VideoPrivacy } from '@shared/models'
const expect = chai.expect const expect = chai.expect

View File

@ -5,8 +5,8 @@ import * as chai from 'chai'
import { HttpStatusCode } from '@shared/models' import { HttpStatusCode } from '@shared/models'
import { import {
cleanupTests, cleanupTests,
CustomPagesCommand,
createSingleServer, createSingleServer,
CustomPagesCommand,
killallServers, killallServers,
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers setAccessTokensToServers

View File

@ -4,9 +4,9 @@ import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { import {
cleanupTests, cleanupTests,
createMultipleServers,
dateIsValid, dateIsValid,
doubleFollow, doubleFollow,
createMultipleServers,
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
waitJobs waitJobs

View File

@ -2,18 +2,17 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { HttpStatusCode } from '@shared/models'
import { import {
cleanupTests, cleanupTests,
createSingleServer, createSingleServer,
killallServers, killallServers,
PluginsCommand,
PeerTubeServer, PeerTubeServer,
PluginsCommand,
setAccessTokensToServers, setAccessTokensToServers,
testHelloWorldRegisteredSettings, testHelloWorldRegisteredSettings,
wait wait
} from '@shared/extra-utils' } from '@shared/extra-utils'
import { PluginType } from '@shared/models' import { HttpStatusCode, PluginType } from '@shared/models'
const expect = chai.expect const expect = chai.expect

View File

@ -1,8 +1,8 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import { expect } from 'chai' import { expect } from 'chai'
import { HttpStatusCode } from '@shared/models'
import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers, wait } from '@shared/extra-utils' import { cleanupTests, createSingleServer, PeerTubeServer, setAccessTokensToServers, wait } from '@shared/extra-utils'
import { HttpStatusCode } from '@shared/models'
describe('Test application behind a reverse proxy', function () { describe('Test application behind a reverse proxy', function () {
let server: PeerTubeServer let server: PeerTubeServer

View File

@ -4,8 +4,8 @@ import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { import {
cleanupTests, cleanupTests,
doubleFollow,
createMultipleServers, createMultipleServers,
doubleFollow,
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
wait, wait,

View File

@ -4,8 +4,8 @@ import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { import {
cleanupTests, cleanupTests,
doubleFollow,
createMultipleServers, createMultipleServers,
doubleFollow,
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
SubscriptionsCommand, SubscriptionsCommand,
@ -67,7 +67,8 @@ describe('Test users subscriptions', function () {
await waitJobs(servers) 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 video3UUID = uuid
await waitJobs(servers) await waitJobs(servers)

View File

@ -7,8 +7,8 @@ import {
checkTmpIsEmpty, checkTmpIsEmpty,
checkVideoFilesWereRemoved, checkVideoFilesWereRemoved,
cleanupTests, cleanupTests,
doubleFollow,
createMultipleServers, createMultipleServers,
doubleFollow,
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
testImage, testImage,

View File

@ -2,8 +2,8 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { HttpStatusCode } from '@shared/models'
import { cleanupTests, createSingleServer, MockSmtpServer, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils' import { cleanupTests, createSingleServer, MockSmtpServer, PeerTubeServer, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
import { HttpStatusCode } from '@shared/models'
const expect = chai.expect const expect = chai.expect

View File

@ -2,7 +2,6 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { HttpStatusCode } from '@shared/models'
import { import {
cleanupTests, cleanupTests,
createSingleServer, createSingleServer,
@ -13,7 +12,7 @@ import {
testImage, testImage,
waitJobs waitJobs
} from '@shared/extra-utils' } 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 const expect = chai.expect

View File

@ -4,7 +4,7 @@ import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { join } from 'path' import { join } from 'path'
import { getAudioStream, getVideoStreamSize } from '@server/helpers/ffprobe-utils' 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 const expect = chai.expect

View File

@ -3,16 +3,15 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import * as request from 'supertest' import * as request from 'supertest'
import { HttpStatusCode } from '@shared/models'
import { import {
buildAbsoluteFixturePath, buildAbsoluteFixturePath,
checkTmpIsEmpty, checkTmpIsEmpty,
checkVideoFilesWereRemoved, checkVideoFilesWereRemoved,
cleanupTests, cleanupTests,
completeVideoCheck, completeVideoCheck,
createMultipleServers,
dateIsValid, dateIsValid,
doubleFollow, doubleFollow,
createMultipleServers,
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
testImage, testImage,
@ -20,7 +19,7 @@ import {
waitJobs, waitJobs,
webtorrentAdd webtorrentAdd
} from '@shared/extra-utils' } from '@shared/extra-utils'
import { VideoCommentThreadTree, VideoPrivacy } from '@shared/models' import { HttpStatusCode, VideoCommentThreadTree, VideoPrivacy } from '@shared/models'
const expect = chai.expect const expect = chai.expect

View File

@ -4,7 +4,6 @@ import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { pathExists, readdir, stat } from 'fs-extra' import { pathExists, readdir, stat } from 'fs-extra'
import { join } from 'path' import { join } from 'path'
import { HttpStatusCode } from '@shared/models'
import { import {
buildAbsoluteFixturePath, buildAbsoluteFixturePath,
cleanupTests, cleanupTests,
@ -13,7 +12,7 @@ import {
setAccessTokensToServers, setAccessTokensToServers,
setDefaultVideoChannel setDefaultVideoChannel
} from '@shared/extra-utils' } from '@shared/extra-utils'
import { VideoPrivacy } from '@shared/models' import { HttpStatusCode, VideoPrivacy } from '@shared/models'
const expect = chai.expect const expect = chai.expect

View File

@ -5,8 +5,8 @@ import * as chai from 'chai'
import { import {
checkVideoFilesWereRemoved, checkVideoFilesWereRemoved,
cleanupTests, cleanupTests,
doubleFollow,
createMultipleServers, createMultipleServers,
doubleFollow,
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
testCaptionFile, testCaptionFile,

View File

@ -2,19 +2,18 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { HttpStatusCode } from '@shared/models'
import { import {
ChangeOwnershipCommand, ChangeOwnershipCommand,
cleanupTests, cleanupTests,
doubleFollow,
createMultipleServers, createMultipleServers,
createSingleServer, createSingleServer,
doubleFollow,
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
setDefaultVideoChannel, setDefaultVideoChannel,
waitJobs waitJobs
} from '@shared/extra-utils' } from '@shared/extra-utils'
import { VideoPrivacy } from '@shared/models' import { HttpStatusCode, VideoPrivacy } from '@shared/models'
const expect = chai.expect const expect = chai.expect

View File

@ -6,8 +6,8 @@ import { basename } from 'path'
import { ACTOR_IMAGES_SIZE } from '@server/initializers/constants' import { ACTOR_IMAGES_SIZE } from '@server/initializers/constants'
import { import {
cleanupTests, cleanupTests,
doubleFollow,
createMultipleServers, createMultipleServers,
doubleFollow,
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
setDefaultVideoChannel, setDefaultVideoChannel,

View File

@ -5,8 +5,8 @@ import * as chai from 'chai'
import { import {
cleanupTests, cleanupTests,
CommentsCommand, CommentsCommand,
dateIsValid,
createSingleServer, createSingleServer,
dateIsValid,
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
testImage testImage

View File

@ -2,7 +2,7 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' 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 const expect = chai.expect

View File

@ -3,22 +3,21 @@
import 'mocha' import 'mocha'
import * as chai from 'chai' import * as chai from 'chai'
import { join } from 'path' import { join } from 'path'
import { HttpStatusCode } from '@shared/models'
import { import {
checkDirectoryIsEmpty, checkDirectoryIsEmpty,
checkResolutionsInMasterPlaylist, checkResolutionsInMasterPlaylist,
checkSegmentHash, checkSegmentHash,
checkTmpIsEmpty, checkTmpIsEmpty,
cleanupTests, cleanupTests,
doubleFollow,
createMultipleServers, createMultipleServers,
doubleFollow,
makeRawRequest, makeRawRequest,
PeerTubeServer, PeerTubeServer,
setAccessTokensToServers, setAccessTokensToServers,
waitJobs, waitJobs,
webtorrentAdd webtorrentAdd
} from '@shared/extra-utils' } from '@shared/extra-utils'
import { VideoStreamingPlaylistType } from '@shared/models' import { HttpStatusCode, VideoStreamingPlaylistType } from '@shared/models'
import { DEFAULT_AUDIO_RESOLUTION } from '../../../initializers/constants' import { DEFAULT_AUDIO_RESOLUTION } from '../../../initializers/constants'
const expect = chai.expect const expect = chai.expect

View File

@ -30,8 +30,8 @@ describe('Test video NSFW policy', function () {
promises = [ promises = [
server.search.advancedVideoSearch({ token, search: { search: 'n', sort: '-publishedAt', ...query } }), server.search.advancedVideoSearch({ token, search: { search: 'n', sort: '-publishedAt', ...query } }),
server.videos.listWithToken({ token, ...query }), server.videos.listWithToken({ token, ...query }),
server.videos.listByAccount({ token, handle: channelName, ...query }), server.videos.listByAccount({ token, handle: accountName, ...query }),
server.videos.listByChannel({ token, handle: accountName, ...query }) server.videos.listByChannel({ token, handle: channelName, ...query })
] ]
// Overviews do not support video filters // Overviews do not support video filters
@ -47,8 +47,8 @@ describe('Test video NSFW policy', function () {
promises = [ promises = [
server.search.searchVideos({ search: 'n', sort: '-publishedAt' }), server.search.searchVideos({ search: 'n', sort: '-publishedAt' }),
server.videos.list(), server.videos.list(),
server.videos.listByAccount({ handle: channelName }), server.videos.listByAccount({ token: null, handle: accountName }),
server.videos.listByChannel({ handle: accountName }) server.videos.listByChannel({ token: null, handle: channelName })
] ]
// Overviews do not support video filters // Overviews do not support video filters
@ -82,6 +82,7 @@ describe('Test video NSFW policy', function () {
}) })
describe('Instance default NSFW policy', function () { describe('Instance default NSFW policy', function () {
it('Should display NSFW videos with display default NSFW policy', async function () { it('Should display NSFW videos with display default NSFW policy', async function () {
const serverConfig = await server.config.getConfig() const serverConfig = await server.config.getConfig()
expect(serverConfig.instance.defaultNSFWPolicy).to.equal('display') expect(serverConfig.instance.defaultNSFWPolicy).to.equal('display')

Some files were not shown because too many files have changed in this diff Show More