Cleanup models directory organization

This commit is contained in:
Chocobozzz 2021-05-11 11:15:29 +02:00
parent c07902b908
commit 7d9ba5c089
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
91 changed files with 215 additions and 212 deletions

View File

@ -11,7 +11,7 @@ import { VideoRedundancyModel } from '../server/models/redundancy/video-redundan
import * as Bluebird from 'bluebird' import * as Bluebird from 'bluebird'
import { getUUIDFromFilename } from '../server/helpers/utils' import { getUUIDFromFilename } from '../server/helpers/utils'
import { ThumbnailModel } from '../server/models/video/thumbnail' import { ThumbnailModel } from '../server/models/video/thumbnail'
import { ActorImageModel } from '../server/models/account/actor-image' import { ActorImageModel } from '../server/models/actor/actor-image'
import { uniq, values } from 'lodash' import { uniq, values } from 'lodash'
import { ThumbnailType } from '@shared/models' import { ThumbnailType } from '@shared/models'

View File

@ -3,7 +3,7 @@ registerTSPaths()
import * as program from 'commander' import * as program from 'commander'
import { initDatabaseModels } from '../server/initializers/database' import { initDatabaseModels } from '../server/initializers/database'
import { UserModel } from '../server/models/account/user' import { UserModel } from '../server/models/user/user'
import { isUserPasswordValid } from '../server/helpers/custom-validators/users' import { isUserPasswordValid } from '../server/helpers/custom-validators/users'
program program

View File

@ -2,9 +2,9 @@ import { registerTSPaths } from '../server/helpers/register-ts-paths'
registerTSPaths() registerTSPaths()
import { WEBSERVER } from '../server/initializers/constants' import { WEBSERVER } from '../server/initializers/constants'
import { ActorFollowModel } from '../server/models/activitypub/actor-follow' import { ActorFollowModel } from '../server/models/actor/actor-follow'
import { VideoModel } from '../server/models/video/video' import { VideoModel } from '../server/models/video/video'
import { ActorModel } from '../server/models/activitypub/actor' import { ActorModel } from '../server/models/actor/actor'
import { import {
getLocalAccountActivityPubUrl, getLocalAccountActivityPubUrl,
getLocalVideoActivityPubUrl, getLocalVideoActivityPubUrl,

View File

@ -30,7 +30,7 @@ import { videoFileRedundancyGetValidator, videoPlaylistRedundancyGetValidator }
import { videoPlaylistElementAPGetValidator, videoPlaylistsGetValidator } from '../../middlewares/validators/videos/video-playlists' import { videoPlaylistElementAPGetValidator, videoPlaylistsGetValidator } from '../../middlewares/validators/videos/video-playlists'
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 { ActorFollowModel } from '../../models/activitypub/actor-follow' import { ActorFollowModel } from '../../models/actor/actor-follow'
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 { VideoCommentModel } from '../../models/video/video-comment' import { VideoCommentModel } from '../../models/video/video-comment'

View File

@ -1,9 +1,15 @@
import * as express from 'express' import * as express from 'express'
import { getServerActor } from '@server/models/application/application'
import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
import { UserRight } from '../../../../shared/models/users' import { UserRight } from '../../../../shared/models/users'
import { logger } from '../../../helpers/logger' import { logger } from '../../../helpers/logger'
import { getFormattedObjects } from '../../../helpers/utils' import { getFormattedObjects } from '../../../helpers/utils'
import { SERVER_ACTOR_NAME } from '../../../initializers/constants' import { SERVER_ACTOR_NAME } from '../../../initializers/constants'
import { sequelizeTypescript } from '../../../initializers/database'
import { autoFollowBackIfNeeded } from '../../../lib/activitypub/follow'
import { sendAccept, sendReject, sendUndoFollow } from '../../../lib/activitypub/send' import { sendAccept, sendReject, sendUndoFollow } from '../../../lib/activitypub/send'
import { JobQueue } from '../../../lib/job-queue'
import { removeRedundanciesOfServer } from '../../../lib/redundancy'
import { import {
asyncMiddleware, asyncMiddleware,
authenticate, authenticate,
@ -19,16 +25,10 @@ import {
followingSortValidator, followingSortValidator,
followValidator, followValidator,
getFollowerValidator, getFollowerValidator,
removeFollowingValidator, listFollowsValidator,
listFollowsValidator removeFollowingValidator
} from '../../../middlewares/validators' } from '../../../middlewares/validators'
import { ActorFollowModel } from '../../../models/activitypub/actor-follow' import { ActorFollowModel } from '../../../models/actor/actor-follow'
import { JobQueue } from '../../../lib/job-queue'
import { removeRedundanciesOfServer } from '../../../lib/redundancy'
import { sequelizeTypescript } from '../../../initializers/database'
import { autoFollowBackIfNeeded } from '../../../lib/activitypub/follow'
import { getServerActor } from '@server/models/application/application'
import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
const serverFollowsRouter = express.Router() const serverFollowsRouter = express.Router()
serverFollowsRouter.get('/following', serverFollowsRouter.get('/following',

View File

@ -1,7 +1,7 @@
import 'multer' import 'multer'
import * as express from 'express' import * as express from 'express'
import { logger } from '@server/helpers/logger' import { logger } from '@server/helpers/logger'
import { UserNotificationModel } from '@server/models/account/user-notification' import { UserNotificationModel } from '@server/models/user/user-notification'
import { getServerActor } from '@server/models/application/application' import { getServerActor } from '@server/models/application/application'
import { UserRight } from '../../../../shared/models/users' import { UserRight } from '../../../../shared/models/users'
import { getFormattedObjects } from '../../../helpers/utils' import { getFormattedObjects } from '../../../helpers/utils'

View File

@ -45,7 +45,7 @@ import {
usersResetPasswordValidator, usersResetPasswordValidator,
usersVerifyEmailValidator usersVerifyEmailValidator
} from '../../../middlewares/validators' } from '../../../middlewares/validators'
import { UserModel } from '../../../models/account/user' import { UserModel } from '../../../models/user/user'
import { meRouter } from './me' import { meRouter } from './me'
import { myAbusesRouter } from './my-abuses' import { myAbusesRouter } from './my-abuses'
import { myBlocklistRouter } from './my-blocklist' import { myBlocklistRouter } from './my-blocklist'

View File

@ -28,7 +28,7 @@ import { deleteMeValidator, videoImportsSortValidator, videosSortValidator } fro
import { updateAvatarValidator } from '../../../middlewares/validators/actor-image' import { updateAvatarValidator } from '../../../middlewares/validators/actor-image'
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 { UserModel } from '../../../models/account/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'

View File

@ -20,7 +20,7 @@ import {
import { AccountBlocklistModel } from '../../../models/account/account-blocklist' import { AccountBlocklistModel } from '../../../models/account/account-blocklist'
import { addAccountInBlocklist, addServerInBlocklist, removeAccountFromBlocklist, removeServerFromBlocklist } from '../../../lib/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/account/user-notification' import { UserNotificationModel } from '@server/models/user/user-notification'
import { logger } from '@server/helpers/logger' import { logger } from '@server/helpers/logger'
import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'

View File

@ -9,7 +9,7 @@ import {
userHistoryRemoveValidator userHistoryRemoveValidator
} from '../../../middlewares' } from '../../../middlewares'
import { getFormattedObjects } from '../../../helpers/utils' import { getFormattedObjects } from '../../../helpers/utils'
import { UserVideoHistoryModel } from '../../../models/account/user-video-history' import { UserVideoHistoryModel } from '../../../models/user/user-video-history'
import { sequelizeTypescript } from '../../../initializers/database' import { sequelizeTypescript } from '../../../initializers/database'
import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'

View File

@ -1,5 +1,9 @@
import * as express from 'express'
import 'multer' import 'multer'
import * as express from 'express'
import { UserNotificationModel } from '@server/models/user/user-notification'
import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
import { UserNotificationSetting } from '../../../../shared/models/users'
import { getFormattedObjects } from '../../../helpers/utils'
import { import {
asyncMiddleware, asyncMiddleware,
asyncRetryTransactionMiddleware, asyncRetryTransactionMiddleware,
@ -9,17 +13,13 @@ import {
setDefaultSort, setDefaultSort,
userNotificationsSortValidator userNotificationsSortValidator
} from '../../../middlewares' } from '../../../middlewares'
import { getFormattedObjects } from '../../../helpers/utils'
import { UserNotificationModel } from '../../../models/account/user-notification'
import { meRouter } from './me'
import { import {
listUserNotificationsValidator, listUserNotificationsValidator,
markAsReadUserNotificationsValidator, markAsReadUserNotificationsValidator,
updateNotificationSettingsValidator updateNotificationSettingsValidator
} from '../../../middlewares/validators/user-notifications' } from '../../../middlewares/validators/user-notifications'
import { UserNotificationSetting } from '../../../../shared/models/users' import { UserNotificationSettingModel } from '../../../models/user/user-notification-setting'
import { UserNotificationSettingModel } from '../../../models/account/user-notification-setting' import { meRouter } from './me'
import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
const myNotificationsRouter = express.Router() const myNotificationsRouter = express.Router()

View File

@ -27,7 +27,7 @@ import {
userSubscriptionsSortValidator, userSubscriptionsSortValidator,
videosSortValidator videosSortValidator
} from '../../../middlewares/validators' } from '../../../middlewares/validators'
import { ActorFollowModel } from '../../../models/activitypub/actor-follow' import { ActorFollowModel } from '../../../models/actor/actor-follow'
import { VideoModel } from '../../../models/video/video' import { VideoModel } from '../../../models/video/video'
const mySubscriptionsRouter = express.Router() const mySubscriptionsRouter = express.Router()

View File

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

View File

@ -7,7 +7,7 @@ import { LAZY_STATIC_PATHS, STATIC_MAX_AGE } from '../initializers/constants'
import { actorImagePathUnsafeCache, pushActorImageProcessInQueue } from '../lib/actor-image' import { actorImagePathUnsafeCache, pushActorImageProcessInQueue } from '../lib/actor-image'
import { VideosCaptionCache, VideosPreviewCache } from '../lib/files-cache' import { VideosCaptionCache, VideosPreviewCache } from '../lib/files-cache'
import { asyncMiddleware } from '../middlewares' import { asyncMiddleware } from '../middlewares'
import { ActorImageModel } from '../models/account/actor-image' import { ActorImageModel } from '../models/actor/actor-image'
const lazyStaticRouter = express.Router() const lazyStaticRouter = express.Router()

View File

@ -20,7 +20,7 @@ import {
import { getThemeOrDefault } from '../lib/plugins/theme-utils' import { getThemeOrDefault } from '../lib/plugins/theme-utils'
import { asyncMiddleware } from '../middlewares' import { asyncMiddleware } from '../middlewares'
import { cacheRoute } from '../middlewares/cache' import { cacheRoute } from '../middlewares/cache'
import { UserModel } from '../models/account/user' import { UserModel } from '../models/user/user'
import { VideoModel } from '../models/video/video' import { VideoModel } from '../models/video/video'
import { VideoCommentModel } from '../models/video/video-comment' import { VideoCommentModel } from '../models/video/video-comment'

View File

@ -1,5 +1,5 @@
import { ActorModel } from '../models/activitypub/actor' import { ActorModel } from '../models/actor/actor'
import { MActorAccountChannelId, MActorFull } from '../types/models' import { MActorAccountChannelId, MActorFull } from '../types/models'
type ActorFetchByUrlType = 'all' | 'association-ids' type ActorFetchByUrlType = 'all' | 'association-ids'

View File

@ -1,5 +1,5 @@
import { Response } from 'express' import { Response } from 'express'
import { UserModel } from '@server/models/account/user' import { UserModel } from '@server/models/user/user'
import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
import { AccountModel } from '../../models/account/account' import { AccountModel } from '../../models/account/account'
import { MAccountDefault } from '../../types/models' import { MAccountDefault } from '../../types/models'

View File

@ -1,4 +1,4 @@
import { UserModel } from '../models/account/user' import { UserModel } from '../models/user/user'
import * as ipaddr from 'ipaddr.js' import * as ipaddr from 'ipaddr.js'
import { CONFIG } from '../initializers/config' import { CONFIG } from '../initializers/config'

View File

@ -1,10 +1,10 @@
import * as WebFinger from 'webfinger.js' import * as WebFinger from 'webfinger.js'
import { WebFingerData } from '../../shared' import { WebFingerData } from '../../shared'
import { ActorModel } from '../models/activitypub/actor' import { WEBSERVER } from '../initializers/constants'
import { ActorModel } from '../models/actor/actor'
import { MActorFull } from '../types/models'
import { isTestInstance } from './core-utils' import { isTestInstance } from './core-utils'
import { isActivityPubUrlValid } from './custom-validators/activitypub/misc' import { isActivityPubUrlValid } from './custom-validators/activitypub/misc'
import { WEBSERVER } from '../initializers/constants'
import { MActorFull } from '../types/models'
const webfinger = new WebFinger({ const webfinger = new WebFinger({
webfist_fallback: false, webfist_fallback: false,

View File

@ -7,7 +7,7 @@ import { RecentlyAddedStrategy } from '../../shared/models/redundancy'
import { isProdInstance, isTestInstance, parseSemVersion } from '../helpers/core-utils' import { isProdInstance, isTestInstance, parseSemVersion } from '../helpers/core-utils'
import { isArray } from '../helpers/custom-validators/misc' import { isArray } from '../helpers/custom-validators/misc'
import { logger } from '../helpers/logger' import { logger } from '../helpers/logger'
import { UserModel } from '../models/account/user' import { UserModel } from '../models/user/user'
import { ApplicationModel, getServerActor } from '../models/application/application' import { ApplicationModel, getServerActor } from '../models/application/application'
import { OAuthClientModel } from '../models/oauth/oauth-client' import { OAuthClientModel } from '../models/oauth/oauth-client'
import { CONFIG, isEmailEnabled } from './config' import { CONFIG, isEmailEnabled } from './config'

View File

@ -2,6 +2,9 @@ import { QueryTypes, Transaction } from 'sequelize'
import { Sequelize as SequelizeTypescript } from 'sequelize-typescript' import { Sequelize as SequelizeTypescript } from 'sequelize-typescript'
import { TrackerModel } from '@server/models/server/tracker' import { TrackerModel } from '@server/models/server/tracker'
import { VideoTrackerModel } from '@server/models/server/video-tracker' import { VideoTrackerModel } from '@server/models/server/video-tracker'
import { UserModel } from '@server/models/user/user'
import { UserNotificationModel } from '@server/models/user/user-notification'
import { UserVideoHistoryModel } from '@server/models/user/user-video-history'
import { isTestInstance } from '../helpers/core-utils' import { isTestInstance } from '../helpers/core-utils'
import { logger } from '../helpers/logger' import { logger } from '../helpers/logger'
import { AbuseModel } from '../models/abuse/abuse' import { AbuseModel } from '../models/abuse/abuse'
@ -11,13 +14,9 @@ import { VideoCommentAbuseModel } from '../models/abuse/video-comment-abuse'
import { AccountModel } from '../models/account/account' import { AccountModel } from '../models/account/account'
import { AccountBlocklistModel } from '../models/account/account-blocklist' import { AccountBlocklistModel } from '../models/account/account-blocklist'
import { AccountVideoRateModel } from '../models/account/account-video-rate' import { AccountVideoRateModel } from '../models/account/account-video-rate'
import { ActorImageModel } from '../models/account/actor-image' import { ActorModel } from '../models/actor/actor'
import { UserModel } from '../models/account/user' import { ActorFollowModel } from '../models/actor/actor-follow'
import { UserNotificationModel } from '../models/account/user-notification' import { ActorImageModel } from '../models/actor/actor-image'
import { UserNotificationSettingModel } from '../models/account/user-notification-setting'
import { UserVideoHistoryModel } from '../models/account/user-video-history'
import { ActorModel } from '../models/activitypub/actor'
import { ActorFollowModel } from '../models/activitypub/actor-follow'
import { ApplicationModel } from '../models/application/application' import { ApplicationModel } from '../models/application/application'
import { OAuthClientModel } from '../models/oauth/oauth-client' import { OAuthClientModel } from '../models/oauth/oauth-client'
import { OAuthTokenModel } from '../models/oauth/oauth-token' import { OAuthTokenModel } from '../models/oauth/oauth-token'
@ -25,6 +24,7 @@ import { VideoRedundancyModel } from '../models/redundancy/video-redundancy'
import { PluginModel } from '../models/server/plugin' import { PluginModel } from '../models/server/plugin'
import { ServerModel } from '../models/server/server' import { ServerModel } from '../models/server/server'
import { ServerBlocklistModel } from '../models/server/server-blocklist' import { ServerBlocklistModel } from '../models/server/server-blocklist'
import { UserNotificationSettingModel } from '../models/user/user-notification-setting'
import { ScheduleVideoUpdateModel } from '../models/video/schedule-video-update' import { ScheduleVideoUpdateModel } from '../models/video/schedule-video-update'
import { TagModel } from '../models/video/tag' import { TagModel } from '../models/video/tag'
import { ThumbnailModel } from '../models/video/thumbnail' import { ThumbnailModel } from '../models/video/thumbnail'

View File

@ -2,7 +2,7 @@ import * as passwordGenerator from 'password-generator'
import { UserRole } from '../../shared' import { UserRole } from '../../shared'
import { logger } from '../helpers/logger' import { logger } from '../helpers/logger'
import { createApplicationActor, createUserAccountAndChannelAndPlaylist } from '../lib/user' import { createApplicationActor, createUserAccountAndChannelAndPlaylist } from '../lib/user'
import { UserModel } from '../models/account/user' import { UserModel } from '../models/user/user'
import { ApplicationModel } from '../models/application/application' import { ApplicationModel } from '../models/application/application'
import { OAuthClientModel } from '../models/oauth/oauth-client' import { OAuthClientModel } from '../models/oauth/oauth-client'
import { applicationExist, clientsExist, usersExist } from './checker-after-init' import { applicationExist, clientsExist, usersExist } from './checker-after-init'

View File

@ -20,8 +20,8 @@ import { getUrlFromWebfinger } from '../../helpers/webfinger'
import { MIMETYPES, WEBSERVER } from '../../initializers/constants' import { MIMETYPES, WEBSERVER } from '../../initializers/constants'
import { sequelizeTypescript } from '../../initializers/database' import { sequelizeTypescript } from '../../initializers/database'
import { AccountModel } from '../../models/account/account' import { AccountModel } from '../../models/account/account'
import { ActorImageModel } from '../../models/account/actor-image' import { ActorModel } from '../../models/actor/actor'
import { ActorModel } from '../../models/activitypub/actor' import { ActorImageModel } from '../../models/actor/actor-image'
import { ServerModel } from '../../models/server/server' import { ServerModel } from '../../models/server/server'
import { VideoChannelModel } from '../../models/video/video-channel' import { VideoChannelModel } from '../../models/video/video-channel'
import { import {

View File

@ -1,7 +1,7 @@
import { Transaction } from 'sequelize' import { Transaction } from 'sequelize'
import { ActivityAudience } from '../../../shared/models/activitypub' import { ActivityAudience } from '../../../shared/models/activitypub'
import { ACTIVITY_PUB } from '../../initializers/constants' import { ACTIVITY_PUB } from '../../initializers/constants'
import { ActorModel } from '../../models/activitypub/actor' import { ActorModel } from '../../models/actor/actor'
import { VideoModel } from '../../models/video/video' import { VideoModel } from '../../models/video/video'
import { VideoShareModel } from '../../models/video/video-share' import { VideoShareModel } from '../../models/video/video-share'
import { MActorFollowersUrl, MActorLight, MActorUrl, MCommentOwner, MCommentOwnerVideo, MVideoId } from '../../types/models' import { MActorFollowersUrl, MActorLight, MActorUrl, MCommentOwner, MCommentOwnerVideo, MVideoId } from '../../types/models'

View File

@ -1,8 +1,8 @@
import { ActivityAccept } from '../../../../shared/models/activitypub' import { ActivityAccept } from '../../../../shared/models/activitypub'
import { ActorFollowModel } from '../../../models/activitypub/actor-follow' import { ActorFollowModel } from '../../../models/actor/actor-follow'
import { addFetchOutboxJob } from '../actor'
import { APProcessorOptions } from '../../../types/activitypub-processor.model' import { APProcessorOptions } from '../../../types/activitypub-processor.model'
import { MActorDefault, MActorSignature } from '../../../types/models' import { MActorDefault, MActorSignature } from '../../../types/models'
import { addFetchOutboxJob } from '../actor'
async function processAcceptActivity (options: APProcessorOptions<ActivityAccept>) { async function processAcceptActivity (options: APProcessorOptions<ActivityAccept>) {
const { byActor: targetActor, inboxActor } = options const { byActor: targetActor, inboxActor } = options

View File

@ -2,7 +2,7 @@ import { ActivityDelete } from '../../../../shared/models/activitypub'
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'
import { ActorModel } from '../../../models/activitypub/actor' import { ActorModel } from '../../../models/actor/actor'
import { VideoModel } from '../../../models/video/video' import { VideoModel } from '../../../models/video/video'
import { VideoCommentModel } from '../../../models/video/video-comment' import { VideoCommentModel } from '../../../models/video/video-comment'
import { VideoPlaylistModel } from '../../../models/video/video-playlist' import { VideoPlaylistModel } from '../../../models/video/video-playlist'

View File

@ -1,17 +1,17 @@
import { getServerActor } from '@server/models/application/application'
import { ActivityFollow } from '../../../../shared/models/activitypub' import { ActivityFollow } from '../../../../shared/models/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'
import { sequelizeTypescript } from '../../../initializers/database'
import { ActorModel } from '../../../models/activitypub/actor'
import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
import { sendAccept, sendReject } from '../send'
import { Notifier } from '../../notifier'
import { getAPId } from '../../../helpers/activitypub'
import { CONFIG } from '../../../initializers/config' import { CONFIG } from '../../../initializers/config'
import { sequelizeTypescript } from '../../../initializers/database'
import { ActorModel } from '../../../models/actor/actor'
import { ActorFollowModel } from '../../../models/actor/actor-follow'
import { APProcessorOptions } from '../../../types/activitypub-processor.model' import { APProcessorOptions } from '../../../types/activitypub-processor.model'
import { MActorFollowActors, MActorSignature } from '../../../types/models' import { MActorFollowActors, MActorSignature } from '../../../types/models'
import { Notifier } from '../../notifier'
import { autoFollowBackIfNeeded } from '../follow' import { autoFollowBackIfNeeded } from '../follow'
import { getServerActor } from '@server/models/application/application' import { sendAccept, sendReject } from '../send'
async function processFollowActivity (options: APProcessorOptions<ActivityFollow>) { async function processFollowActivity (options: APProcessorOptions<ActivityFollow>) {
const { activity, byActor } = options const { activity, byActor } = options

View File

@ -1,6 +1,6 @@
import { ActivityReject } from '../../../../shared/models/activitypub/activity' import { ActivityReject } from '../../../../shared/models/activitypub/activity'
import { sequelizeTypescript } from '../../../initializers/database' import { sequelizeTypescript } from '../../../initializers/database'
import { ActorFollowModel } from '../../../models/activitypub/actor-follow' import { ActorFollowModel } from '../../../models/actor/actor-follow'
import { APProcessorOptions } from '../../../types/activitypub-processor.model' import { APProcessorOptions } from '../../../types/activitypub-processor.model'
import { MActor } from '../../../types/models' import { MActor } from '../../../types/models'

View File

@ -4,8 +4,8 @@ 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'
import { AccountVideoRateModel } from '../../../models/account/account-video-rate' import { AccountVideoRateModel } from '../../../models/account/account-video-rate'
import { ActorModel } from '../../../models/activitypub/actor' import { ActorModel } from '../../../models/actor/actor'
import { ActorFollowModel } from '../../../models/activitypub/actor-follow' import { ActorFollowModel } from '../../../models/actor/actor-follow'
import { VideoRedundancyModel } from '../../../models/redundancy/video-redundancy' import { VideoRedundancyModel } from '../../../models/redundancy/video-redundancy'
import { VideoShareModel } from '../../../models/video/video-share' import { VideoShareModel } from '../../../models/video/video-share'
import { APProcessorOptions } from '../../../types/activitypub-processor.model' import { APProcessorOptions } from '../../../types/activitypub-processor.model'

View File

@ -1,23 +1,23 @@
import { isRedundancyAccepted } from '@server/lib/redundancy'
import { ActorImageType } from '@shared/models'
import { ActivityUpdate, CacheFileObject, VideoObject } from '../../../../shared/models/activitypub' import { ActivityUpdate, CacheFileObject, VideoObject } from '../../../../shared/models/activitypub'
import { ActivityPubActor } from '../../../../shared/models/activitypub/activitypub-actor' import { ActivityPubActor } from '../../../../shared/models/activitypub/activitypub-actor'
import { PlaylistObject } from '../../../../shared/models/activitypub/objects/playlist-object'
import { isCacheFileObjectValid } from '../../../helpers/custom-validators/activitypub/cache-file'
import { sanitizeAndCheckVideoTorrentObject } from '../../../helpers/custom-validators/activitypub/videos'
import { resetSequelizeInstance, retryTransactionWrapper } from '../../../helpers/database-utils' import { resetSequelizeInstance, 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'
import { AccountModel } from '../../../models/account/account' import { AccountModel } from '../../../models/account/account'
import { ActorModel } from '../../../models/activitypub/actor' import { ActorModel } from '../../../models/actor/actor'
import { VideoChannelModel } from '../../../models/video/video-channel' import { VideoChannelModel } from '../../../models/video/video-channel'
import { getImageInfoIfExists, updateActorImageInstance, updateActorInstance } from '../actor'
import { getOrCreateVideoAndAccountAndChannel, getOrCreateVideoChannelFromVideoObject, updateVideoFromAP } from '../videos'
import { sanitizeAndCheckVideoTorrentObject } from '../../../helpers/custom-validators/activitypub/videos'
import { isCacheFileObjectValid } from '../../../helpers/custom-validators/activitypub/cache-file'
import { createOrUpdateCacheFile } from '../cache-file'
import { forwardVideoRelatedActivity } from '../send/utils'
import { PlaylistObject } from '../../../../shared/models/activitypub/objects/playlist-object'
import { createOrUpdateVideoPlaylist } from '../playlist'
import { APProcessorOptions } from '../../../types/activitypub-processor.model' import { APProcessorOptions } from '../../../types/activitypub-processor.model'
import { MActorSignature, MAccountIdActor } from '../../../types/models' import { MAccountIdActor, MActorSignature } from '../../../types/models'
import { isRedundancyAccepted } from '@server/lib/redundancy' import { getImageInfoIfExists, updateActorImageInstance, updateActorInstance } from '../actor'
import { ActorImageType } from '@shared/models' import { createOrUpdateCacheFile } from '../cache-file'
import { createOrUpdateVideoPlaylist } from '../playlist'
import { forwardVideoRelatedActivity } from '../send/utils'
import { getOrCreateVideoAndAccountAndChannel, getOrCreateVideoChannelFromVideoObject, updateVideoFromAP } from '../videos'
async function processUpdateActivity (options: APProcessorOptions<ActivityUpdate>) { async function processUpdateActivity (options: APProcessorOptions<ActivityUpdate>) {
const { activity, byActor } = options const { activity, byActor } = options

View File

@ -2,7 +2,7 @@ import { Transaction } from 'sequelize'
import { getServerActor } from '@server/models/application/application' import { getServerActor } from '@server/models/application/application'
import { ActivityAudience, ActivityDelete } from '../../../../shared/models/activitypub' import { ActivityAudience, ActivityDelete } from '../../../../shared/models/activitypub'
import { logger } from '../../../helpers/logger' import { logger } from '../../../helpers/logger'
import { ActorModel } from '../../../models/activitypub/actor' import { ActorModel } from '../../../models/actor/actor'
import { VideoCommentModel } from '../../../models/video/video-comment' import { VideoCommentModel } from '../../../models/video/video-comment'
import { VideoShareModel } from '../../../models/video/video-share' import { VideoShareModel } from '../../../models/video/video-share'
import { MActorUrl } from '../../../types/models' import { MActorUrl } from '../../../types/models'

View File

@ -2,7 +2,7 @@ import { Transaction } from 'sequelize'
import { MActorAudience, MVideoImmutable, MVideoUrl } from '@server/types/models' import { MActorAudience, MVideoImmutable, MVideoUrl } from '@server/types/models'
import { ActivityAudience, ActivityView } from '../../../../shared/models/activitypub' import { ActivityAudience, ActivityView } from '../../../../shared/models/activitypub'
import { logger } from '../../../helpers/logger' import { logger } from '../../../helpers/logger'
import { ActorModel } from '../../../models/activitypub/actor' import { ActorModel } from '../../../models/actor/actor'
import { audiencify, getAudience } from '../audience' import { audiencify, getAudience } from '../audience'
import { getLocalVideoViewActivityPubUrl } from '../url' import { getLocalVideoViewActivityPubUrl } from '../url'
import { sendVideoRelatedActivity } from './utils' import { sendVideoRelatedActivity } from './utils'

View File

@ -1,14 +1,14 @@
import { Transaction } from 'sequelize' import { Transaction } from 'sequelize'
import { Activity, ActivityAudience } from '../../../../shared/models/activitypub'
import { logger } from '../../../helpers/logger'
import { ActorModel } from '../../../models/activitypub/actor'
import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
import { JobQueue } from '../../job-queue'
import { getActorsInvolvedInVideo, getAudienceFromFollowersOf, getRemoteVideoAudience } from '../audience'
import { afterCommitIfTransaction } from '../../../helpers/database-utils'
import { MActor, MActorId, MActorLight, MActorWithInboxes, MVideoAccountLight, MVideoId, MVideoImmutable } from '../../../types/models'
import { getServerActor } from '@server/models/application/application' import { getServerActor } from '@server/models/application/application'
import { ContextType } from '@shared/models/activitypub/context' import { ContextType } from '@shared/models/activitypub/context'
import { Activity, ActivityAudience } from '../../../../shared/models/activitypub'
import { afterCommitIfTransaction } from '../../../helpers/database-utils'
import { logger } from '../../../helpers/logger'
import { ActorModel } from '../../../models/actor/actor'
import { ActorFollowModel } from '../../../models/actor/actor-follow'
import { MActor, MActorId, MActorLight, MActorWithInboxes, MVideoAccountLight, MVideoId, MVideoImmutable } from '../../../types/models'
import { JobQueue } from '../../job-queue'
import { getActorsInvolvedInVideo, getAudienceFromFollowersOf, getRemoteVideoAudience } from '../audience'
async function sendVideoRelatedActivity (activityBuilder: (audience: ActivityAudience) => Activity, options: { async function sendVideoRelatedActivity (activityBuilder: (audience: ActivityAudience) => Activity, options: {
byActor: MActorLight byActor: MActorLight

View File

@ -1,7 +1,7 @@
import * as express from 'express' import * as express from 'express'
import { AccessDeniedError } from 'oauth2-server' import { AccessDeniedError } from 'oauth2-server'
import { PluginManager } from '@server/lib/plugins/plugin-manager' import { PluginManager } from '@server/lib/plugins/plugin-manager'
import { ActorModel } from '@server/models/activitypub/actor' import { ActorModel } from '@server/models/actor/actor'
import { MOAuthClient } from '@server/types/models' import { MOAuthClient } from '@server/types/models'
import { MOAuthTokenUser } from '@server/types/models/oauth/oauth-token' import { MOAuthTokenUser } from '@server/types/models/oauth/oauth-token'
import { MUser } from '@server/types/models/user/user' import { MUser } from '@server/types/models/user/user'
@ -9,7 +9,7 @@ import { UserAdminFlag } from '@shared/models/users/user-flag.model'
import { UserRole } from '@shared/models/users/user-role' import { UserRole } from '@shared/models/users/user-role'
import { logger } from '../../helpers/logger' import { logger } from '../../helpers/logger'
import { CONFIG } from '../../initializers/config' import { CONFIG } from '../../initializers/config'
import { UserModel } from '../../models/account/user' import { UserModel } from '../../models/user/user'
import { OAuthClientModel } from '../../models/oauth/oauth-client' import { OAuthClientModel } from '../../models/oauth/oauth-client'
import { OAuthTokenModel } from '../../models/oauth/oauth-token' import { OAuthTokenModel } from '../../models/oauth/oauth-token'
import { createUserAccountAndChannelAndPlaylist } from '../user' import { createUserAccountAndChannelAndPlaylist } from '../user'

View File

@ -1,18 +1,18 @@
import * as Bull from 'bull' import * as Bull from 'bull'
import { logger } from '../../../helpers/logger'
import { REMOTE_SCHEME, WEBSERVER } from '../../../initializers/constants'
import { sendFollow } from '../../activitypub/send'
import { sanitizeHost } from '../../../helpers/core-utils'
import { loadActorUrlOrGetFromWebfinger } from '../../../helpers/webfinger'
import { getOrCreateActorAndServerAndModel } from '../../activitypub/actor'
import { retryTransactionWrapper } from '../../../helpers/database-utils'
import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
import { ActorModel } from '../../../models/activitypub/actor'
import { Notifier } from '../../notifier'
import { sequelizeTypescript } from '../../../initializers/database'
import { MActor, MActorFollowActors, MActorFull } from '../../../types/models'
import { ActivitypubFollowPayload } from '@shared/models'
import { getLocalActorFollowActivityPubUrl } from '@server/lib/activitypub/url' import { getLocalActorFollowActivityPubUrl } from '@server/lib/activitypub/url'
import { ActivitypubFollowPayload } from '@shared/models'
import { sanitizeHost } from '../../../helpers/core-utils'
import { retryTransactionWrapper } from '../../../helpers/database-utils'
import { logger } from '../../../helpers/logger'
import { loadActorUrlOrGetFromWebfinger } from '../../../helpers/webfinger'
import { REMOTE_SCHEME, WEBSERVER } from '../../../initializers/constants'
import { sequelizeTypescript } from '../../../initializers/database'
import { ActorModel } from '../../../models/actor/actor'
import { ActorFollowModel } from '../../../models/actor/actor-follow'
import { MActor, MActorFollowActors, MActorFull } from '../../../types/models'
import { getOrCreateActorAndServerAndModel } from '../../activitypub/actor'
import { sendFollow } from '../../activitypub/send'
import { Notifier } from '../../notifier'
async function processActivityPubFollow (job: Bull.Job) { async function processActivityPubFollow (job: Bull.Job) {
const payload = job.data as ActivitypubFollowPayload const payload = job.data as ActivitypubFollowPayload

View File

@ -1,12 +1,12 @@
import * as Bull from 'bull' import * as Bull from 'bull'
import { refreshVideoPlaylistIfNeeded } from '@server/lib/activitypub/playlist'
import { RefreshPayload } from '@shared/models'
import { logger } from '../../../helpers/logger' import { logger } from '../../../helpers/logger'
import { fetchVideoByUrl } from '../../../helpers/video' import { fetchVideoByUrl } from '../../../helpers/video'
import { ActorModel } from '../../../models/actor/actor'
import { VideoPlaylistModel } from '../../../models/video/video-playlist'
import { refreshActorIfNeeded } from '../../activitypub/actor' import { refreshActorIfNeeded } from '../../activitypub/actor'
import { refreshVideoIfNeeded } from '../../activitypub/videos' import { refreshVideoIfNeeded } from '../../activitypub/videos'
import { ActorModel } from '../../../models/activitypub/actor'
import { VideoPlaylistModel } from '../../../models/video/video-playlist'
import { RefreshPayload } from '@shared/models'
import { refreshVideoPlaylistIfNeeded } from '@server/lib/activitypub/playlist'
async function refreshAPObject (job: Bull.Job) { async function refreshAPObject (job: Bull.Job) {
const payload = job.data as RefreshPayload const payload = job.data as RefreshPayload

View File

@ -1,6 +1,6 @@
import * as Bull from 'bull' import * as Bull from 'bull'
import { generateAndSaveActorKeys } from '@server/lib/activitypub/actor' import { generateAndSaveActorKeys } from '@server/lib/activitypub/actor'
import { ActorModel } from '@server/models/activitypub/actor' import { ActorModel } from '@server/models/actor/actor'
import { ActorKeysPayload } from '@shared/models' import { ActorKeysPayload } from '@shared/models'
import { logger } from '../../../helpers/logger' import { logger } from '../../../helpers/logger'

View File

@ -1,10 +1,10 @@
import { buildSignedActivity } from '../../../../helpers/activitypub'
import { ActorModel } from '../../../../models/activitypub/actor'
import { ACTIVITY_PUB, HTTP_SIGNATURE } from '../../../../initializers/constants'
import { MActor } from '../../../../types/models'
import { getServerActor } from '@server/models/application/application'
import { buildDigest } from '@server/helpers/peertube-crypto' import { buildDigest } from '@server/helpers/peertube-crypto'
import { getServerActor } from '@server/models/application/application'
import { ContextType } from '@shared/models/activitypub/context' import { ContextType } from '@shared/models/activitypub/context'
import { buildSignedActivity } from '../../../../helpers/activitypub'
import { ACTIVITY_PUB, HTTP_SIGNATURE } from '../../../../initializers/constants'
import { ActorModel } from '../../../../models/actor/actor'
import { MActor } from '../../../../types/models'
type Payload <T> = { body: T, contextType?: ContextType, signatureActorId?: number } type Payload <T> = { body: T, contextType?: ContextType, signatureActorId?: number }

View File

@ -3,7 +3,7 @@ import { copy, stat } from 'fs-extra'
import { extname } from 'path' import { extname } from 'path'
import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent' import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent'
import { generateVideoFilename, getVideoFilePath } from '@server/lib/video-paths' import { generateVideoFilename, getVideoFilePath } from '@server/lib/video-paths'
import { UserModel } from '@server/models/account/user' import { UserModel } from '@server/models/user/user'
import { MVideoFullLight } from '@server/types/models' import { MVideoFullLight } from '@server/types/models'
import { VideoFileImportPayload } from '@shared/models' import { VideoFileImportPayload } from '@shared/models'
import { getVideoFileFPS, getVideoFileResolution } from '../../../helpers/ffprobe-utils' import { getVideoFileFPS, getVideoFileResolution } from '../../../helpers/ffprobe-utils'

View File

@ -2,7 +2,7 @@ import * as Bull from 'bull'
import { TranscodeOptionsType } from '@server/helpers/ffmpeg-utils' import { TranscodeOptionsType } from '@server/helpers/ffmpeg-utils'
import { getTranscodingJobPriority, publishAndFederateIfNeeded } from '@server/lib/video' import { getTranscodingJobPriority, publishAndFederateIfNeeded } from '@server/lib/video'
import { getVideoFilePath } from '@server/lib/video-paths' import { getVideoFilePath } from '@server/lib/video-paths'
import { UserModel } from '@server/models/account/user' import { UserModel } from '@server/models/user/user'
import { MUser, MUserId, MVideoFullLight, MVideoUUID, MVideoWithFile } from '@server/types/models' import { MUser, MUserId, MVideoFullLight, MVideoUUID, MVideoWithFile } from '@server/types/models'
import { import {
HLSTranscodingPayload, HLSTranscodingPayload,

View File

@ -11,7 +11,7 @@ import { computeResolutionsToTranscode, getVideoFileFPS, getVideoFileResolution
import { logger } from '@server/helpers/logger' import { logger } from '@server/helpers/logger'
import { CONFIG, registerConfigChangedHandler } from '@server/initializers/config' import { CONFIG, registerConfigChangedHandler } from '@server/initializers/config'
import { MEMOIZE_TTL, P2P_MEDIA_LOADER_PEER_VERSION, VIDEO_LIVE, VIEW_LIFETIME, WEBSERVER } from '@server/initializers/constants' import { MEMOIZE_TTL, P2P_MEDIA_LOADER_PEER_VERSION, VIDEO_LIVE, VIEW_LIFETIME, WEBSERVER } from '@server/initializers/constants'
import { UserModel } from '@server/models/account/user' import { UserModel } from '@server/models/user/user'
import { VideoModel } from '@server/models/video/video' import { VideoModel } from '@server/models/video/video'
import { VideoFileModel } from '@server/models/video/video-file' import { VideoFileModel } from '@server/models/video/video-file'
import { VideoLiveModel } from '@server/models/video/video-live' import { VideoLiveModel } from '@server/models/video/video-live'

View File

@ -24,8 +24,8 @@ import { VideoObject } from '../../shared/models/activitypub/objects'
import { VideoCommentObject } from '../../shared/models/activitypub/objects/video-comment-object' import { VideoCommentObject } from '../../shared/models/activitypub/objects/video-comment-object'
import { LiveVideoCreate, VideoCreate, VideoImportCreate } from '../../shared/models/videos' import { LiveVideoCreate, VideoCreate, VideoImportCreate } from '../../shared/models/videos'
import { VideoCommentCreate } from '../../shared/models/videos/video-comment.model' import { VideoCommentCreate } from '../../shared/models/videos/video-comment.model'
import { UserModel } from '../models/account/user' import { UserModel } from '../models/user/user'
import { ActorModel } from '../models/activitypub/actor' import { ActorModel } from '../models/actor/actor'
import { VideoModel } from '../models/video/video' import { VideoModel } from '../models/video/video'
import { VideoCommentModel } from '../models/video/video-comment' import { VideoCommentModel } from '../models/video/video-comment'
import { sendAbuse } from './activitypub/send/send-flag' import { sendAbuse } from './activitypub/send/send-flag'

View File

@ -17,8 +17,8 @@ import { VideoPrivacy, VideoState } from '../../shared/models/videos'
import { logger } from '../helpers/logger' import { logger } from '../helpers/logger'
import { CONFIG } from '../initializers/config' import { CONFIG } from '../initializers/config'
import { AccountBlocklistModel } from '../models/account/account-blocklist' import { AccountBlocklistModel } from '../models/account/account-blocklist'
import { UserModel } from '../models/account/user' import { UserModel } from '../models/user/user'
import { UserNotificationModel } from '../models/account/user-notification' import { UserNotificationModel } from '../models/user/user-notification'
import { MAbuseFull, MAbuseMessage, MAccountServer, MActorFollowFull, MApplication, MPlugin } from '../types/models' import { MAbuseFull, MAbuseMessage, MAccountServer, MActorFollowFull, MApplication, MPlugin } from '../types/models'
import { MCommentOwnerVideo, MVideoAccountLight, MVideoFullLight } from '../types/models/video' import { MCommentOwnerVideo, MVideoAccountLight, MVideoFullLight } from '../types/models/video'
import { isBlockedByServerOrAccount } from './blocklist' import { isBlockedByServerOrAccount } from './blocklist'

View File

@ -17,7 +17,7 @@ import { VideoBlacklistCreate } from '@shared/models'
import { addAccountInBlocklist, addServerInBlocklist, removeAccountFromBlocklist, removeServerFromBlocklist } from '../blocklist' import { addAccountInBlocklist, addServerInBlocklist, removeAccountFromBlocklist, removeServerFromBlocklist } from '../blocklist'
import { getServerConfig } from '../config' import { getServerConfig } from '../config'
import { blacklistVideo, unblacklistVideo } from '../video-blacklist' import { blacklistVideo, unblacklistVideo } from '../video-blacklist'
import { UserModel } from '@server/models/account/user' import { UserModel } from '@server/models/user/user'
function buildPluginHelpers (pluginModel: MPlugin, npmName: string): PeerTubeHelpers { function buildPluginHelpers (pluginModel: MPlugin, npmName: string): PeerTubeHelpers {
const logger = buildPluginLogger(npmName) const logger = buildPluginLogger(npmName)

View File

@ -1,12 +1,12 @@
import { Transaction } from 'sequelize'
import { logger } from '@server/helpers/logger'
import { CONFIG } from '@server/initializers/config'
import { ActorFollowModel } from '@server/models/actor/actor-follow'
import { getServerActor } from '@server/models/application/application'
import { MActorSignature, MVideoRedundancyVideo } from '@server/types/models'
import { Activity } from '@shared/models'
import { VideoRedundancyModel } from '../models/redundancy/video-redundancy' import { VideoRedundancyModel } from '../models/redundancy/video-redundancy'
import { sendUndoCacheFile } from './activitypub/send' import { sendUndoCacheFile } from './activitypub/send'
import { Transaction } from 'sequelize'
import { MActorSignature, MVideoRedundancyVideo } from '@server/types/models'
import { CONFIG } from '@server/initializers/config'
import { logger } from '@server/helpers/logger'
import { ActorFollowModel } from '@server/models/activitypub/actor-follow'
import { Activity } from '@shared/models'
import { getServerActor } from '@server/models/application/application'
async function removeVideoRedundancy (videoRedundancy: MVideoRedundancyVideo, t?: Transaction) { async function removeVideoRedundancy (videoRedundancy: MVideoRedundancyVideo, t?: Transaction) {
const serverActor = await getServerActor() const serverActor = await getServerActor()

View File

@ -1,9 +1,9 @@
import { isTestInstance } from '../../helpers/core-utils' import { isTestInstance } from '../../helpers/core-utils'
import { logger } from '../../helpers/logger' import { logger } from '../../helpers/logger'
import { ActorFollowModel } from '../../models/activitypub/actor-follow'
import { AbstractScheduler } from './abstract-scheduler'
import { ACTOR_FOLLOW_SCORE, SCHEDULER_INTERVALS_MS } from '../../initializers/constants' import { ACTOR_FOLLOW_SCORE, SCHEDULER_INTERVALS_MS } from '../../initializers/constants'
import { ActorFollowModel } from '../../models/actor/actor-follow'
import { ActorFollowScoreCache } from '../files-cache' import { ActorFollowScoreCache } from '../files-cache'
import { AbstractScheduler } from './abstract-scheduler'
export class ActorFollowScheduler extends AbstractScheduler { export class ActorFollowScheduler extends AbstractScheduler {

View File

@ -1,7 +1,7 @@
import { chunk } from 'lodash' import { chunk } from 'lodash'
import { doJSONRequest } from '@server/helpers/requests' import { doJSONRequest } from '@server/helpers/requests'
import { JobQueue } from '@server/lib/job-queue' import { JobQueue } from '@server/lib/job-queue'
import { ActorFollowModel } from '@server/models/activitypub/actor-follow' import { ActorFollowModel } from '@server/models/actor/actor-follow'
import { getServerActor } from '@server/models/application/application' import { getServerActor } from '@server/models/application/application'
import { logger } from '../../helpers/logger' import { logger } from '../../helpers/logger'
import { CONFIG } from '../../initializers/config' import { CONFIG } from '../../initializers/config'

View File

@ -1,7 +1,7 @@
import { logger } from '../../helpers/logger' import { logger } from '../../helpers/logger'
import { AbstractScheduler } from './abstract-scheduler' import { AbstractScheduler } from './abstract-scheduler'
import { SCHEDULER_INTERVALS_MS } from '../../initializers/constants' import { SCHEDULER_INTERVALS_MS } from '../../initializers/constants'
import { UserVideoHistoryModel } from '../../models/account/user-video-history' import { UserVideoHistoryModel } from '../../models/user/user-video-history'
import { CONFIG } from '../../initializers/config' import { CONFIG } from '../../initializers/config'
export class RemoveOldHistoryScheduler extends AbstractScheduler { export class RemoveOldHistoryScheduler extends AbstractScheduler {

View File

@ -1,6 +1,6 @@
import { CONFIG } from '@server/initializers/config' import { CONFIG } from '@server/initializers/config'
import { UserModel } from '@server/models/account/user' import { UserModel } from '@server/models/user/user'
import { ActorFollowModel } from '@server/models/activitypub/actor-follow' import { ActorFollowModel } from '@server/models/actor/actor-follow'
import { VideoRedundancyModel } from '@server/models/redundancy/video-redundancy' import { VideoRedundancyModel } from '@server/models/redundancy/video-redundancy'
import { VideoModel } from '@server/models/video/video' import { VideoModel } from '@server/models/video/video'
import { VideoChannelModel } from '@server/models/video/video-channel' import { VideoChannelModel } from '@server/models/video/video-channel'

View File

@ -1,14 +1,15 @@
import { Transaction } from 'sequelize/types' import { Transaction } from 'sequelize/types'
import { v4 as uuidv4 } from 'uuid' import { v4 as uuidv4 } from 'uuid'
import { UserModel } from '@server/models/account/user' import { UserModel } from '@server/models/user/user'
import { MActorDefault } from '@server/types/models/actor'
import { ActivityPubActorType } from '../../shared/models/activitypub' import { ActivityPubActorType } from '../../shared/models/activitypub'
import { UserNotificationSetting, UserNotificationSettingValue } from '../../shared/models/users' import { UserNotificationSetting, UserNotificationSettingValue } from '../../shared/models/users'
import { SERVER_ACTOR_NAME, WEBSERVER } from '../initializers/constants' import { SERVER_ACTOR_NAME, WEBSERVER } from '../initializers/constants'
import { sequelizeTypescript } from '../initializers/database' import { sequelizeTypescript } from '../initializers/database'
import { AccountModel } from '../models/account/account' import { AccountModel } from '../models/account/account'
import { UserNotificationSettingModel } from '../models/account/user-notification-setting' import { ActorModel } from '../models/actor/actor'
import { ActorModel } from '../models/activitypub/actor' import { UserNotificationSettingModel } from '../models/user/user-notification-setting'
import { MAccountDefault, MActorDefault, MChannelActor } from '../types/models' import { MAccountDefault, MChannelActor } from '../types/models'
import { MUser, MUserDefault, MUserId } from '../types/models/user' import { MUser, MUserDefault, MUserId } from '../types/models/user'
import { buildActorInstance, generateAndSaveActorKeys } from './activitypub/actor' import { buildActorInstance, generateAndSaveActorKeys } from './activitypub/actor'
import { getLocalAccountActivityPubUrl } from './activitypub/url' import { getLocalAccountActivityPubUrl } from './activitypub/url'

View File

@ -1,18 +1,18 @@
import * as express from 'express' import * as express from 'express'
import { body, param, query } from 'express-validator' import { body, param, query } from 'express-validator'
import { isTestInstance } from '../../helpers/core-utils'
import { isEachUniqueHostValid, isHostValid } from '../../helpers/custom-validators/servers'
import { logger } from '../../helpers/logger'
import { SERVER_ACTOR_NAME, WEBSERVER } from '../../initializers/constants'
import { ActorFollowModel } from '../../models/activitypub/actor-follow'
import { areValidationErrors } from './utils'
import { ActorModel } from '../../models/activitypub/actor'
import { loadActorUrlOrGetFromWebfinger } from '../../helpers/webfinger'
import { isActorTypeValid, isValidActorHandle } from '../../helpers/custom-validators/activitypub/actor'
import { MActorFollowActorsDefault } from '@server/types/models'
import { isFollowStateValid } from '@server/helpers/custom-validators/follows' import { isFollowStateValid } from '@server/helpers/custom-validators/follows'
import { getServerActor } from '@server/models/application/application' import { getServerActor } from '@server/models/application/application'
import { MActorFollowActorsDefault } from '@server/types/models'
import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
import { isTestInstance } from '../../helpers/core-utils'
import { isActorTypeValid, isValidActorHandle } from '../../helpers/custom-validators/activitypub/actor'
import { isEachUniqueHostValid, isHostValid } from '../../helpers/custom-validators/servers'
import { logger } from '../../helpers/logger'
import { loadActorUrlOrGetFromWebfinger } from '../../helpers/webfinger'
import { SERVER_ACTOR_NAME, WEBSERVER } from '../../initializers/constants'
import { ActorModel } from '../../models/actor/actor'
import { ActorFollowModel } from '../../models/actor/actor-follow'
import { areValidationErrors } from './utils'
const listFollowsValidator = [ const listFollowsValidator = [
query('state') query('state')

View File

@ -1,12 +1,12 @@
import * as express from 'express' import * as express from 'express'
import { body, param, query } from 'express-validator' import { body, param, query } from 'express-validator'
import { logger } from '../../helpers/logger' import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
import { areValidationErrors } from './utils'
import { ActorFollowModel } from '../../models/activitypub/actor-follow'
import { areValidActorHandles, isValidActorHandle } from '../../helpers/custom-validators/activitypub/actor' import { areValidActorHandles, isValidActorHandle } from '../../helpers/custom-validators/activitypub/actor'
import { toArray } from '../../helpers/custom-validators/misc' import { toArray } from '../../helpers/custom-validators/misc'
import { logger } from '../../helpers/logger'
import { WEBSERVER } from '../../initializers/constants' import { WEBSERVER } from '../../initializers/constants'
import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' import { ActorFollowModel } from '../../models/actor/actor-follow'
import { areValidationErrors } from './utils'
const userSubscriptionListValidator = [ const userSubscriptionListValidator = [
query('search').optional().not().isEmpty().withMessage('Should have a valid search'), query('search').optional().not().isEmpty().withMessage('Should have a valid search'),

View File

@ -34,8 +34,8 @@ import { doesVideoExist } from '../../helpers/middlewares'
import { isSignupAllowed, isSignupAllowedForCurrentIP } from '../../helpers/signup' import { isSignupAllowed, isSignupAllowedForCurrentIP } from '../../helpers/signup'
import { isThemeRegistered } from '../../lib/plugins/theme-utils' import { isThemeRegistered } from '../../lib/plugins/theme-utils'
import { Redis } from '../../lib/redis' import { Redis } from '../../lib/redis'
import { UserModel } from '../../models/account/user' import { UserModel } from '../../models/user/user'
import { ActorModel } from '../../models/activitypub/actor' import { ActorModel } from '../../models/actor/actor'
import { areValidationErrors } from './utils' import { areValidationErrors } from './utils'
const usersListValidator = [ const usersListValidator = [

View File

@ -3,6 +3,7 @@ import { body, param, query } from 'express-validator'
import { VIDEO_CHANNELS } from '@server/initializers/constants' import { VIDEO_CHANNELS } from '@server/initializers/constants'
import { MChannelAccountDefault, MUser } from '@server/types/models' import { MChannelAccountDefault, MUser } from '@server/types/models'
import { UserRight } from '../../../../shared' import { UserRight } from '../../../../shared'
import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
import { isActorPreferredUsernameValid } from '../../../helpers/custom-validators/activitypub/actor' import { isActorPreferredUsernameValid } from '../../../helpers/custom-validators/activitypub/actor'
import { isBooleanValid, toBooleanOrNull } from '../../../helpers/custom-validators/misc' import { isBooleanValid, toBooleanOrNull } from '../../../helpers/custom-validators/misc'
import { import {
@ -12,10 +13,9 @@ import {
} from '../../../helpers/custom-validators/video-channels' } from '../../../helpers/custom-validators/video-channels'
import { logger } from '../../../helpers/logger' import { logger } from '../../../helpers/logger'
import { doesLocalVideoChannelNameExist, doesVideoChannelNameWithHostExist } from '../../../helpers/middlewares' import { doesLocalVideoChannelNameExist, doesVideoChannelNameWithHostExist } from '../../../helpers/middlewares'
import { ActorModel } from '../../../models/activitypub/actor' import { ActorModel } from '../../../models/actor/actor'
import { VideoChannelModel } from '../../../models/video/video-channel' import { VideoChannelModel } from '../../../models/video/video-channel'
import { areValidationErrors } from '../utils' import { areValidationErrors } from '../utils'
import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
const videoChannelsAddValidator = [ const videoChannelsAddValidator = [
body('name').custom(isActorPreferredUsernameValid).withMessage('Should have a valid channel name'), body('name').custom(isActorPreferredUsernameValid).withMessage('Should have a valid channel name'),

View File

@ -1,11 +1,11 @@
import * as express from 'express' import * as express from 'express'
import { query } from 'express-validator' import { query } from 'express-validator'
import { isWebfingerLocalResourceValid } from '../../helpers/custom-validators/webfinger'
import { logger } from '../../helpers/logger'
import { ActorModel } from '../../models/activitypub/actor'
import { areValidationErrors } from './utils'
import { getHostWithPort } from '../../helpers/express-utils'
import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
import { isWebfingerLocalResourceValid } from '../../helpers/custom-validators/webfinger'
import { getHostWithPort } from '../../helpers/express-utils'
import { logger } from '../../helpers/logger'
import { ActorModel } from '../../models/actor/actor'
import { areValidationErrors } from './utils'
const webfingerValidator = [ const webfingerValidator = [
query('resource').custom(isWebfingerLocalResourceValid).withMessage('Should have a valid webfinger resource'), query('resource').custom(isWebfingerLocalResourceValid).withMessage('Should have a valid webfinger resource'),

View File

@ -2,7 +2,7 @@ import { Op } from 'sequelize'
import { BelongsTo, Column, CreatedAt, ForeignKey, Model, Scopes, Table, UpdatedAt } from 'sequelize-typescript' import { BelongsTo, Column, CreatedAt, ForeignKey, Model, Scopes, Table, UpdatedAt } from 'sequelize-typescript'
import { MAccountBlocklist, MAccountBlocklistAccounts, MAccountBlocklistFormattable } from '@server/types/models' import { MAccountBlocklist, MAccountBlocklistAccounts, MAccountBlocklistFormattable } from '@server/types/models'
import { AccountBlock } from '../../../shared/models' import { AccountBlock } from '../../../shared/models'
import { ActorModel } from '../activitypub/actor' import { ActorModel } from '../actor/actor'
import { ServerModel } from '../server/server' import { ServerModel } from '../server/server'
import { getSort, searchAttribute } from '../utils' import { getSort, searchAttribute } from '../utils'
import { AccountModel } from './account' import { AccountModel } from './account'

View File

@ -11,7 +11,7 @@ import { AccountVideoRate } from '../../../shared'
import { VideoRateType } from '../../../shared/models/videos' 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 '../activitypub/actor' import { ActorModel } from '../actor/actor'
import { buildLocalAccountIdsIn, getSort, throwIfNotValid } from '../utils' import { buildLocalAccountIdsIn, getSort, throwIfNotValid } from '../utils'
import { VideoModel } from '../video/video' import { VideoModel } from '../video/video'
import { ScopeNames as VideoChannelScopeNames, SummaryOptions, VideoChannelModel } from '../video/video-channel' import { ScopeNames as VideoChannelScopeNames, SummaryOptions, VideoChannelModel } from '../video/video-channel'

View File

@ -30,19 +30,19 @@ import {
MAccountSummaryFormattable, MAccountSummaryFormattable,
MChannelActor MChannelActor
} from '../../types/models' } from '../../types/models'
import { ActorModel } from '../activitypub/actor' import { ActorModel } from '../actor/actor'
import { ActorFollowModel } from '../activitypub/actor-follow' import { ActorFollowModel } from '../actor/actor-follow'
import { ActorImageModel } from '../actor/actor-image'
import { ApplicationModel } from '../application/application' import { ApplicationModel } from '../application/application'
import { ActorImageModel } from './actor-image'
import { ServerModel } from '../server/server' import { ServerModel } from '../server/server'
import { ServerBlocklistModel } from '../server/server-blocklist' import { ServerBlocklistModel } from '../server/server-blocklist'
import { UserModel } from '../user/user'
import { getSort, throwIfNotValid } from '../utils' import { getSort, throwIfNotValid } from '../utils'
import { VideoModel } from '../video/video' import { VideoModel } from '../video/video'
import { VideoChannelModel } from '../video/video-channel' import { VideoChannelModel } from '../video/video-channel'
import { VideoCommentModel } from '../video/video-comment' import { VideoCommentModel } from '../video/video-comment'
import { VideoPlaylistModel } from '../video/video-playlist' import { VideoPlaylistModel } from '../video/video-playlist'
import { AccountBlocklistModel } from './account-blocklist' import { AccountBlocklistModel } from './account-blocklist'
import { UserModel } from './user'
export enum ScopeNames { export enum ScopeNames {
SUMMARY = 'SUMMARY' SUMMARY = 'SUMMARY'

View File

@ -51,12 +51,12 @@ import {
MActorWithInboxes MActorWithInboxes
} from '../../types/models' } from '../../types/models'
import { AccountModel } from '../account/account' import { AccountModel } from '../account/account'
import { ActorImageModel } from '../account/actor-image'
import { ServerModel } from '../server/server' import { ServerModel } from '../server/server'
import { isOutdated, throwIfNotValid } from '../utils' import { isOutdated, throwIfNotValid } from '../utils'
import { VideoModel } from '../video/video' import { VideoModel } from '../video/video'
import { VideoChannelModel } from '../video/video-channel' import { VideoChannelModel } from '../video/video-channel'
import { ActorFollowModel } from './actor-follow' import { ActorFollowModel } from './actor-follow'
import { ActorImageModel } from './actor-image'
enum ScopeNames { enum ScopeNames {
FULL = 'FULL' FULL = 'FULL'

View File

@ -17,8 +17,8 @@ import { MUserAccountId } from '@server/types/models'
import { MOAuthTokenUser } from '@server/types/models/oauth/oauth-token' import { MOAuthTokenUser } from '@server/types/models/oauth/oauth-token'
import { logger } from '../../helpers/logger' import { logger } from '../../helpers/logger'
import { AccountModel } from '../account/account' import { AccountModel } from '../account/account'
import { UserModel } from '../account/user' import { ActorModel } from '../actor/actor'
import { ActorModel } from '../activitypub/actor' import { UserModel } from '../user/user'
import { OAuthClientModel } from './oauth-client' import { OAuthClientModel } from './oauth-client'
export type OAuthTokenInfo = { export type OAuthTokenInfo = {

View File

@ -29,7 +29,7 @@ import { isActivityPubUrlValid, isUrlValid } from '../../helpers/custom-validato
import { logger } from '../../helpers/logger' import { logger } from '../../helpers/logger'
import { CONFIG } from '../../initializers/config' import { CONFIG } from '../../initializers/config'
import { CONSTRAINTS_FIELDS, MIMETYPES } from '../../initializers/constants' import { CONSTRAINTS_FIELDS, MIMETYPES } from '../../initializers/constants'
import { ActorModel } from '../activitypub/actor' import { ActorModel } from '../actor/actor'
import { ServerModel } from '../server/server' import { ServerModel } from '../server/server'
import { getSort, getVideoSort, parseAggregateResult, throwIfNotValid } from '../utils' import { getSort, getVideoSort, parseAggregateResult, throwIfNotValid } from '../utils'
import { ScheduleVideoUpdateModel } from '../video/schedule-video-update' import { ScheduleVideoUpdateModel } from '../video/schedule-video-update'

View File

@ -1,7 +1,7 @@
import { AllowNull, Column, CreatedAt, Default, HasMany, Is, Model, Table, UpdatedAt } from 'sequelize-typescript' import { AllowNull, Column, CreatedAt, Default, HasMany, Is, Model, Table, UpdatedAt } from 'sequelize-typescript'
import { MServer, MServerFormattable } from '@server/types/models/server' import { MServer, MServerFormattable } from '@server/types/models/server'
import { isHostValid } from '../../helpers/custom-validators/servers' import { isHostValid } from '../../helpers/custom-validators/servers'
import { ActorModel } from '../activitypub/actor' import { ActorModel } from '../actor/actor'
import { throwIfNotValid } from '../utils' import { throwIfNotValid } from '../utils'
import { ServerBlocklistModel } from './server-blocklist' import { ServerBlocklistModel } from './server-blocklist'

View File

@ -7,8 +7,10 @@ import { isUserNotificationTypeValid } from '../../helpers/custom-validators/use
import { AbuseModel } from '../abuse/abuse' import { AbuseModel } from '../abuse/abuse'
import { VideoAbuseModel } from '../abuse/video-abuse' import { VideoAbuseModel } from '../abuse/video-abuse'
import { VideoCommentAbuseModel } from '../abuse/video-comment-abuse' import { VideoCommentAbuseModel } from '../abuse/video-comment-abuse'
import { ActorModel } from '../activitypub/actor' import { AccountModel } from '../account/account'
import { ActorFollowModel } from '../activitypub/actor-follow' import { ActorModel } from '../actor/actor'
import { ActorFollowModel } from '../actor/actor-follow'
import { ActorImageModel } from '../actor/actor-image'
import { ApplicationModel } from '../application/application' import { ApplicationModel } from '../application/application'
import { PluginModel } from '../server/plugin' import { PluginModel } from '../server/plugin'
import { ServerModel } from '../server/server' import { ServerModel } from '../server/server'
@ -18,8 +20,6 @@ import { VideoBlacklistModel } from '../video/video-blacklist'
import { VideoChannelModel } from '../video/video-channel' import { VideoChannelModel } from '../video/video-channel'
import { VideoCommentModel } from '../video/video-comment' import { VideoCommentModel } from '../video/video-comment'
import { VideoImportModel } from '../video/video-import' import { VideoImportModel } from '../video/video-import'
import { AccountModel } from './account'
import { ActorImageModel } from './actor-image'
import { UserModel } from './user' import { UserModel } from './user'
enum ScopeNames { enum ScopeNames {

View File

@ -60,8 +60,10 @@ import {
import { comparePassword, cryptPassword } from '../../helpers/peertube-crypto' import { comparePassword, cryptPassword } from '../../helpers/peertube-crypto'
import { DEFAULT_USER_THEME_NAME, NSFW_POLICY_TYPES } from '../../initializers/constants' import { DEFAULT_USER_THEME_NAME, NSFW_POLICY_TYPES } from '../../initializers/constants'
import { getThemeOrDefault } from '../../lib/plugins/theme-utils' import { getThemeOrDefault } from '../../lib/plugins/theme-utils'
import { ActorModel } from '../activitypub/actor' import { AccountModel } from '../account/account'
import { ActorFollowModel } from '../activitypub/actor-follow' import { ActorModel } from '../actor/actor'
import { ActorFollowModel } from '../actor/actor-follow'
import { ActorImageModel } from '../actor/actor-image'
import { OAuthTokenModel } from '../oauth/oauth-token' import { OAuthTokenModel } from '../oauth/oauth-token'
import { getSort, throwIfNotValid } from '../utils' import { getSort, throwIfNotValid } from '../utils'
import { VideoModel } from '../video/video' import { VideoModel } from '../video/video'
@ -69,9 +71,7 @@ import { VideoChannelModel } from '../video/video-channel'
import { VideoImportModel } from '../video/video-import' import { VideoImportModel } from '../video/video-import'
import { VideoLiveModel } from '../video/video-live' import { VideoLiveModel } from '../video/video-live'
import { VideoPlaylistModel } from '../video/video-playlist' import { VideoPlaylistModel } from '../video/video-playlist'
import { AccountModel } from './account'
import { UserNotificationSettingModel } from './user-notification-setting' import { UserNotificationSettingModel } from './user-notification-setting'
import { ActorImageModel } from './actor-image'
enum ScopeNames { enum ScopeNames {
FOR_ME_API = 'FOR_ME_API', FOR_ME_API = 'FOR_ME_API',

View File

@ -36,9 +36,9 @@ import {
MChannelSummaryFormattable MChannelSummaryFormattable
} from '../../types/models/video' } from '../../types/models/video'
import { AccountModel, ScopeNames as AccountModelScopeNames, SummaryOptions as AccountSummaryOptions } from '../account/account' import { AccountModel, ScopeNames as AccountModelScopeNames, SummaryOptions as AccountSummaryOptions } from '../account/account'
import { ActorImageModel } from '../account/actor-image' import { ActorModel, unusedActorAttributesForAPI } from '../actor/actor'
import { ActorModel, unusedActorAttributesForAPI } from '../activitypub/actor' import { ActorFollowModel } from '../actor/actor-follow'
import { ActorFollowModel } from '../activitypub/actor-follow' import { ActorImageModel } from '../actor/actor-image'
import { ServerModel } from '../server/server' import { ServerModel } from '../server/server'
import { buildServerIdsFollowedBy, buildTrigramSearchIndex, createSimilarityAttribute, getSort, throwIfNotValid } from '../utils' import { buildServerIdsFollowedBy, buildTrigramSearchIndex, createSimilarityAttribute, getSort, throwIfNotValid } from '../utils'
import { VideoModel } from './video' import { VideoModel } from './video'

View File

@ -39,7 +39,7 @@ import {
} from '../../types/models/video' } from '../../types/models/video'
import { VideoCommentAbuseModel } from '../abuse/video-comment-abuse' import { VideoCommentAbuseModel } from '../abuse/video-comment-abuse'
import { AccountModel } from '../account/account' import { AccountModel } from '../account/account'
import { ActorModel, unusedActorAttributesForAPI } from '../activitypub/actor' import { ActorModel, unusedActorAttributesForAPI } from '../actor/actor'
import { import {
buildBlockedAccountSQL, buildBlockedAccountSQL,
buildBlockedAccountSQLOptimized, buildBlockedAccountSQLOptimized,

View File

@ -13,15 +13,15 @@ import {
Table, Table,
UpdatedAt UpdatedAt
} from 'sequelize-typescript' } from 'sequelize-typescript'
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' 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'
import { UserModel } from '../account/user' import { UserModel } from '../user/user'
import { getSort, throwIfNotValid } from '../utils' import { getSort, throwIfNotValid } from '../utils'
import { ScopeNames as VideoModelScopeNames, VideoModel } from './video' import { ScopeNames as VideoModelScopeNames, VideoModel } from './video'
import { afterCommitIfTransaction } from '@server/helpers/database-utils'
@DefaultScope(() => ({ @DefaultScope(() => ({
include: [ include: [

View File

@ -50,11 +50,11 @@ import {
MVideoPlaylistIdWithElements MVideoPlaylistIdWithElements
} from '../../types/models/video/video-playlist' } from '../../types/models/video/video-playlist'
import { AccountModel, ScopeNames as AccountScopeNames, SummaryOptions } from '../account/account' import { AccountModel, ScopeNames as AccountScopeNames, SummaryOptions } from '../account/account'
import { ActorModel } from '../actor/actor'
import { buildServerIdsFollowedBy, buildWhereIdOrUUID, getPlaylistSort, isOutdated, throwIfNotValid } from '../utils' import { buildServerIdsFollowedBy, buildWhereIdOrUUID, getPlaylistSort, isOutdated, throwIfNotValid } from '../utils'
import { ThumbnailModel } from './thumbnail' import { ThumbnailModel } from './thumbnail'
import { ScopeNames as VideoChannelScopeNames, VideoChannelModel } from './video-channel' import { ScopeNames as VideoChannelScopeNames, VideoChannelModel } from './video-channel'
import { VideoPlaylistElementModel } from './video-playlist-element' import { VideoPlaylistElementModel } from './video-playlist-element'
import { ActorModel } from '../activitypub/actor'
enum ScopeNames { enum ScopeNames {
AVAILABLE_FOR_LIST = 'AVAILABLE_FOR_LIST', AVAILABLE_FOR_LIST = 'AVAILABLE_FOR_LIST',

View File

@ -4,7 +4,7 @@ import { isActivityPubUrlValid } from '../../helpers/custom-validators/activityp
import { CONSTRAINTS_FIELDS } from '../../initializers/constants' import { CONSTRAINTS_FIELDS } from '../../initializers/constants'
import { MActorDefault } from '../../types/models' import { MActorDefault } from '../../types/models'
import { MVideoShareActor, MVideoShareFull } from '../../types/models/video' import { MVideoShareActor, MVideoShareFull } from '../../types/models/video'
import { ActorModel } from '../activitypub/actor' import { ActorModel } from '../actor/actor'
import { buildLocalActorIdsIn, throwIfNotValid } from '../utils' import { buildLocalActorIdsIn, throwIfNotValid } from '../utils'
import { VideoModel } from './video' import { VideoModel } from './video'

View File

@ -100,14 +100,14 @@ import { MVideoFile, MVideoFileStreamingPlaylistVideo } from '../../types/models
import { VideoAbuseModel } from '../abuse/video-abuse' import { VideoAbuseModel } from '../abuse/video-abuse'
import { AccountModel } from '../account/account' import { AccountModel } from '../account/account'
import { AccountVideoRateModel } from '../account/account-video-rate' import { AccountVideoRateModel } from '../account/account-video-rate'
import { ActorImageModel } from '../account/actor-image' import { ActorModel } from '../actor/actor'
import { UserModel } from '../account/user' import { ActorImageModel } from '../actor/actor-image'
import { UserVideoHistoryModel } from '../account/user-video-history'
import { ActorModel } from '../activitypub/actor'
import { VideoRedundancyModel } from '../redundancy/video-redundancy' import { VideoRedundancyModel } from '../redundancy/video-redundancy'
import { ServerModel } from '../server/server' import { ServerModel } from '../server/server'
import { TrackerModel } from '../server/tracker' import { TrackerModel } from '../server/tracker'
import { VideoTrackerModel } from '../server/video-tracker' import { VideoTrackerModel } from '../server/video-tracker'
import { UserModel } from '../user/user'
import { UserVideoHistoryModel } from '../user/user-video-history'
import { buildTrigramSearchIndex, buildWhereIdOrUUID, getVideoSort, isOutdated, throwIfNotValid } from '../utils' import { buildTrigramSearchIndex, buildWhereIdOrUUID, getVideoSort, isOutdated, throwIfNotValid } from '../utils'
import { ScheduleVideoUpdateModel } from './schedule-video-update' import { ScheduleVideoUpdateModel } from './schedule-video-update'
import { TagModel } from './tag' import { TagModel } from './tag'

View File

@ -1,7 +1,5 @@
import { FunctionProperties, PickWith } from '@shared/core-utils' import { FunctionProperties, PickWith } from '@shared/core-utils'
import { AccountModel } from '../../../models/account/account' import { AccountModel } from '../../../models/account/account'
import { MChannelDefault } from '../video/video-channels'
import { MAccountBlocklistId } from './account-blocklist'
import { import {
MActor, MActor,
MActorAPAccount, MActorAPAccount,
@ -15,7 +13,9 @@ import {
MActorSummary, MActorSummary,
MActorSummaryFormattable, MActorSummaryFormattable,
MActorUrl MActorUrl
} from './actor' } from '../actor'
import { MChannelDefault } from '../video/video-channels'
import { MAccountBlocklistId } from './account-blocklist'
type Use<K extends keyof AccountModel, M> = PickWith<AccountModel, K, M> type Use<K extends keyof AccountModel, M> = PickWith<AccountModel, K, M>

View File

@ -1,5 +1,2 @@
export * from './account' export * from './account'
export * from './account-blocklist' export * from './account-blocklist'
export * from './actor-follow'
export * from './actor-image'
export * from './actor'

View File

@ -1,5 +1,5 @@
import { PickWith } from '@shared/core-utils' import { PickWith } from '@shared/core-utils'
import { ActorFollowModel } from '../../../models/activitypub/actor-follow' import { ActorFollowModel } from '../../../models/actor/actor-follow'
import { import {
MActor, MActor,
MActorChannelAccountActor, MActorChannelAccountActor,

View File

@ -1,5 +1,5 @@
import { ActorImageModel } from '../../../models/account/actor-image'
import { FunctionProperties } from '@shared/core-utils' import { FunctionProperties } from '@shared/core-utils'
import { ActorImageModel } from '../../../models/actor/actor-image'
export type MActorImage = ActorImageModel export type MActorImage = ActorImageModel

View File

@ -1,9 +1,8 @@
import { FunctionProperties, PickWith, PickWithOpt } from '@shared/core-utils' import { FunctionProperties, PickWith, PickWithOpt } from '@shared/core-utils'
import { ActorModel } from '../../../models/activitypub/actor' import { ActorModel } from '../../../models/actor/actor'
import { MAccount, MAccountDefault, MAccountId, MAccountIdActor } from '../account'
import { MServer, MServerHost, MServerHostBlocks, MServerRedundancyAllowed } from '../server' import { MServer, MServerHost, MServerHostBlocks, MServerRedundancyAllowed } from '../server'
import { MChannel, MChannelAccountActor, MChannelAccountDefault, MChannelId, MChannelIdActor } from '../video' import { MChannel, MChannelAccountActor, MChannelAccountDefault, MChannelId, MChannelIdActor } from '../video'
import { MAccount, MAccountDefault, MAccountId, MAccountIdActor } from './account'
import { MActorImage, MActorImageFormattable } from './actor-image' import { MActorImage, MActorImageFormattable } from './actor-image'
type Use<K extends keyof ActorModel, M> = PickWith<ActorModel, K, M> type Use<K extends keyof ActorModel, M> = PickWith<ActorModel, K, M>

View File

@ -0,0 +1,3 @@
export * from './actor-follow'
export * from './actor-image'
export * from './actor'

View File

@ -1,6 +1,7 @@
export * from './abuse'
export * from './account' export * from './account'
export * from './actor'
export * from './application' export * from './application'
export * from './moderation'
export * from './oauth' export * from './oauth'
export * from './server' export * from './server'
export * from './user' export * from './user'

View File

@ -1,4 +1,4 @@
import { UserNotificationSettingModel } from '@server/models/account/user-notification-setting' import { UserNotificationSettingModel } from '@server/models/user/user-notification-setting'
export type MNotificationSetting = Omit<UserNotificationSettingModel, 'User'> export type MNotificationSetting = Omit<UserNotificationSettingModel, 'User'>

View File

@ -2,13 +2,13 @@ import { VideoAbuseModel } from '@server/models/abuse/video-abuse'
import { VideoCommentAbuseModel } from '@server/models/abuse/video-comment-abuse' import { VideoCommentAbuseModel } from '@server/models/abuse/video-comment-abuse'
import { ApplicationModel } from '@server/models/application/application' import { ApplicationModel } from '@server/models/application/application'
import { PluginModel } from '@server/models/server/plugin' import { PluginModel } from '@server/models/server/plugin'
import { UserNotificationModel } from '@server/models/user/user-notification'
import { PickWith, PickWithOpt } from '@shared/core-utils' import { PickWith, PickWithOpt } from '@shared/core-utils'
import { AbuseModel } from '../../../models/abuse/abuse' import { AbuseModel } from '../../../models/abuse/abuse'
import { AccountModel } from '../../../models/account/account' import { AccountModel } from '../../../models/account/account'
import { ActorImageModel } from '../../../models/account/actor-image' import { ActorModel } from '../../../models/actor/actor'
import { UserNotificationModel } from '../../../models/account/user-notification' import { ActorFollowModel } from '../../../models/actor/actor-follow'
import { ActorModel } from '../../../models/activitypub/actor' import { ActorImageModel } from '../../../models/actor/actor-image'
import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
import { ServerModel } from '../../../models/server/server' import { ServerModel } from '../../../models/server/server'
import { VideoModel } from '../../../models/video/video' import { VideoModel } from '../../../models/video/video'
import { VideoBlacklistModel } from '../../../models/video/video-blacklist' import { VideoBlacklistModel } from '../../../models/video/video-blacklist'

View File

@ -1,4 +1,4 @@
import { UserVideoHistoryModel } from '../../../models/account/user-video-history' import { UserVideoHistoryModel } from '../../../models/user/user-video-history'
export type MUserVideoHistory = Omit<UserVideoHistoryModel, 'Video' | 'User'> export type MUserVideoHistory = Omit<UserVideoHistoryModel, 'Video' | 'User'>

View File

@ -1,7 +1,7 @@
import { AccountModel } from '@server/models/account/account' import { AccountModel } from '@server/models/account/account'
import { UserModel } from '@server/models/user/user'
import { MVideoPlaylist } from '@server/types/models' import { MVideoPlaylist } from '@server/types/models'
import { PickWith, PickWithOpt } from '@shared/core-utils' import { PickWith, PickWithOpt } from '@shared/core-utils'
import { UserModel } from '../../../models/account/user'
import { import {
MAccount, MAccount,
MAccountDefault, MAccountDefault,

View File

@ -9,7 +9,9 @@ import {
MAccountSummaryBlocks, MAccountSummaryBlocks,
MAccountSummaryFormattable, MAccountSummaryFormattable,
MAccountUrl, MAccountUrl,
MAccountUserId, MAccountUserId
} from '../account'
import {
MActor, MActor,
MActorAccountChannelId, MActorAccountChannelId,
MActorAPChannel, MActorAPChannel,
@ -23,7 +25,7 @@ import {
MActorSummary, MActorSummary,
MActorSummaryFormattable, MActorSummaryFormattable,
MActorUrl MActorUrl
} from '../account' } from '../actor'
import { MVideo } from './video' import { MVideo } from './video'
type Use<K extends keyof VideoChannelModel, M> = PickWith<VideoChannelModel, K, M> type Use<K extends keyof VideoChannelModel, M> = PickWith<VideoChannelModel, K, M>

View File

@ -1,6 +1,6 @@
import { VideoShareModel } from '../../../models/video/video-share'
import { PickWith } from '@shared/core-utils' import { PickWith } from '@shared/core-utils'
import { MActorDefault } from '../account' import { VideoShareModel } from '../../../models/video/video-share'
import { MActorDefault } from '../actor'
import { MVideo } from './video' import { MVideo } from './video'
type Use<K extends keyof VideoShareModel, M> = PickWith<VideoShareModel, K, M> type Use<K extends keyof VideoShareModel, M> = PickWith<VideoShareModel, K, M>

View File

@ -1,6 +1,6 @@
import { Router, Response } from 'express' import { Response, Router } from 'express'
import { Logger } from 'winston' import { Logger } from 'winston'
import { ActorModel } from '@server/models/activitypub/actor' import { ActorModel } from '@server/models/actor/actor'
import { import {
PluginPlaylistPrivacyManager, PluginPlaylistPrivacyManager,
PluginSettingsManager, PluginSettingsManager,