diff --git a/server/controllers/activitypub/inbox.ts b/server/controllers/activitypub/inbox.ts index 5995b8f3a..66a38e055 100644 --- a/server/controllers/activitypub/inbox.ts +++ b/server/controllers/activitypub/inbox.ts @@ -1,6 +1,6 @@ import express from 'express' 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 { isActivityValid } from '../../helpers/custom-validators/activitypub/activity' import { logger } from '../../helpers/logger' diff --git a/server/controllers/api/abuse.ts b/server/controllers/api/abuse.ts index a6d0b0512..d6211cc83 100644 --- a/server/controllers/api/abuse.ts +++ b/server/controllers/api/abuse.ts @@ -6,8 +6,7 @@ import { AbuseModel } from '@server/models/abuse/abuse' import { AbuseMessageModel } from '@server/models/abuse/abuse-message' import { getServerActor } from '@server/models/application/application' import { abusePredefinedReasonsMap } from '@shared/core-utils/abuse' -import { HttpStatusCode } from '@shared/models' -import { AbuseCreate, AbuseState, UserRight } from '../../../shared' +import { AbuseCreate, AbuseState, HttpStatusCode, UserRight } from '@shared/models' import { getFormattedObjects } from '../../helpers/utils' import { sequelizeTypescript } from '../../initializers/database' import { diff --git a/server/controllers/api/config.ts b/server/controllers/api/config.ts index b253db397..4e3dd4d80 100644 --- a/server/controllers/api/config.ts +++ b/server/controllers/api/config.ts @@ -3,9 +3,7 @@ import { remove, writeJSON } from 'fs-extra' import { snakeCase } from 'lodash' import validator from 'validator' import { ServerConfigManager } from '@server/lib/server-config-manager' -import { UserRight } from '../../../shared' -import { About } from '../../../shared/models/server/about.model' -import { CustomConfig } from '../../../shared/models/server/custom-config.model' +import { About, CustomConfig, UserRight } from '@shared/models' import { auditLoggerFactory, CustomConfigAuditView, getAuditIdFromRes } from '../../helpers/audit-logger' import { objectConverter } from '../../helpers/core-utils' import { CONFIG, reloadConfig } from '../../initializers/config' diff --git a/server/controllers/api/jobs.ts b/server/controllers/api/jobs.ts index 7001674bb..eebd195b0 100644 --- a/server/controllers/api/jobs.ts +++ b/server/controllers/api/jobs.ts @@ -1,7 +1,5 @@ import express from 'express' -import { ResultList } from '../../../shared' -import { Job, JobState, JobType } from '../../../shared/models' -import { UserRight } from '../../../shared/models/users' +import { Job, JobState, JobType, ResultList, UserRight } from '@shared/models' import { isArray } from '../../helpers/custom-validators/misc' import { JobQueue } from '../../lib/job-queue' import { diff --git a/server/controllers/api/oauth-clients.ts b/server/controllers/api/oauth-clients.ts index 4990fb0df..2d847bdc1 100644 --- a/server/controllers/api/oauth-clients.ts +++ b/server/controllers/api/oauth-clients.ts @@ -1,10 +1,9 @@ import express from 'express' -import { OAuthClientLocal } from '../../../shared' -import { HttpStatusCode } from '../../../shared/models/http/http-error-codes' +import { OAuthClientModel } from '@server/models/oauth/oauth-client' +import { HttpStatusCode, OAuthClientLocal } from '@shared/models' import { logger } from '../../helpers/logger' import { CONFIG } from '../../initializers/config' import { asyncMiddleware, openapiOperationDoc } from '../../middlewares' -import { OAuthClientModel } from '../../models/oauth/oauth-client' const oauthClientsRouter = express.Router() diff --git a/server/controllers/api/users/index.ts b/server/controllers/api/users/index.ts index fcee58f6b..7efc3a137 100644 --- a/server/controllers/api/users/index.ts +++ b/server/controllers/api/users/index.ts @@ -4,10 +4,7 @@ import { tokensRouter } from '@server/controllers/api/users/token' import { Hooks } from '@server/lib/plugins/hooks' import { OAuthTokenModel } from '@server/models/oauth/oauth-token' import { MUser, MUserAccountDefault } from '@server/types/models' -import { UserCreate, UserCreateResult, UserRight, UserRole, UserUpdate } from '../../../../shared' -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 { HttpStatusCode, UserAdminFlag, UserCreate, UserCreateResult, UserRegister, UserRight, UserRole, UserUpdate } from '@shared/models' import { auditLoggerFactory, getAuditIdFromRes, UserAuditView } from '../../../helpers/audit-logger' import { logger } from '../../../helpers/logger' 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) const verificationString = await Redis.Instance.setCreatePasswordVerificationString(user.id) 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 }) diff --git a/server/controllers/api/users/me.ts b/server/controllers/api/users/me.ts index 127b7ca5d..878dd5a84 100644 --- a/server/controllers/api/users/me.ts +++ b/server/controllers/api/users/me.ts @@ -2,10 +2,8 @@ import 'multer' import express from 'express' import { auditLoggerFactory, getAuditIdFromRes, UserAuditView } from '@server/helpers/audit-logger' 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 { 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 { getFormattedObjects } from '../../../helpers/utils' import { CONFIG } from '../../../initializers/config' diff --git a/server/controllers/api/video-channel.ts b/server/controllers/api/video-channel.ts index abb777e08..e65550a22 100644 --- a/server/controllers/api/video-channel.ts +++ b/server/controllers/api/video-channel.ts @@ -5,8 +5,7 @@ import { ActorFollowModel } from '@server/models/actor/actor-follow' import { getServerActor } from '@server/models/application/application' import { guessAdditionalAttributesFromQuery } from '@server/models/video/formatter/video-format-utils' import { MChannelBannerAccountDefault } from '@server/types/models' -import { ActorImageType, VideoChannelCreate, VideoChannelUpdate } from '../../../shared' -import { HttpStatusCode } from '../../../shared/models/http/http-error-codes' +import { ActorImageType, HttpStatusCode, VideoChannelCreate, VideoChannelUpdate } from '@shared/models' import { auditLoggerFactory, getAuditIdFromRes, VideoChannelAuditView } from '../../helpers/audit-logger' import { resetSequelizeInstance } from '../../helpers/database-utils' import { buildNSFWFilter, createReqFiles, getCountVideos, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils' diff --git a/server/controllers/api/videos/blacklist.ts b/server/controllers/api/videos/blacklist.ts index de65c74f1..4103bb063 100644 --- a/server/controllers/api/videos/blacklist.ts +++ b/server/controllers/api/videos/blacklist.ts @@ -1,7 +1,6 @@ import express from 'express' import { blacklistVideo, unblacklistVideo } from '@server/lib/video-blacklist' -import { UserRight, VideoBlacklistCreate } from '../../../../shared' -import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' +import { HttpStatusCode, UserRight, VideoBlacklistCreate } from '@shared/models' import { logger } from '../../../helpers/logger' import { getFormattedObjects } from '../../../helpers/utils' import { sequelizeTypescript } from '../../../initializers/database' diff --git a/server/controllers/api/videos/import.ts b/server/controllers/api/videos/import.ts index 3c445efce..08d69827b 100644 --- a/server/controllers/api/videos/import.ts +++ b/server/controllers/api/videos/import.ts @@ -4,6 +4,7 @@ import { decode } from 'magnet-uri' import parseTorrent, { Instance } from 'parse-torrent' import { join } from 'path' import { isVideoFileExtnameValid } from '@server/helpers/custom-validators/videos' +import { Hooks } from '@server/lib/plugins/hooks' import { ServerConfigManager } from '@server/lib/server-config-manager' import { setVideoTags } from '@server/lib/video' import { FilteredModelAttributes } from '@server/types' @@ -18,15 +19,14 @@ import { MVideoWithBlacklistLight } from '@server/types/models' import { MVideoImportFormattable } from '@server/types/models/video/video-import' -import { ServerErrorCode, VideoImportCreate, VideoImportState, VideoPrivacy, VideoState } from '../../../../shared' -import { ThumbnailType } from '../../../../shared/models/videos/thumbnail.type' +import { ServerErrorCode, ThumbnailType, VideoImportCreate, VideoImportState, VideoPrivacy, VideoState } from '@shared/models' import { auditLoggerFactory, getAuditIdFromRes, VideoImportAuditView } from '../../../helpers/audit-logger' import { moveAndProcessCaptionFile } from '../../../helpers/captions-utils' import { isArray } from '../../../helpers/custom-validators/misc' import { cleanUpReqFiles, createReqFiles } from '../../../helpers/express-utils' import { logger } from '../../../helpers/logger' 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 { MIMETYPES } from '../../../initializers/constants' import { sequelizeTypescript } from '../../../initializers/database' @@ -38,7 +38,6 @@ import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate, videoIm import { VideoModel } from '../../../models/video/video' import { VideoCaptionModel } from '../../../models/video/video-caption' import { VideoImportModel } from '../../../models/video/video-import' -import { Hooks } from '@server/lib/plugins/hooks' const auditLogger = auditLoggerFactory('video-imports') const videoImportsRouter = express.Router() diff --git a/server/controllers/api/videos/live.ts b/server/controllers/api/videos/live.ts index 4ee39aa4f..80ecbfef1 100644 --- a/server/controllers/api/videos/live.ts +++ b/server/controllers/api/videos/live.ts @@ -10,8 +10,7 @@ import { videoLiveAddValidator, videoLiveGetValidator, videoLiveUpdateValidator import { VideoLiveModel } from '@server/models/video/video-live' import { MVideoDetails, MVideoFullLight } from '@server/types/models' import { buildUUID, uuidToShort } from '@shared/core-utils' -import { LiveVideoCreate, LiveVideoUpdate, VideoState } from '../../../../shared' -import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' +import { HttpStatusCode, LiveVideoCreate, LiveVideoUpdate, VideoState } from '@shared/models' import { logger } from '../../../helpers/logger' import { sequelizeTypescript } from '../../../initializers/database' import { updateVideoMiniatureFromExisting } from '../../../lib/thumbnail' diff --git a/server/controllers/api/videos/rate.ts b/server/controllers/api/videos/rate.ts index c9cc16644..6b26a8eee 100644 --- a/server/controllers/api/videos/rate.ts +++ b/server/controllers/api/videos/rate.ts @@ -1,6 +1,5 @@ import express from 'express' -import { UserVideoRateUpdate } from '../../../../shared' -import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' +import { HttpStatusCode, UserVideoRateUpdate } from '@shared/models' import { logger } from '../../../helpers/logger' import { VIDEO_RATE_TYPES } from '../../../initializers/constants' import { sequelizeTypescript } from '../../../initializers/database' diff --git a/server/controllers/api/videos/update.ts b/server/controllers/api/videos/update.ts index 589556f47..f600847d4 100644 --- a/server/controllers/api/videos/update.ts +++ b/server/controllers/api/videos/update.ts @@ -6,8 +6,7 @@ import { buildVideoThumbnailsFromReq, setVideoTags } from '@server/lib/video' import { openapiOperationDoc } from '@server/middlewares/doc' import { FilteredModelAttributes } from '@server/types' import { MVideoFullLight } from '@server/types/models' -import { VideoUpdate } from '../../../../shared' -import { HttpStatusCode } from '../../../../shared/models' +import { HttpStatusCode, VideoUpdate } from '@shared/models' import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../helpers/audit-logger' import { resetSequelizeInstance } from '../../../helpers/database-utils' import { createReqFiles } from '../../../helpers/express-utils' diff --git a/server/controllers/api/videos/upload.ts b/server/controllers/api/videos/upload.ts index ecc4dfa37..e8f400cff 100644 --- a/server/controllers/api/videos/upload.ts +++ b/server/controllers/api/videos/upload.ts @@ -20,8 +20,7 @@ import { openapiOperationDoc } from '@server/middlewares/doc' import { MVideo, MVideoFile, MVideoFullLight } from '@server/types/models' import { getLowercaseExtension, uuidToShort } from '@shared/core-utils' import { isAudioFile } from '@shared/extra-utils' -import { VideoCreate, VideoState } from '../../../../shared' -import { HttpStatusCode, VideoResolution } from '../../../../shared/models' +import { HttpStatusCode, VideoCreate, VideoResolution, VideoState } from '@shared/models' import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../helpers/audit-logger' import { retryTransactionWrapper } from '../../../helpers/database-utils' import { createReqFiles } from '../../../helpers/express-utils' diff --git a/server/controllers/api/videos/watching.ts b/server/controllers/api/videos/watching.ts index e8c28b613..3fd22caac 100644 --- a/server/controllers/api/videos/watching.ts +++ b/server/controllers/api/videos/watching.ts @@ -1,6 +1,5 @@ import express from 'express' -import { UserWatchingVideo } from '../../../../shared' -import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' +import { HttpStatusCode, UserWatchingVideo } from '@shared/models' import { asyncMiddleware, asyncRetryTransactionMiddleware, diff --git a/server/helpers/audit-logger.ts b/server/helpers/audit-logger.ts index 5f2e870e3..79ef44be1 100644 --- a/server/helpers/audit-logger.ts +++ b/server/helpers/audit-logger.ts @@ -5,9 +5,7 @@ import { chain } from 'lodash' import { join } from 'path' import { addColors, config, createLogger, format, transports } from 'winston' import { AUDIT_LOG_FILENAME } from '@server/initializers/constants' -import { AdminAbuse, User, VideoChannel, VideoDetails, VideoImport } from '../../shared' -import { CustomConfig } from '../../shared/models/server/custom-config.model' -import { VideoComment } from '../../shared/models/videos/comment/video-comment.model' +import { AdminAbuse, CustomConfig, User, VideoChannel, VideoComment, VideoDetails, VideoImport } from '@shared/models' import { CONFIG } from '../initializers/config' import { jsonLoggerFormat, labelFormatter } from './logger' diff --git a/server/helpers/custom-validators/activitypub/playlist.ts b/server/helpers/custom-validators/activitypub/playlist.ts index 72c5b80e9..49bcadcfd 100644 --- a/server/helpers/custom-validators/activitypub/playlist.ts +++ b/server/helpers/custom-validators/activitypub/playlist.ts @@ -1,6 +1,5 @@ import validator from 'validator' -import { PlaylistElementObject } from '../../../../shared/models/activitypub/objects/playlist-element-object' -import { PlaylistObject } from '../../../../shared/models/activitypub/objects/playlist-object' +import { PlaylistElementObject, PlaylistObject } from '@shared/models' import { exists, isDateValid, isUUIDValid } from '../misc' import { isVideoPlaylistNameValid } from '../video-playlists' import { isActivityPubUrlValid } from './misc' diff --git a/server/helpers/custom-validators/users.ts b/server/helpers/custom-validators/users.ts index badf171d2..105c36600 100644 --- a/server/helpers/custom-validators/users.ts +++ b/server/helpers/custom-validators/users.ts @@ -1,6 +1,6 @@ import { values } from 'lodash' import validator from 'validator' -import { UserRole } from '../../../shared' +import { UserRole } from '@shared/models' import { isEmailEnabled } from '../../initializers/config' import { CONSTRAINTS_FIELDS, NSFW_POLICY_TYPES } from '../../initializers/constants' import { exists, isArray, isBooleanValid } from './misc' diff --git a/server/helpers/custom-validators/videos.ts b/server/helpers/custom-validators/videos.ts index 1d56ade6f..e526c4284 100644 --- a/server/helpers/custom-validators/videos.ts +++ b/server/helpers/custom-validators/videos.ts @@ -2,8 +2,7 @@ import { UploadFilesForCheck } from 'express' import { values } from 'lodash' import magnetUtil from 'magnet-uri' import validator from 'validator' -import { VideoInclude } from '@shared/models' -import { VideoFilter, VideoPrivacy, VideoRateType } from '../../../shared' +import { VideoFilter, VideoInclude, VideoPrivacy, VideoRateType } from '@shared/models' import { CONSTRAINTS_FIELDS, MIMETYPES, diff --git a/server/helpers/utils.ts b/server/helpers/utils.ts index bd85eaa56..6b9333b53 100644 --- a/server/helpers/utils.ts +++ b/server/helpers/utils.ts @@ -2,7 +2,7 @@ import { remove } from 'fs-extra' import { Instance as ParseTorrent } from 'parse-torrent' import { join } from 'path' import { sha256 } from '@shared/extra-utils' -import { ResultList } from '../../shared' +import { ResultList } from '@shared/models' import { CONFIG } from '../initializers/config' import { execPromise, execPromise2, randomBytesPromise } from './core-utils' import { logger } from './logger' diff --git a/server/initializers/installer.ts b/server/initializers/installer.ts index 7c29a42e1..7e321fb76 100644 --- a/server/initializers/installer.ts +++ b/server/initializers/installer.ts @@ -1,6 +1,6 @@ import { ensureDir, remove } from 'fs-extra' import passwordGenerator from 'password-generator' -import { UserRole } from '../../shared' +import { UserRole } from '@shared/models' import { logger } from '../helpers/logger' import { createApplicationActor, createUserAccountAndChannelAndPlaylist } from '../lib/user' import { ApplicationModel } from '../models/application/application' diff --git a/server/lib/activitypub/cache-file.ts b/server/lib/activitypub/cache-file.ts index a16d2cd93..c3acd7112 100644 --- a/server/lib/activitypub/cache-file.ts +++ b/server/lib/activitypub/cache-file.ts @@ -1,7 +1,6 @@ import { Transaction } from 'sequelize' import { MActorId, MVideoRedundancy, MVideoWithAllFiles } from '@server/types/models' -import { CacheFileObject } from '../../../shared/index' -import { VideoStreamingPlaylistType } from '../../../shared/models/videos/video-streaming-playlist.type' +import { CacheFileObject, VideoStreamingPlaylistType } from '@shared/models' import { VideoRedundancyModel } from '../../models/redundancy/video-redundancy' async function createOrUpdateCacheFile (cacheFileObject: CacheFileObject, video: MVideoWithAllFiles, byActor: MActorId, t: Transaction) { diff --git a/server/lib/activitypub/process/process-create.ts b/server/lib/activitypub/process/process-create.ts index 93f1d1c59..3e8ad184c 100644 --- a/server/lib/activitypub/process/process-create.ts +++ b/server/lib/activitypub/process/process-create.ts @@ -1,8 +1,6 @@ import { isBlockedByServerOrAccount } from '@server/lib/blocklist' import { isRedundancyAccepted } from '@server/lib/redundancy' -import { ActivityCreate, CacheFileObject, VideoObject } from '../../../../shared' -import { PlaylistObject } from '../../../../shared/models/activitypub/objects/playlist-object' -import { VideoCommentObject } from '../../../../shared/models/activitypub/objects/video-comment-object' +import { ActivityCreate, CacheFileObject, PlaylistObject, VideoCommentObject, VideoObject } from '@shared/models' import { retryTransactionWrapper } from '../../../helpers/database-utils' import { logger } from '../../../helpers/logger' import { sequelizeTypescript } from '../../../initializers/database' diff --git a/server/lib/activitypub/process/process-dislike.ts b/server/lib/activitypub/process/process-dislike.ts index ecc57cd10..2f46b83d1 100644 --- a/server/lib/activitypub/process/process-dislike.ts +++ b/server/lib/activitypub/process/process-dislike.ts @@ -1,5 +1,4 @@ -import { ActivityCreate, ActivityDislike } from '../../../../shared' -import { DislikeObject } from '../../../../shared/models/activitypub/objects' +import { ActivityCreate, ActivityDislike, DislikeObject } from '@shared/models' import { retryTransactionWrapper } from '../../../helpers/database-utils' import { sequelizeTypescript } from '../../../initializers/database' import { AccountVideoRateModel } from '../../../models/account/account-video-rate' diff --git a/server/lib/activitypub/process/process-flag.ts b/server/lib/activitypub/process/process-flag.ts index fd3e46e2b..a15d07a62 100644 --- a/server/lib/activitypub/process/process-flag.ts +++ b/server/lib/activitypub/process/process-flag.ts @@ -3,7 +3,7 @@ import { AccountModel } from '@server/models/account/account' import { VideoModel } from '@server/models/video/video' import { VideoCommentModel } from '@server/models/video/video-comment' 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 { retryTransactionWrapper } from '../../../helpers/database-utils' import { logger } from '../../../helpers/logger' diff --git a/server/lib/job-queue/handlers/move-to-object-storage.ts b/server/lib/job-queue/handlers/move-to-object-storage.ts index d9c415b2d..9e39322a8 100644 --- a/server/lib/job-queue/handlers/move-to-object-storage.ts +++ b/server/lib/job-queue/handlers/move-to-object-storage.ts @@ -11,7 +11,7 @@ import { moveToFailedMoveToObjectStorageState, moveToNextState } from '@server/l import { VideoModel } from '@server/models/video/video' import { VideoJobInfoModel } from '@server/models/video/video-job-info' 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) { const payload = job.data as MoveObjectStoragePayload diff --git a/server/lib/job-queue/handlers/video-import.ts b/server/lib/job-queue/handlers/video-import.ts index beb78b4a6..2f74e9fbd 100644 --- a/server/lib/job-queue/handlers/video-import.ts +++ b/server/lib/job-queue/handlers/video-import.ts @@ -1,6 +1,5 @@ import { Job } from 'bull' import { move, remove, stat } from 'fs-extra' -import { getLowercaseExtension } from '@shared/core-utils' import { retryTransactionWrapper } from '@server/helpers/database-utils' import { YoutubeDLWrapper } from '@server/helpers/youtube-dl' 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 { ThumbnailModel } from '@server/models/video/thumbnail' import { MVideoImportDefault, MVideoImportDefaultFiles, MVideoImportVideo } from '@server/types/models/video/video-import' +import { getLowercaseExtension } from '@shared/core-utils' +import { isAudioFile } from '@shared/extra-utils' import { + ThumbnailType, VideoImportPayload, + VideoImportState, VideoImportTorrentPayload, VideoImportTorrentPayloadType, VideoImportYoutubeDLPayload, VideoImportYoutubeDLPayloadType, + VideoResolution, VideoState -} from '../../../../shared' -import { VideoImportState, VideoResolution } from '../../../../shared/models/videos' -import { ThumbnailType } from '../../../../shared/models/videos/thumbnail.type' +} from '@shared/models' import { ffprobePromise, getDurationFromVideoFile, getVideoFileFPS, getVideoFileResolution } from '../../../helpers/ffprobe-utils' import { logger } from '../../../helpers/logger' import { getSecureTorrentName } from '../../../helpers/utils' @@ -36,7 +38,6 @@ import { MThumbnail } from '../../../types/models/video/thumbnail' import { federateVideoIfNeeded } from '../../activitypub/videos' import { Notifier } from '../../notifier' import { generateVideoMiniature } from '../../thumbnail' -import { isAudioFile } from '@shared/extra-utils' async function processVideoImport (job: Job) { const payload = job.data as VideoImportPayload diff --git a/server/lib/job-queue/handlers/video-transcoding.ts b/server/lib/job-queue/handlers/video-transcoding.ts index 0edcdcba3..ef3abcbcd 100644 --- a/server/lib/job-queue/handlers/video-transcoding.ts +++ b/server/lib/job-queue/handlers/video-transcoding.ts @@ -12,7 +12,7 @@ import { NewResolutionTranscodingPayload, OptimizeTranscodingPayload, VideoTranscodingPayload -} from '../../../../shared' +} from '@shared/models' import { retryTransactionWrapper } from '../../../helpers/database-utils' import { computeLowerResolutionsToTranscode } from '../../../helpers/ffprobe-utils' import { logger, loggerTagsFactory } from '../../../helpers/logger' diff --git a/server/middlewares/activitypub.ts b/server/middlewares/activitypub.ts index 6ef90b275..86d3c1d6c 100644 --- a/server/middlewares/activitypub.ts +++ b/server/middlewares/activitypub.ts @@ -1,8 +1,7 @@ import { NextFunction, Request, Response } from 'express' import { getAPId } from '@server/helpers/activitypub' import { isActorDeleteActivityValid } from '@server/helpers/custom-validators/activitypub/actor' -import { ActivityDelete, ActivityPubSignature } from '../../shared' -import { HttpStatusCode } from '../../shared/models/http/http-error-codes' +import { ActivityDelete, ActivityPubSignature, HttpStatusCode } from '@shared/models' import { logger } from '../helpers/logger' import { isHTTPSignatureVerified, isJsonLDSignatureVerified, parseHTTPSignature } from '../helpers/peertube-crypto' import { ACCEPT_HEADERS, ACTIVITY_PUB, HTTP_SIGNATURE } from '../initializers/constants' diff --git a/server/middlewares/user-right.ts b/server/middlewares/user-right.ts index ea95b16c2..7d53e8341 100644 --- a/server/middlewares/user-right.ts +++ b/server/middlewares/user-right.ts @@ -1,6 +1,5 @@ import express from 'express' -import { UserRight } from '../../shared' -import { HttpStatusCode } from '../../shared/models/http/http-error-codes' +import { HttpStatusCode, UserRight } from '@shared/models' import { logger } from '../helpers/logger' function ensureUserHasRight (userRight: UserRight) { diff --git a/server/middlewares/validators/videos/video-captions.ts b/server/middlewares/validators/videos/video-captions.ts index 38321ccf9..47c491b4c 100644 --- a/server/middlewares/validators/videos/video-captions.ts +++ b/server/middlewares/validators/videos/video-captions.ts @@ -1,6 +1,6 @@ import express from 'express' 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 { cleanUpReqFiles } from '../../../helpers/express-utils' import { logger } from '../../../helpers/logger' diff --git a/server/middlewares/validators/videos/video-comments.ts b/server/middlewares/validators/videos/video-comments.ts index 3ea8bdcbb..665fb04c8 100644 --- a/server/middlewares/validators/videos/video-comments.ts +++ b/server/middlewares/validators/videos/video-comments.ts @@ -1,8 +1,7 @@ import express from 'express' import { body, param, query } from 'express-validator' import { MUserAccountUrl } from '@server/types/models' -import { UserRight } from '../../../../shared' -import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' +import { HttpStatusCode, UserRight } from '@shared/models' import { exists, isBooleanValid, isIdValid, toBooleanOrNull } from '../../../helpers/custom-validators/misc' import { isValidVideoCommentText } from '../../../helpers/custom-validators/video-comments' import { logger } from '../../../helpers/logger' diff --git a/server/middlewares/validators/videos/video-files.ts b/server/middlewares/validators/videos/video-files.ts index c1fa77502..35b0ac757 100644 --- a/server/middlewares/validators/videos/video-files.ts +++ b/server/middlewares/validators/videos/video-files.ts @@ -1,6 +1,6 @@ import express from 'express' import { MVideo } from '@server/types/models' -import { HttpStatusCode } from '../../../../shared' +import { HttpStatusCode } from '@shared/models' import { logger } from '../../../helpers/logger' import { areValidationErrors, doesVideoExist, isValidVideoIdParam } from '../shared' diff --git a/server/middlewares/validators/videos/video-playlists.ts b/server/middlewares/validators/videos/video-playlists.ts index 8f5c75fd5..ec5a3a9c8 100644 --- a/server/middlewares/validators/videos/video-playlists.ts +++ b/server/middlewares/validators/videos/video-playlists.ts @@ -2,10 +2,14 @@ import express from 'express' import { body, param, query, ValidationChain } from 'express-validator' import { ExpressPromiseHandler } from '@server/types/express' import { MUserAccountId } from '@server/types/models' -import { UserRight, VideoPlaylistCreate, VideoPlaylistUpdate } from '../../../../shared' -import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' -import { VideoPlaylistPrivacy } from '../../../../shared/models/videos/playlist/video-playlist-privacy.model' -import { VideoPlaylistType } from '../../../../shared/models/videos/playlist/video-playlist-type.model' +import { + HttpStatusCode, + UserRight, + VideoPlaylistCreate, + VideoPlaylistPrivacy, + VideoPlaylistType, + VideoPlaylistUpdate +} from '@shared/models' import { isArrayOf, isIdOrUUIDValid, diff --git a/server/middlewares/validators/videos/videos.ts b/server/middlewares/validators/videos/videos.ts index 3ebdbc33d..1e727533b 100644 --- a/server/middlewares/validators/videos/videos.ts +++ b/server/middlewares/validators/videos/videos.ts @@ -8,9 +8,7 @@ import { getServerActor } from '@server/models/application/application' import { ExpressPromiseHandler } from '@server/types/express' import { MUserAccountId, MVideoFullLight } from '@server/types/models' import { getAllPrivacies } from '@shared/core-utils' -import { VideoInclude } from '@shared/models' -import { ServerErrorCode, UserRight, VideoPrivacy } from '../../../../shared' -import { HttpStatusCode } from '../../../../shared/models/http/http-error-codes' +import { HttpStatusCode, ServerErrorCode, UserRight, VideoInclude, VideoPrivacy } from '@shared/models' import { exists, isBooleanValid, diff --git a/server/models/account/account-video-rate.ts b/server/models/account/account-video-rate.ts index 218561952..e89d31adf 100644 --- a/server/models/account/account-video-rate.ts +++ b/server/models/account/account-video-rate.ts @@ -6,10 +6,9 @@ import { MAccountVideoRateAccountUrl, MAccountVideoRateAccountVideo, 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 { AccountVideoRate } from '../../../shared' -import { VideoRateType } from '../../../shared/models/videos' import { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc' import { CONSTRAINTS_FIELDS, VIDEO_RATE_TYPES } from '../../initializers/constants' import { ActorModel } from '../actor/actor' diff --git a/server/models/redundancy/video-redundancy.ts b/server/models/redundancy/video-redundancy.ts index 7e4c7ddf2..6f84747da 100644 --- a/server/models/redundancy/video-redundancy.ts +++ b/server/models/redundancy/video-redundancy.ts @@ -16,15 +16,17 @@ import { } from 'sequelize-typescript' import { getServerActor } from '@server/models/application/application' 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 { + CacheFileObject, FileRedundancyInformation, StreamingPlaylistRedundancyInformation, - VideoRedundancy -} from '@shared/models/redundancy/video-redundancy.model' -import { CacheFileObject, VideoPrivacy } from '../../../shared' -import { VideoRedundancyStrategy, VideoRedundancyStrategyWithManual } from '../../../shared/models/redundancy' + VideoPrivacy, + VideoRedundanciesTarget, + VideoRedundancy, + VideoRedundancyStrategy, + VideoRedundancyStrategyWithManual +} from '@shared/models' +import { AttributesOnly } from '@shared/typescript-utils' import { isTestInstance } from '../../helpers/core-utils' import { isActivityPubUrlValid, isUrlValid } from '../../helpers/custom-validators/activitypub/misc' import { logger } from '../../helpers/logger' diff --git a/server/models/user/user-notification.ts b/server/models/user/user-notification.ts index d71bb4d56..8450ad49e 100644 --- a/server/models/user/user-notification.ts +++ b/server/models/user/user-notification.ts @@ -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 { UserNotificationIncludes, UserNotificationModelForApi } from '@server/types/models/user' import { uuidToShort } from '@shared/core-utils' +import { UserNotification, UserNotificationType } from '@shared/models' import { AttributesOnly } from '@shared/typescript-utils' -import { UserNotification, UserNotificationType } from '../../../shared' import { isBooleanValid } from '../../helpers/custom-validators/misc' import { isUserNotificationTypeValid } from '../../helpers/custom-validators/user-notifications' import { AbuseModel } from '../abuse/abuse' diff --git a/server/models/video/video-import.ts b/server/models/video/video-import.ts index c41085ef9..c5c1a10f4 100644 --- a/server/models/video/video-import.ts +++ b/server/models/video/video-import.ts @@ -15,8 +15,8 @@ import { } from 'sequelize-typescript' import { afterCommitIfTransaction } from '@server/helpers/database-utils' import { MVideoImportDefault, MVideoImportFormattable } from '@server/types/models/video/video-import' +import { VideoImport, VideoImportState } from '@shared/models' import { AttributesOnly } from '@shared/typescript-utils' -import { VideoImport, VideoImportState } from '../../../shared' import { isVideoImportStateValid, isVideoImportTargetUrlValid } from '../../helpers/custom-validators/video-imports' import { isVideoMagnetUriValid } from '../../helpers/custom-validators/videos' import { CONSTRAINTS_FIELDS, VIDEO_IMPORT_STATES } from '../../initializers/constants' diff --git a/server/models/video/video.ts b/server/models/video/video.ts index 66a9a28fa..1f103f930 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts @@ -33,13 +33,22 @@ import { VideoPathManager } from '@server/lib/video-path-manager' import { getServerActor } from '@server/models/application/application' import { ModelCache } from '@server/models/model-cache' 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 { 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 { isActivityPubUrlValid } from '../../helpers/custom-validators/activitypub/misc' import { exists, isBooleanValid } from '../../helpers/custom-validators/misc' diff --git a/shared/index.ts b/shared/index.ts deleted file mode 100644 index ad200c539..000000000 --- a/shared/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './models'