1
0
Fork 0

Fix shared imports

This commit is contained in:
Chocobozzz 2021-12-24 10:14:47 +01:00
parent 1e9c1b1b44
commit d17c7b4e8c
No known key found for this signature in database
GPG key ID: 583A612D890159BE
41 changed files with 78 additions and 96 deletions

View file

@ -1,6 +1,6 @@
import express from 'express' import express from 'express'
import { InboxManager } from '@server/lib/activitypub/inbox-manager' import { InboxManager } from '@server/lib/activitypub/inbox-manager'
import { Activity, ActivityPubCollection, ActivityPubOrderedCollection, RootActivity } from '../../../shared' import { Activity, ActivityPubCollection, ActivityPubOrderedCollection, RootActivity } from '@shared/models'
import { HttpStatusCode } from '../../../shared/models/http/http-error-codes' import { HttpStatusCode } from '../../../shared/models/http/http-error-codes'
import { isActivityValid } from '../../helpers/custom-validators/activitypub/activity' import { isActivityValid } from '../../helpers/custom-validators/activitypub/activity'
import { logger } from '../../helpers/logger' import { logger } from '../../helpers/logger'

View file

@ -6,8 +6,7 @@ import { AbuseModel } from '@server/models/abuse/abuse'
import { AbuseMessageModel } from '@server/models/abuse/abuse-message' import { AbuseMessageModel } from '@server/models/abuse/abuse-message'
import { getServerActor } from '@server/models/application/application' import { getServerActor } from '@server/models/application/application'
import { abusePredefinedReasonsMap } from '@shared/core-utils/abuse' import { abusePredefinedReasonsMap } from '@shared/core-utils/abuse'
import { HttpStatusCode } from '@shared/models' import { AbuseCreate, AbuseState, HttpStatusCode, UserRight } from '@shared/models'
import { AbuseCreate, AbuseState, UserRight } from '../../../shared'
import { getFormattedObjects } from '../../helpers/utils' import { getFormattedObjects } from '../../helpers/utils'
import { sequelizeTypescript } from '../../initializers/database' import { sequelizeTypescript } from '../../initializers/database'
import { import {

View file

@ -3,9 +3,7 @@ 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 { ServerConfigManager } from '@server/lib/server-config-manager'
import { UserRight } from '../../../shared' import { About, CustomConfig, UserRight } from '@shared/models'
import { About } from '../../../shared/models/server/about.model'
import { CustomConfig } from '../../../shared/models/server/custom-config.model'
import { auditLoggerFactory, CustomConfigAuditView, getAuditIdFromRes } from '../../helpers/audit-logger' import { auditLoggerFactory, CustomConfigAuditView, getAuditIdFromRes } from '../../helpers/audit-logger'
import { objectConverter } from '../../helpers/core-utils' import { objectConverter } from '../../helpers/core-utils'
import { CONFIG, reloadConfig } from '../../initializers/config' import { CONFIG, reloadConfig } from '../../initializers/config'

View file

@ -1,7 +1,5 @@
import express from 'express' import express from 'express'
import { ResultList } from '../../../shared' import { Job, JobState, JobType, ResultList, UserRight } from '@shared/models'
import { Job, JobState, JobType } from '../../../shared/models'
import { UserRight } from '../../../shared/models/users'
import { isArray } from '../../helpers/custom-validators/misc' import { isArray } from '../../helpers/custom-validators/misc'
import { JobQueue } from '../../lib/job-queue' import { JobQueue } from '../../lib/job-queue'
import { import {

View file

@ -1,10 +1,9 @@
import express from 'express' import express from 'express'
import { OAuthClientLocal } from '../../../shared' import { OAuthClientModel } from '@server/models/oauth/oauth-client'
import { HttpStatusCode } from '../../../shared/models/http/http-error-codes' import { HttpStatusCode, OAuthClientLocal } from '@shared/models'
import { logger } from '../../helpers/logger' import { logger } from '../../helpers/logger'
import { CONFIG } from '../../initializers/config' import { CONFIG } from '../../initializers/config'
import { asyncMiddleware, openapiOperationDoc } from '../../middlewares' import { asyncMiddleware, openapiOperationDoc } from '../../middlewares'
import { OAuthClientModel } from '../../models/oauth/oauth-client'
const oauthClientsRouter = express.Router() const oauthClientsRouter = express.Router()

View file

@ -4,10 +4,7 @@ import { tokensRouter } from '@server/controllers/api/users/token'
import { Hooks } from '@server/lib/plugins/hooks' import { Hooks } from '@server/lib/plugins/hooks'
import { OAuthTokenModel } from '@server/models/oauth/oauth-token' import { OAuthTokenModel } from '@server/models/oauth/oauth-token'
import { MUser, MUserAccountDefault } from '@server/types/models' import { MUser, MUserAccountDefault } from '@server/types/models'
import { UserCreate, UserCreateResult, UserRight, UserRole, UserUpdate } from '../../../../shared' import { HttpStatusCode, UserAdminFlag, UserCreate, UserCreateResult, UserRegister, UserRight, UserRole, UserUpdate } from '@shared/models'
import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
import { UserAdminFlag } from '../../../../shared/models/users/user-flag.model'
import { UserRegister } from '../../../../shared/models/users/user-register.model'
import { auditLoggerFactory, getAuditIdFromRes, UserAuditView } from '../../../helpers/audit-logger' import { auditLoggerFactory, getAuditIdFromRes, UserAuditView } from '../../../helpers/audit-logger'
import { logger } from '../../../helpers/logger' import { logger } from '../../../helpers/logger'
import { generateRandomString, getFormattedObjects } from '../../../helpers/utils' import { generateRandomString, getFormattedObjects } from '../../../helpers/utils'
@ -210,7 +207,7 @@ async function createUser (req: express.Request, res: express.Response) {
logger.info('Sending to user %s a create password email', body.username) logger.info('Sending to user %s a create password email', body.username)
const verificationString = await Redis.Instance.setCreatePasswordVerificationString(user.id) const verificationString = await Redis.Instance.setCreatePasswordVerificationString(user.id)
const url = WEBSERVER.URL + '/reset-password?userId=' + user.id + '&verificationString=' + verificationString const url = WEBSERVER.URL + '/reset-password?userId=' + user.id + '&verificationString=' + verificationString
await Emailer.Instance.addPasswordCreateEmailJob(userToCreate.username, user.email, url) Emailer.Instance.addPasswordCreateEmailJob(userToCreate.username, user.email, url)
} }
Hooks.runAction('action:api.user.created', { body, user, account, videoChannel, req, res }) Hooks.runAction('action:api.user.created', { body, user, account, videoChannel, req, res })

View file

@ -2,10 +2,8 @@ import 'multer'
import express from 'express' import 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 { ActorImageType, HttpStatusCode, UserUpdateMe, UserVideoQuota, UserVideoRate as FormattedUserVideoRate } from '@shared/models'
import { AttributesOnly } from '@shared/typescript-utils' import { AttributesOnly } from '@shared/typescript-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'
import { createReqFiles } from '../../../helpers/express-utils' import { createReqFiles } from '../../../helpers/express-utils'
import { getFormattedObjects } from '../../../helpers/utils' import { getFormattedObjects } from '../../../helpers/utils'
import { CONFIG } from '../../../initializers/config' import { CONFIG } from '../../../initializers/config'

View file

@ -5,8 +5,7 @@ import { ActorFollowModel } from '@server/models/actor/actor-follow'
import { getServerActor } from '@server/models/application/application' import { getServerActor } from '@server/models/application/application'
import { guessAdditionalAttributesFromQuery } from '@server/models/video/formatter/video-format-utils' import { guessAdditionalAttributesFromQuery } from '@server/models/video/formatter/video-format-utils'
import { MChannelBannerAccountDefault } from '@server/types/models' import { MChannelBannerAccountDefault } from '@server/types/models'
import { ActorImageType, VideoChannelCreate, VideoChannelUpdate } from '../../../shared' import { ActorImageType, HttpStatusCode, VideoChannelCreate, VideoChannelUpdate } from '@shared/models'
import { HttpStatusCode } from '../../../shared/models/http/http-error-codes'
import { auditLoggerFactory, getAuditIdFromRes, VideoChannelAuditView } from '../../helpers/audit-logger' import { auditLoggerFactory, getAuditIdFromRes, VideoChannelAuditView } from '../../helpers/audit-logger'
import { resetSequelizeInstance } from '../../helpers/database-utils' import { resetSequelizeInstance } from '../../helpers/database-utils'
import { buildNSFWFilter, createReqFiles, getCountVideos, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils' import { buildNSFWFilter, createReqFiles, getCountVideos, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils'

View file

@ -1,7 +1,6 @@
import express from 'express' import 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 { HttpStatusCode, UserRight, VideoBlacklistCreate } from '@shared/models'
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'

View file

@ -4,6 +4,7 @@ import { decode } from 'magnet-uri'
import parseTorrent, { Instance } from 'parse-torrent' import parseTorrent, { Instance } from 'parse-torrent'
import { join } from 'path' import { join } from 'path'
import { isVideoFileExtnameValid } from '@server/helpers/custom-validators/videos' import { isVideoFileExtnameValid } from '@server/helpers/custom-validators/videos'
import { Hooks } from '@server/lib/plugins/hooks'
import { ServerConfigManager } from '@server/lib/server-config-manager' import { ServerConfigManager } from '@server/lib/server-config-manager'
import { setVideoTags } from '@server/lib/video' import { setVideoTags } from '@server/lib/video'
import { FilteredModelAttributes } from '@server/types' import { FilteredModelAttributes } from '@server/types'
@ -18,15 +19,14 @@ import {
MVideoWithBlacklistLight MVideoWithBlacklistLight
} from '@server/types/models' } from '@server/types/models'
import { MVideoImportFormattable } from '@server/types/models/video/video-import' import { MVideoImportFormattable } from '@server/types/models/video/video-import'
import { ServerErrorCode, VideoImportCreate, VideoImportState, VideoPrivacy, VideoState } from '../../../../shared' import { ServerErrorCode, ThumbnailType, VideoImportCreate, VideoImportState, VideoPrivacy, VideoState } from '@shared/models'
import { ThumbnailType } from '../../../../shared/models/videos/thumbnail.type'
import { auditLoggerFactory, getAuditIdFromRes, VideoImportAuditView } from '../../../helpers/audit-logger' import { auditLoggerFactory, getAuditIdFromRes, VideoImportAuditView } from '../../../helpers/audit-logger'
import { moveAndProcessCaptionFile } from '../../../helpers/captions-utils' import { moveAndProcessCaptionFile } from '../../../helpers/captions-utils'
import { isArray } from '../../../helpers/custom-validators/misc' import { isArray } from '../../../helpers/custom-validators/misc'
import { cleanUpReqFiles, createReqFiles } from '../../../helpers/express-utils' import { cleanUpReqFiles, createReqFiles } from '../../../helpers/express-utils'
import { logger } from '../../../helpers/logger' import { logger } from '../../../helpers/logger'
import { getSecureTorrentName } from '../../../helpers/utils' import { getSecureTorrentName } from '../../../helpers/utils'
import { YoutubeDLWrapper, YoutubeDLInfo } from '../../../helpers/youtube-dl' import { YoutubeDLInfo, YoutubeDLWrapper } from '../../../helpers/youtube-dl'
import { CONFIG } from '../../../initializers/config' import { CONFIG } from '../../../initializers/config'
import { MIMETYPES } from '../../../initializers/constants' import { MIMETYPES } from '../../../initializers/constants'
import { sequelizeTypescript } from '../../../initializers/database' import { sequelizeTypescript } from '../../../initializers/database'
@ -38,7 +38,6 @@ import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate, videoIm
import { VideoModel } from '../../../models/video/video' import { VideoModel } from '../../../models/video/video'
import { VideoCaptionModel } from '../../../models/video/video-caption' import { VideoCaptionModel } from '../../../models/video/video-caption'
import { VideoImportModel } from '../../../models/video/video-import' import { VideoImportModel } from '../../../models/video/video-import'
import { Hooks } from '@server/lib/plugins/hooks'
const auditLogger = auditLoggerFactory('video-imports') const auditLogger = auditLoggerFactory('video-imports')
const videoImportsRouter = express.Router() const videoImportsRouter = express.Router()

View file

@ -10,8 +10,7 @@ import { videoLiveAddValidator, videoLiveGetValidator, videoLiveUpdateValidator
import { VideoLiveModel } from '@server/models/video/video-live' import { VideoLiveModel } from '@server/models/video/video-live'
import { MVideoDetails, MVideoFullLight } from '@server/types/models' import { MVideoDetails, MVideoFullLight } from '@server/types/models'
import { buildUUID, uuidToShort } from '@shared/core-utils' import { buildUUID, uuidToShort } from '@shared/core-utils'
import { LiveVideoCreate, LiveVideoUpdate, VideoState } from '../../../../shared' import { HttpStatusCode, LiveVideoCreate, LiveVideoUpdate, VideoState } from '@shared/models'
import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
import { logger } from '../../../helpers/logger' import { logger } from '../../../helpers/logger'
import { sequelizeTypescript } from '../../../initializers/database' import { sequelizeTypescript } from '../../../initializers/database'
import { updateVideoMiniatureFromExisting } from '../../../lib/thumbnail' import { updateVideoMiniatureFromExisting } from '../../../lib/thumbnail'

View file

@ -1,6 +1,5 @@
import express from 'express' import express from 'express'
import { UserVideoRateUpdate } from '../../../../shared' import { HttpStatusCode, UserVideoRateUpdate } from '@shared/models'
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 { sequelizeTypescript } from '../../../initializers/database'

View file

@ -6,8 +6,7 @@ import { buildVideoThumbnailsFromReq, setVideoTags } from '@server/lib/video'
import { openapiOperationDoc } from '@server/middlewares/doc' import { openapiOperationDoc } from '@server/middlewares/doc'
import { FilteredModelAttributes } from '@server/types' import { FilteredModelAttributes } from '@server/types'
import { MVideoFullLight } from '@server/types/models' import { MVideoFullLight } from '@server/types/models'
import { VideoUpdate } from '../../../../shared' import { HttpStatusCode, VideoUpdate } from '@shared/models'
import { HttpStatusCode } from '../../../../shared/models'
import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../helpers/audit-logger' import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../helpers/audit-logger'
import { resetSequelizeInstance } from '../../../helpers/database-utils' import { resetSequelizeInstance } from '../../../helpers/database-utils'
import { createReqFiles } from '../../../helpers/express-utils' import { createReqFiles } from '../../../helpers/express-utils'

View file

@ -20,8 +20,7 @@ import { openapiOperationDoc } from '@server/middlewares/doc'
import { MVideo, MVideoFile, MVideoFullLight } from '@server/types/models' import { MVideo, MVideoFile, MVideoFullLight } from '@server/types/models'
import { getLowercaseExtension, uuidToShort } from '@shared/core-utils' import { getLowercaseExtension, uuidToShort } from '@shared/core-utils'
import { isAudioFile } from '@shared/extra-utils' import { isAudioFile } from '@shared/extra-utils'
import { VideoCreate, VideoState } from '../../../../shared' import { HttpStatusCode, VideoCreate, VideoResolution, VideoState } from '@shared/models'
import { HttpStatusCode, VideoResolution } from '../../../../shared/models'
import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../helpers/audit-logger' import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../helpers/audit-logger'
import { retryTransactionWrapper } from '../../../helpers/database-utils' import { retryTransactionWrapper } from '../../../helpers/database-utils'
import { createReqFiles } from '../../../helpers/express-utils' import { createReqFiles } from '../../../helpers/express-utils'

View file

@ -1,6 +1,5 @@
import express from 'express' import express from 'express'
import { UserWatchingVideo } from '../../../../shared' import { HttpStatusCode, UserWatchingVideo } from '@shared/models'
import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
import { import {
asyncMiddleware, asyncMiddleware,
asyncRetryTransactionMiddleware, asyncRetryTransactionMiddleware,

View file

@ -5,9 +5,7 @@ import { chain } from 'lodash'
import { join } from 'path' import { join } from 'path'
import { addColors, config, createLogger, format, transports } from 'winston' import { addColors, config, createLogger, format, transports } from 'winston'
import { AUDIT_LOG_FILENAME } from '@server/initializers/constants' import { AUDIT_LOG_FILENAME } from '@server/initializers/constants'
import { AdminAbuse, User, VideoChannel, VideoDetails, VideoImport } from '../../shared' import { AdminAbuse, CustomConfig, User, VideoChannel, VideoComment, VideoDetails, VideoImport } from '@shared/models'
import { CustomConfig } from '../../shared/models/server/custom-config.model'
import { VideoComment } from '../../shared/models/videos/comment/video-comment.model'
import { CONFIG } from '../initializers/config' import { CONFIG } from '../initializers/config'
import { jsonLoggerFormat, labelFormatter } from './logger' import { jsonLoggerFormat, labelFormatter } from './logger'

View file

@ -1,6 +1,5 @@
import validator from 'validator' import validator from 'validator'
import { PlaylistElementObject } from '../../../../shared/models/activitypub/objects/playlist-element-object' import { PlaylistElementObject, PlaylistObject } from '@shared/models'
import { PlaylistObject } from '../../../../shared/models/activitypub/objects/playlist-object'
import { exists, isDateValid, isUUIDValid } from '../misc' import { exists, isDateValid, isUUIDValid } from '../misc'
import { isVideoPlaylistNameValid } from '../video-playlists' import { isVideoPlaylistNameValid } from '../video-playlists'
import { isActivityPubUrlValid } from './misc' import { isActivityPubUrlValid } from './misc'

View file

@ -1,6 +1,6 @@
import { values } from 'lodash' import { values } from 'lodash'
import validator from 'validator' import validator from 'validator'
import { UserRole } from '../../../shared' import { UserRole } from '@shared/models'
import { isEmailEnabled } from '../../initializers/config' import { isEmailEnabled } from '../../initializers/config'
import { CONSTRAINTS_FIELDS, NSFW_POLICY_TYPES } from '../../initializers/constants' import { CONSTRAINTS_FIELDS, NSFW_POLICY_TYPES } from '../../initializers/constants'
import { exists, isArray, isBooleanValid } from './misc' import { exists, isArray, isBooleanValid } from './misc'

View file

@ -2,8 +2,7 @@ import { UploadFilesForCheck } from 'express'
import { values } from 'lodash' import { values } from 'lodash'
import magnetUtil from 'magnet-uri' import magnetUtil from 'magnet-uri'
import validator from 'validator' import validator from 'validator'
import { VideoInclude } from '@shared/models' import { VideoFilter, VideoInclude, VideoPrivacy, VideoRateType } from '@shared/models'
import { VideoFilter, VideoPrivacy, VideoRateType } from '../../../shared'
import { import {
CONSTRAINTS_FIELDS, CONSTRAINTS_FIELDS,
MIMETYPES, MIMETYPES,

View file

@ -2,7 +2,7 @@ import { remove } from 'fs-extra'
import { Instance as ParseTorrent } from 'parse-torrent' import { Instance as ParseTorrent } from 'parse-torrent'
import { join } from 'path' import { join } from 'path'
import { sha256 } from '@shared/extra-utils' import { sha256 } from '@shared/extra-utils'
import { ResultList } from '../../shared' import { ResultList } from '@shared/models'
import { CONFIG } from '../initializers/config' import { CONFIG } from '../initializers/config'
import { execPromise, execPromise2, randomBytesPromise } from './core-utils' import { execPromise, execPromise2, randomBytesPromise } from './core-utils'
import { logger } from './logger' import { logger } from './logger'

View file

@ -1,6 +1,6 @@
import { ensureDir, remove } from 'fs-extra' import { ensureDir, remove } from 'fs-extra'
import passwordGenerator from 'password-generator' import passwordGenerator from 'password-generator'
import { UserRole } from '../../shared' import { UserRole } from '@shared/models'
import { logger } from '../helpers/logger' import { logger } from '../helpers/logger'
import { createApplicationActor, createUserAccountAndChannelAndPlaylist } from '../lib/user' import { createApplicationActor, createUserAccountAndChannelAndPlaylist } from '../lib/user'
import { ApplicationModel } from '../models/application/application' import { ApplicationModel } from '../models/application/application'

View file

@ -1,7 +1,6 @@
import { Transaction } from 'sequelize' import { Transaction } from 'sequelize'
import { MActorId, MVideoRedundancy, MVideoWithAllFiles } from '@server/types/models' import { MActorId, MVideoRedundancy, MVideoWithAllFiles } from '@server/types/models'
import { CacheFileObject } from '../../../shared/index' import { CacheFileObject, VideoStreamingPlaylistType } from '@shared/models'
import { VideoStreamingPlaylistType } from '../../../shared/models/videos/video-streaming-playlist.type'
import { VideoRedundancyModel } from '../../models/redundancy/video-redundancy' import { VideoRedundancyModel } from '../../models/redundancy/video-redundancy'
async function createOrUpdateCacheFile (cacheFileObject: CacheFileObject, video: MVideoWithAllFiles, byActor: MActorId, t: Transaction) { async function createOrUpdateCacheFile (cacheFileObject: CacheFileObject, video: MVideoWithAllFiles, byActor: MActorId, t: Transaction) {

View file

@ -1,8 +1,6 @@
import { isBlockedByServerOrAccount } from '@server/lib/blocklist' import { isBlockedByServerOrAccount } from '@server/lib/blocklist'
import { isRedundancyAccepted } from '@server/lib/redundancy' import { isRedundancyAccepted } from '@server/lib/redundancy'
import { ActivityCreate, CacheFileObject, VideoObject } from '../../../../shared' import { ActivityCreate, CacheFileObject, PlaylistObject, VideoCommentObject, VideoObject } from '@shared/models'
import { PlaylistObject } from '../../../../shared/models/activitypub/objects/playlist-object'
import { VideoCommentObject } from '../../../../shared/models/activitypub/objects/video-comment-object'
import { retryTransactionWrapper } from '../../../helpers/database-utils' import { retryTransactionWrapper } from '../../../helpers/database-utils'
import { logger } from '../../../helpers/logger' import { logger } from '../../../helpers/logger'
import { sequelizeTypescript } from '../../../initializers/database' import { sequelizeTypescript } from '../../../initializers/database'

View file

@ -1,5 +1,4 @@
import { ActivityCreate, ActivityDislike } from '../../../../shared' import { ActivityCreate, ActivityDislike, DislikeObject } from '@shared/models'
import { DislikeObject } from '../../../../shared/models/activitypub/objects'
import { retryTransactionWrapper } from '../../../helpers/database-utils' import { retryTransactionWrapper } from '../../../helpers/database-utils'
import { sequelizeTypescript } from '../../../initializers/database' import { sequelizeTypescript } from '../../../initializers/database'
import { AccountVideoRateModel } from '../../../models/account/account-video-rate' import { AccountVideoRateModel } from '../../../models/account/account-video-rate'

View file

@ -3,7 +3,7 @@ import { AccountModel } from '@server/models/account/account'
import { VideoModel } from '@server/models/video/video' import { VideoModel } from '@server/models/video/video'
import { VideoCommentModel } from '@server/models/video/video-comment' import { VideoCommentModel } from '@server/models/video/video-comment'
import { abusePredefinedReasonsMap } from '@shared/core-utils/abuse' import { abusePredefinedReasonsMap } from '@shared/core-utils/abuse'
import { AbuseObject, AbuseState, ActivityCreate, ActivityFlag } from '../../../../shared' import { AbuseObject, AbuseState, ActivityCreate, ActivityFlag } from '@shared/models'
import { getAPId } from '../../../helpers/activitypub' import { getAPId } from '../../../helpers/activitypub'
import { retryTransactionWrapper } from '../../../helpers/database-utils' import { retryTransactionWrapper } from '../../../helpers/database-utils'
import { logger } from '../../../helpers/logger' import { logger } from '../../../helpers/logger'

View file

@ -11,7 +11,7 @@ import { moveToFailedMoveToObjectStorageState, moveToNextState } from '@server/l
import { VideoModel } from '@server/models/video/video' import { VideoModel } from '@server/models/video/video'
import { VideoJobInfoModel } from '@server/models/video/video-job-info' import { VideoJobInfoModel } from '@server/models/video/video-job-info'
import { MStreamingPlaylistVideo, MVideo, MVideoFile, MVideoWithAllFiles } from '@server/types/models' import { MStreamingPlaylistVideo, MVideo, MVideoFile, MVideoWithAllFiles } from '@server/types/models'
import { MoveObjectStoragePayload, VideoStorage } from '../../../../shared' import { MoveObjectStoragePayload, VideoStorage } from '@shared/models'
export async function processMoveToObjectStorage (job: Job) { export async function processMoveToObjectStorage (job: Job) {
const payload = job.data as MoveObjectStoragePayload const payload = job.data as MoveObjectStoragePayload

View file

@ -1,6 +1,5 @@
import { Job } from 'bull' import { Job } from 'bull'
import { move, remove, stat } from 'fs-extra' import { move, remove, stat } from 'fs-extra'
import { getLowercaseExtension } from '@shared/core-utils'
import { retryTransactionWrapper } from '@server/helpers/database-utils' import { retryTransactionWrapper } from '@server/helpers/database-utils'
import { YoutubeDLWrapper } from '@server/helpers/youtube-dl' import { YoutubeDLWrapper } from '@server/helpers/youtube-dl'
import { isPostImportVideoAccepted } from '@server/lib/moderation' import { isPostImportVideoAccepted } from '@server/lib/moderation'
@ -13,16 +12,19 @@ import { VideoPathManager } from '@server/lib/video-path-manager'
import { buildNextVideoState } from '@server/lib/video-state' import { buildNextVideoState } from '@server/lib/video-state'
import { ThumbnailModel } from '@server/models/video/thumbnail' import { ThumbnailModel } from '@server/models/video/thumbnail'
import { MVideoImportDefault, MVideoImportDefaultFiles, MVideoImportVideo } from '@server/types/models/video/video-import' import { MVideoImportDefault, MVideoImportDefaultFiles, MVideoImportVideo } from '@server/types/models/video/video-import'
import { getLowercaseExtension } from '@shared/core-utils'
import { isAudioFile } from '@shared/extra-utils'
import { import {
ThumbnailType,
VideoImportPayload, VideoImportPayload,
VideoImportState,
VideoImportTorrentPayload, VideoImportTorrentPayload,
VideoImportTorrentPayloadType, VideoImportTorrentPayloadType,
VideoImportYoutubeDLPayload, VideoImportYoutubeDLPayload,
VideoImportYoutubeDLPayloadType, VideoImportYoutubeDLPayloadType,
VideoResolution,
VideoState VideoState
} from '../../../../shared' } from '@shared/models'
import { VideoImportState, VideoResolution } from '../../../../shared/models/videos'
import { ThumbnailType } from '../../../../shared/models/videos/thumbnail.type'
import { ffprobePromise, getDurationFromVideoFile, getVideoFileFPS, getVideoFileResolution } from '../../../helpers/ffprobe-utils' import { ffprobePromise, getDurationFromVideoFile, getVideoFileFPS, getVideoFileResolution } from '../../../helpers/ffprobe-utils'
import { logger } from '../../../helpers/logger' import { logger } from '../../../helpers/logger'
import { getSecureTorrentName } from '../../../helpers/utils' import { getSecureTorrentName } from '../../../helpers/utils'
@ -36,7 +38,6 @@ import { MThumbnail } from '../../../types/models/video/thumbnail'
import { federateVideoIfNeeded } from '../../activitypub/videos' import { federateVideoIfNeeded } from '../../activitypub/videos'
import { Notifier } from '../../notifier' import { Notifier } from '../../notifier'
import { generateVideoMiniature } from '../../thumbnail' import { generateVideoMiniature } from '../../thumbnail'
import { isAudioFile } from '@shared/extra-utils'
async function processVideoImport (job: Job) { async function processVideoImport (job: Job) {
const payload = job.data as VideoImportPayload const payload = job.data as VideoImportPayload

View file

@ -12,7 +12,7 @@ import {
NewResolutionTranscodingPayload, NewResolutionTranscodingPayload,
OptimizeTranscodingPayload, OptimizeTranscodingPayload,
VideoTranscodingPayload VideoTranscodingPayload
} from '../../../../shared' } from '@shared/models'
import { retryTransactionWrapper } from '../../../helpers/database-utils' import { retryTransactionWrapper } from '../../../helpers/database-utils'
import { computeLowerResolutionsToTranscode } from '../../../helpers/ffprobe-utils' import { computeLowerResolutionsToTranscode } from '../../../helpers/ffprobe-utils'
import { logger, loggerTagsFactory } from '../../../helpers/logger' import { logger, loggerTagsFactory } from '../../../helpers/logger'

View file

@ -1,8 +1,7 @@
import { NextFunction, Request, Response } from 'express' import { NextFunction, Request, Response } from 'express'
import { getAPId } from '@server/helpers/activitypub' import { getAPId } from '@server/helpers/activitypub'
import { isActorDeleteActivityValid } from '@server/helpers/custom-validators/activitypub/actor' import { isActorDeleteActivityValid } from '@server/helpers/custom-validators/activitypub/actor'
import { ActivityDelete, ActivityPubSignature } from '../../shared' import { ActivityDelete, ActivityPubSignature, HttpStatusCode } from '@shared/models'
import { HttpStatusCode } from '../../shared/models/http/http-error-codes'
import { logger } from '../helpers/logger' import { logger } from '../helpers/logger'
import { isHTTPSignatureVerified, isJsonLDSignatureVerified, parseHTTPSignature } from '../helpers/peertube-crypto' import { isHTTPSignatureVerified, isJsonLDSignatureVerified, parseHTTPSignature } from '../helpers/peertube-crypto'
import { ACCEPT_HEADERS, ACTIVITY_PUB, HTTP_SIGNATURE } from '../initializers/constants' import { ACCEPT_HEADERS, ACTIVITY_PUB, HTTP_SIGNATURE } from '../initializers/constants'

View file

@ -1,6 +1,5 @@
import express from 'express' import express from 'express'
import { UserRight } from '../../shared' import { HttpStatusCode, UserRight } from '@shared/models'
import { HttpStatusCode } from '../../shared/models/http/http-error-codes'
import { logger } from '../helpers/logger' import { logger } from '../helpers/logger'
function ensureUserHasRight (userRight: UserRight) { function ensureUserHasRight (userRight: UserRight) {

View file

@ -1,6 +1,6 @@
import express from 'express' import express from 'express'
import { body, param } from 'express-validator' import { body, param } from 'express-validator'
import { UserRight } from '../../../../shared' import { UserRight } from '@shared/models'
import { isVideoCaptionFile, isVideoCaptionLanguageValid } from '../../../helpers/custom-validators/video-captions' import { isVideoCaptionFile, isVideoCaptionLanguageValid } from '../../../helpers/custom-validators/video-captions'
import { cleanUpReqFiles } from '../../../helpers/express-utils' import { cleanUpReqFiles } from '../../../helpers/express-utils'
import { logger } from '../../../helpers/logger' import { logger } from '../../../helpers/logger'

View file

@ -1,8 +1,7 @@
import express from 'express' import express from 'express'
import { body, param, query } from 'express-validator' import { body, param, query } from 'express-validator'
import { MUserAccountUrl } from '@server/types/models' import { MUserAccountUrl } from '@server/types/models'
import { UserRight } from '../../../../shared' import { HttpStatusCode, UserRight } from '@shared/models'
import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
import { exists, isBooleanValid, isIdValid, toBooleanOrNull } from '../../../helpers/custom-validators/misc' import { exists, isBooleanValid, isIdValid, toBooleanOrNull } from '../../../helpers/custom-validators/misc'
import { isValidVideoCommentText } from '../../../helpers/custom-validators/video-comments' import { isValidVideoCommentText } from '../../../helpers/custom-validators/video-comments'
import { logger } from '../../../helpers/logger' import { logger } from '../../../helpers/logger'

View file

@ -1,6 +1,6 @@
import express from 'express' import express from 'express'
import { MVideo } from '@server/types/models' import { MVideo } from '@server/types/models'
import { HttpStatusCode } from '../../../../shared' import { HttpStatusCode } from '@shared/models'
import { logger } from '../../../helpers/logger' import { logger } from '../../../helpers/logger'
import { areValidationErrors, doesVideoExist, isValidVideoIdParam } from '../shared' import { areValidationErrors, doesVideoExist, isValidVideoIdParam } from '../shared'

View file

@ -2,10 +2,14 @@ import express from 'express'
import { body, param, query, ValidationChain } from 'express-validator' import { body, param, query, ValidationChain } from 'express-validator'
import { ExpressPromiseHandler } from '@server/types/express' import { ExpressPromiseHandler } from '@server/types/express'
import { MUserAccountId } from '@server/types/models' import { MUserAccountId } from '@server/types/models'
import { UserRight, VideoPlaylistCreate, VideoPlaylistUpdate } from '../../../../shared' import {
import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' HttpStatusCode,
import { VideoPlaylistPrivacy } from '../../../../shared/models/videos/playlist/video-playlist-privacy.model' UserRight,
import { VideoPlaylistType } from '../../../../shared/models/videos/playlist/video-playlist-type.model' VideoPlaylistCreate,
VideoPlaylistPrivacy,
VideoPlaylistType,
VideoPlaylistUpdate
} from '@shared/models'
import { import {
isArrayOf, isArrayOf,
isIdOrUUIDValid, isIdOrUUIDValid,

View file

@ -8,9 +8,7 @@ import { getServerActor } from '@server/models/application/application'
import { ExpressPromiseHandler } from '@server/types/express' import { ExpressPromiseHandler } from '@server/types/express'
import { MUserAccountId, MVideoFullLight } from '@server/types/models' import { MUserAccountId, MVideoFullLight } from '@server/types/models'
import { getAllPrivacies } from '@shared/core-utils' import { getAllPrivacies } from '@shared/core-utils'
import { VideoInclude } from '@shared/models' import { HttpStatusCode, ServerErrorCode, UserRight, VideoInclude, VideoPrivacy } from '@shared/models'
import { ServerErrorCode, UserRight, VideoPrivacy } from '../../../../shared'
import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes'
import { import {
exists, exists,
isBooleanValid, isBooleanValid,

View file

@ -6,10 +6,9 @@ import {
MAccountVideoRateAccountUrl, MAccountVideoRateAccountUrl,
MAccountVideoRateAccountVideo, MAccountVideoRateAccountVideo,
MAccountVideoRateFormattable MAccountVideoRateFormattable
} from '@server/types/models/video/video-rate' } from '@server/types/models'
import { AccountVideoRate, VideoRateType } from '@shared/models'
import { AttributesOnly } from '@shared/typescript-utils' import { AttributesOnly } from '@shared/typescript-utils'
import { AccountVideoRate } from '../../../shared'
import { VideoRateType } from '../../../shared/models/videos'
import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc' import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc'
import { CONSTRAINTS_FIELDS, VIDEO_RATE_TYPES } from '../../initializers/constants' import { CONSTRAINTS_FIELDS, VIDEO_RATE_TYPES } from '../../initializers/constants'
import { ActorModel } from '../actor/actor' import { ActorModel } from '../actor/actor'

View file

@ -16,15 +16,17 @@ import {
} from 'sequelize-typescript' } from 'sequelize-typescript'
import { getServerActor } from '@server/models/application/application' import { getServerActor } from '@server/models/application/application'
import { MActor, MVideoForRedundancyAPI, MVideoRedundancy, MVideoRedundancyAP, MVideoRedundancyVideo } from '@server/types/models' import { MActor, MVideoForRedundancyAPI, MVideoRedundancy, MVideoRedundancyAP, MVideoRedundancyVideo } from '@server/types/models'
import { AttributesOnly } from '@shared/typescript-utils'
import { VideoRedundanciesTarget } from '@shared/models/redundancy/video-redundancies-filters.model'
import { import {
CacheFileObject,
FileRedundancyInformation, FileRedundancyInformation,
StreamingPlaylistRedundancyInformation, StreamingPlaylistRedundancyInformation,
VideoRedundancy VideoPrivacy,
} from '@shared/models/redundancy/video-redundancy.model' VideoRedundanciesTarget,
import { CacheFileObject, VideoPrivacy } from '../../../shared' VideoRedundancy,
import { VideoRedundancyStrategy, VideoRedundancyStrategyWithManual } from '../../../shared/models/redundancy' VideoRedundancyStrategy,
VideoRedundancyStrategyWithManual
} from '@shared/models'
import { AttributesOnly } from '@shared/typescript-utils'
import { isTestInstance } from '../../helpers/core-utils' import { isTestInstance } from '../../helpers/core-utils'
import { isActivityPubUrlValid, isUrlValid } from '../../helpers/custom-validators/activitypub/misc' import { isActivityPubUrlValid, isUrlValid } from '../../helpers/custom-validators/activitypub/misc'
import { logger } from '../../helpers/logger' import { logger } from '../../helpers/logger'

View file

@ -2,8 +2,8 @@ import { FindOptions, ModelIndexesOptions, Op, WhereOptions } from 'sequelize'
import { AllowNull, BelongsTo, Column, CreatedAt, Default, ForeignKey, Is, Model, Scopes, Table, UpdatedAt } from 'sequelize-typescript' import { AllowNull, BelongsTo, Column, CreatedAt, Default, ForeignKey, Is, Model, Scopes, Table, UpdatedAt } from 'sequelize-typescript'
import { UserNotificationIncludes, UserNotificationModelForApi } from '@server/types/models/user' import { UserNotificationIncludes, UserNotificationModelForApi } from '@server/types/models/user'
import { uuidToShort } from '@shared/core-utils' import { uuidToShort } from '@shared/core-utils'
import { UserNotification, UserNotificationType } from '@shared/models'
import { AttributesOnly } from '@shared/typescript-utils' import { AttributesOnly } from '@shared/typescript-utils'
import { UserNotification, UserNotificationType } from '../../../shared'
import { isBooleanValid } from '../../helpers/custom-validators/misc' import { isBooleanValid } from '../../helpers/custom-validators/misc'
import { isUserNotificationTypeValid } from '../../helpers/custom-validators/user-notifications' import { isUserNotificationTypeValid } from '../../helpers/custom-validators/user-notifications'
import { AbuseModel } from '../abuse/abuse' import { AbuseModel } from '../abuse/abuse'

View file

@ -15,8 +15,8 @@ import {
} from 'sequelize-typescript' } from 'sequelize-typescript'
import { afterCommitIfTransaction } from '@server/helpers/database-utils' import { afterCommitIfTransaction } from '@server/helpers/database-utils'
import { MVideoImportDefault, MVideoImportFormattable } from '@server/types/models/video/video-import' import { MVideoImportDefault, MVideoImportFormattable } from '@server/types/models/video/video-import'
import { VideoImport, VideoImportState } from '@shared/models'
import { AttributesOnly } from '@shared/typescript-utils' import { AttributesOnly } from '@shared/typescript-utils'
import { VideoImport, VideoImportState } from '../../../shared'
import { isVideoImportStateValid, isVideoImportTargetUrlValid } from '../../helpers/custom-validators/video-imports' import { isVideoImportStateValid, isVideoImportTargetUrlValid } from '../../helpers/custom-validators/video-imports'
import { isVideoMagnetUriValid } from '../../helpers/custom-validators/videos' import { isVideoMagnetUriValid } from '../../helpers/custom-validators/videos'
import { CONSTRAINTS_FIELDS, VIDEO_IMPORT_STATES } from '../../initializers/constants' import { CONSTRAINTS_FIELDS, VIDEO_IMPORT_STATES } from '../../initializers/constants'

View file

@ -33,13 +33,22 @@ import { VideoPathManager } from '@server/lib/video-path-manager'
import { getServerActor } from '@server/models/application/application' import { getServerActor } from '@server/models/application/application'
import { ModelCache } from '@server/models/model-cache' import { ModelCache } from '@server/models/model-cache'
import { buildVideoEmbedPath, buildVideoWatchPath, pick, uuidToShort } from '@shared/core-utils' import { buildVideoEmbedPath, buildVideoWatchPath, pick, uuidToShort } from '@shared/core-utils'
import { VideoFile, VideoInclude } from '@shared/models' import {
ResultList,
ThumbnailType,
UserRight,
Video,
VideoDetails,
VideoFile,
VideoInclude,
VideoObject,
VideoPrivacy,
VideoRateType,
VideoState,
VideoStorage,
VideoStreamingPlaylistType
} from '@shared/models'
import { AttributesOnly } from '@shared/typescript-utils' import { AttributesOnly } from '@shared/typescript-utils'
import { ResultList, UserRight, VideoPrivacy, VideoState } from '../../../shared'
import { VideoObject } from '../../../shared/models/activitypub/objects'
import { Video, VideoDetails, VideoRateType, VideoStorage } from '../../../shared/models/videos'
import { ThumbnailType } from '../../../shared/models/videos/thumbnail.type'
import { VideoStreamingPlaylistType } from '../../../shared/models/videos/video-streaming-playlist.type'
import { peertubeTruncate } from '../../helpers/core-utils' import { peertubeTruncate } from '../../helpers/core-utils'
import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc' import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc'
import { exists, isBooleanValid } from '../../helpers/custom-validators/misc' import { exists, isBooleanValid } from '../../helpers/custom-validators/misc'

View file

@ -1 +0,0 @@
export * from './models'