Cleanup models directory organization
This commit is contained in:
parent
c07902b908
commit
7d9ba5c089
91 changed files with 215 additions and 212 deletions
|
@ -11,7 +11,7 @@ import { VideoRedundancyModel } from '../server/models/redundancy/video-redundan
|
|||
import * as Bluebird from 'bluebird'
|
||||
import { getUUIDFromFilename } from '../server/helpers/utils'
|
||||
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 { ThumbnailType } from '@shared/models'
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ registerTSPaths()
|
|||
|
||||
import * as program from 'commander'
|
||||
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'
|
||||
|
||||
program
|
||||
|
|
|
@ -2,9 +2,9 @@ import { registerTSPaths } from '../server/helpers/register-ts-paths'
|
|||
registerTSPaths()
|
||||
|
||||
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 { ActorModel } from '../server/models/activitypub/actor'
|
||||
import { ActorModel } from '../server/models/actor/actor'
|
||||
import {
|
||||
getLocalAccountActivityPubUrl,
|
||||
getLocalVideoActivityPubUrl,
|
||||
|
|
|
@ -30,7 +30,7 @@ import { videoFileRedundancyGetValidator, videoPlaylistRedundancyGetValidator }
|
|||
import { videoPlaylistElementAPGetValidator, videoPlaylistsGetValidator } from '../../middlewares/validators/videos/video-playlists'
|
||||
import { AccountModel } from '../../models/account/account'
|
||||
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 { VideoCaptionModel } from '../../models/video/video-caption'
|
||||
import { VideoCommentModel } from '../../models/video/video-comment'
|
||||
|
|
|
@ -1,9 +1,15 @@
|
|||
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 { logger } from '../../../helpers/logger'
|
||||
import { getFormattedObjects } from '../../../helpers/utils'
|
||||
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 { JobQueue } from '../../../lib/job-queue'
|
||||
import { removeRedundanciesOfServer } from '../../../lib/redundancy'
|
||||
import {
|
||||
asyncMiddleware,
|
||||
authenticate,
|
||||
|
@ -19,16 +25,10 @@ import {
|
|||
followingSortValidator,
|
||||
followValidator,
|
||||
getFollowerValidator,
|
||||
removeFollowingValidator,
|
||||
listFollowsValidator
|
||||
listFollowsValidator,
|
||||
removeFollowingValidator
|
||||
} from '../../../middlewares/validators'
|
||||
import { ActorFollowModel } from '../../../models/activitypub/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'
|
||||
import { ActorFollowModel } from '../../../models/actor/actor-follow'
|
||||
|
||||
const serverFollowsRouter = express.Router()
|
||||
serverFollowsRouter.get('/following',
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import 'multer'
|
||||
import * as express from 'express'
|
||||
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 { UserRight } from '../../../../shared/models/users'
|
||||
import { getFormattedObjects } from '../../../helpers/utils'
|
||||
|
|
|
@ -45,7 +45,7 @@ import {
|
|||
usersResetPasswordValidator,
|
||||
usersVerifyEmailValidator
|
||||
} from '../../../middlewares/validators'
|
||||
import { UserModel } from '../../../models/account/user'
|
||||
import { UserModel } from '../../../models/user/user'
|
||||
import { meRouter } from './me'
|
||||
import { myAbusesRouter } from './my-abuses'
|
||||
import { myBlocklistRouter } from './my-blocklist'
|
||||
|
|
|
@ -28,7 +28,7 @@ import { deleteMeValidator, videoImportsSortValidator, videosSortValidator } fro
|
|||
import { updateAvatarValidator } from '../../../middlewares/validators/actor-image'
|
||||
import { AccountModel } from '../../../models/account/account'
|
||||
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 { VideoImportModel } from '../../../models/video/video-import'
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ import {
|
|||
import { AccountBlocklistModel } from '../../../models/account/account-blocklist'
|
||||
import { addAccountInBlocklist, addServerInBlocklist, removeAccountFromBlocklist, removeServerFromBlocklist } from '../../../lib/blocklist'
|
||||
import { ServerBlocklistModel } from '../../../models/server/server-blocklist'
|
||||
import { UserNotificationModel } from '@server/models/account/user-notification'
|
||||
import { UserNotificationModel } from '@server/models/user/user-notification'
|
||||
import { logger } from '@server/helpers/logger'
|
||||
import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ import {
|
|||
userHistoryRemoveValidator
|
||||
} from '../../../middlewares'
|
||||
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 { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
|
||||
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
import * as express from 'express'
|
||||
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 {
|
||||
asyncMiddleware,
|
||||
asyncRetryTransactionMiddleware,
|
||||
|
@ -9,17 +13,13 @@ import {
|
|||
setDefaultSort,
|
||||
userNotificationsSortValidator
|
||||
} from '../../../middlewares'
|
||||
import { getFormattedObjects } from '../../../helpers/utils'
|
||||
import { UserNotificationModel } from '../../../models/account/user-notification'
|
||||
import { meRouter } from './me'
|
||||
import {
|
||||
listUserNotificationsValidator,
|
||||
markAsReadUserNotificationsValidator,
|
||||
updateNotificationSettingsValidator
|
||||
} from '../../../middlewares/validators/user-notifications'
|
||||
import { UserNotificationSetting } from '../../../../shared/models/users'
|
||||
import { UserNotificationSettingModel } from '../../../models/account/user-notification-setting'
|
||||
import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
|
||||
import { UserNotificationSettingModel } from '../../../models/user/user-notification-setting'
|
||||
import { meRouter } from './me'
|
||||
|
||||
const myNotificationsRouter = express.Router()
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ import {
|
|||
userSubscriptionsSortValidator,
|
||||
videosSortValidator
|
||||
} from '../../../middlewares/validators'
|
||||
import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
|
||||
import { ActorFollowModel } from '../../../models/actor/actor-follow'
|
||||
import { VideoModel } from '../../../models/video/video'
|
||||
|
||||
const mySubscriptionsRouter = express.Router()
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import * as express from 'express'
|
||||
import { UserWatchingVideo } from '../../../../shared'
|
||||
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'
|
||||
|
||||
const watchingRouter = express.Router()
|
||||
|
|
|
@ -7,7 +7,7 @@ import { LAZY_STATIC_PATHS, STATIC_MAX_AGE } from '../initializers/constants'
|
|||
import { actorImagePathUnsafeCache, pushActorImageProcessInQueue } from '../lib/actor-image'
|
||||
import { VideosCaptionCache, VideosPreviewCache } from '../lib/files-cache'
|
||||
import { asyncMiddleware } from '../middlewares'
|
||||
import { ActorImageModel } from '../models/account/actor-image'
|
||||
import { ActorImageModel } from '../models/actor/actor-image'
|
||||
|
||||
const lazyStaticRouter = express.Router()
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ import {
|
|||
import { getThemeOrDefault } from '../lib/plugins/theme-utils'
|
||||
import { asyncMiddleware } from '../middlewares'
|
||||
import { cacheRoute } from '../middlewares/cache'
|
||||
import { UserModel } from '../models/account/user'
|
||||
import { UserModel } from '../models/user/user'
|
||||
import { VideoModel } from '../models/video/video'
|
||||
import { VideoCommentModel } from '../models/video/video-comment'
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
import { ActorModel } from '../models/activitypub/actor'
|
||||
import { ActorModel } from '../models/actor/actor'
|
||||
import { MActorAccountChannelId, MActorFull } from '../types/models'
|
||||
|
||||
type ActorFetchByUrlType = 'all' | 'association-ids'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
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 { AccountModel } from '../../models/account/account'
|
||||
import { MAccountDefault } from '../../types/models'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { UserModel } from '../models/account/user'
|
||||
import { UserModel } from '../models/user/user'
|
||||
import * as ipaddr from 'ipaddr.js'
|
||||
import { CONFIG } from '../initializers/config'
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import * as WebFinger from 'webfinger.js'
|
||||
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 { isActivityPubUrlValid } from './custom-validators/activitypub/misc'
|
||||
import { WEBSERVER } from '../initializers/constants'
|
||||
import { MActorFull } from '../types/models'
|
||||
|
||||
const webfinger = new WebFinger({
|
||||
webfist_fallback: false,
|
||||
|
|
|
@ -7,7 +7,7 @@ import { RecentlyAddedStrategy } from '../../shared/models/redundancy'
|
|||
import { isProdInstance, isTestInstance, parseSemVersion } from '../helpers/core-utils'
|
||||
import { isArray } from '../helpers/custom-validators/misc'
|
||||
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 { OAuthClientModel } from '../models/oauth/oauth-client'
|
||||
import { CONFIG, isEmailEnabled } from './config'
|
||||
|
|
|
@ -2,6 +2,9 @@ import { QueryTypes, Transaction } from 'sequelize'
|
|||
import { Sequelize as SequelizeTypescript } from 'sequelize-typescript'
|
||||
import { TrackerModel } from '@server/models/server/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 { logger } from '../helpers/logger'
|
||||
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 { AccountBlocklistModel } from '../models/account/account-blocklist'
|
||||
import { AccountVideoRateModel } from '../models/account/account-video-rate'
|
||||
import { ActorImageModel } from '../models/account/actor-image'
|
||||
import { UserModel } from '../models/account/user'
|
||||
import { UserNotificationModel } from '../models/account/user-notification'
|
||||
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 { ActorModel } from '../models/actor/actor'
|
||||
import { ActorFollowModel } from '../models/actor/actor-follow'
|
||||
import { ActorImageModel } from '../models/actor/actor-image'
|
||||
import { ApplicationModel } from '../models/application/application'
|
||||
import { OAuthClientModel } from '../models/oauth/oauth-client'
|
||||
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 { ServerModel } from '../models/server/server'
|
||||
import { ServerBlocklistModel } from '../models/server/server-blocklist'
|
||||
import { UserNotificationSettingModel } from '../models/user/user-notification-setting'
|
||||
import { ScheduleVideoUpdateModel } from '../models/video/schedule-video-update'
|
||||
import { TagModel } from '../models/video/tag'
|
||||
import { ThumbnailModel } from '../models/video/thumbnail'
|
||||
|
|
|
@ -2,7 +2,7 @@ import * as passwordGenerator from 'password-generator'
|
|||
import { UserRole } from '../../shared'
|
||||
import { logger } from '../helpers/logger'
|
||||
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 { OAuthClientModel } from '../models/oauth/oauth-client'
|
||||
import { applicationExist, clientsExist, usersExist } from './checker-after-init'
|
||||
|
|
|
@ -20,8 +20,8 @@ import { getUrlFromWebfinger } from '../../helpers/webfinger'
|
|||
import { MIMETYPES, WEBSERVER } from '../../initializers/constants'
|
||||
import { sequelizeTypescript } from '../../initializers/database'
|
||||
import { AccountModel } from '../../models/account/account'
|
||||
import { ActorImageModel } from '../../models/account/actor-image'
|
||||
import { ActorModel } from '../../models/activitypub/actor'
|
||||
import { ActorModel } from '../../models/actor/actor'
|
||||
import { ActorImageModel } from '../../models/actor/actor-image'
|
||||
import { ServerModel } from '../../models/server/server'
|
||||
import { VideoChannelModel } from '../../models/video/video-channel'
|
||||
import {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { Transaction } from 'sequelize'
|
||||
import { ActivityAudience } from '../../../shared/models/activitypub'
|
||||
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 { VideoShareModel } from '../../models/video/video-share'
|
||||
import { MActorFollowersUrl, MActorLight, MActorUrl, MCommentOwner, MCommentOwnerVideo, MVideoId } from '../../types/models'
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { ActivityAccept } from '../../../../shared/models/activitypub'
|
||||
import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
|
||||
import { addFetchOutboxJob } from '../actor'
|
||||
import { ActorFollowModel } from '../../../models/actor/actor-follow'
|
||||
import { APProcessorOptions } from '../../../types/activitypub-processor.model'
|
||||
import { MActorDefault, MActorSignature } from '../../../types/models'
|
||||
import { addFetchOutboxJob } from '../actor'
|
||||
|
||||
async function processAcceptActivity (options: APProcessorOptions<ActivityAccept>) {
|
||||
const { byActor: targetActor, inboxActor } = options
|
||||
|
|
|
@ -2,7 +2,7 @@ import { ActivityDelete } from '../../../../shared/models/activitypub'
|
|||
import { retryTransactionWrapper } from '../../../helpers/database-utils'
|
||||
import { logger } from '../../../helpers/logger'
|
||||
import { sequelizeTypescript } from '../../../initializers/database'
|
||||
import { ActorModel } from '../../../models/activitypub/actor'
|
||||
import { ActorModel } from '../../../models/actor/actor'
|
||||
import { VideoModel } from '../../../models/video/video'
|
||||
import { VideoCommentModel } from '../../../models/video/video-comment'
|
||||
import { VideoPlaylistModel } from '../../../models/video/video-playlist'
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
import { getServerActor } from '@server/models/application/application'
|
||||
import { ActivityFollow } from '../../../../shared/models/activitypub'
|
||||
import { getAPId } from '../../../helpers/activitypub'
|
||||
import { retryTransactionWrapper } from '../../../helpers/database-utils'
|
||||
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 { 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 { MActorFollowActors, MActorSignature } from '../../../types/models'
|
||||
import { Notifier } from '../../notifier'
|
||||
import { autoFollowBackIfNeeded } from '../follow'
|
||||
import { getServerActor } from '@server/models/application/application'
|
||||
import { sendAccept, sendReject } from '../send'
|
||||
|
||||
async function processFollowActivity (options: APProcessorOptions<ActivityFollow>) {
|
||||
const { activity, byActor } = options
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { ActivityReject } from '../../../../shared/models/activitypub/activity'
|
||||
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 { MActor } from '../../../types/models'
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ import { retryTransactionWrapper } from '../../../helpers/database-utils'
|
|||
import { logger } from '../../../helpers/logger'
|
||||
import { sequelizeTypescript } from '../../../initializers/database'
|
||||
import { AccountVideoRateModel } from '../../../models/account/account-video-rate'
|
||||
import { ActorModel } from '../../../models/activitypub/actor'
|
||||
import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
|
||||
import { ActorModel } from '../../../models/actor/actor'
|
||||
import { ActorFollowModel } from '../../../models/actor/actor-follow'
|
||||
import { VideoRedundancyModel } from '../../../models/redundancy/video-redundancy'
|
||||
import { VideoShareModel } from '../../../models/video/video-share'
|
||||
import { APProcessorOptions } from '../../../types/activitypub-processor.model'
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
import { isRedundancyAccepted } from '@server/lib/redundancy'
|
||||
import { ActorImageType } from '@shared/models'
|
||||
import { ActivityUpdate, CacheFileObject, VideoObject } from '../../../../shared/models/activitypub'
|
||||
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 { logger } from '../../../helpers/logger'
|
||||
import { sequelizeTypescript } from '../../../initializers/database'
|
||||
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 { 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 { MActorSignature, MAccountIdActor } from '../../../types/models'
|
||||
import { isRedundancyAccepted } from '@server/lib/redundancy'
|
||||
import { ActorImageType } from '@shared/models'
|
||||
import { MAccountIdActor, MActorSignature } from '../../../types/models'
|
||||
import { getImageInfoIfExists, updateActorImageInstance, updateActorInstance } from '../actor'
|
||||
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>) {
|
||||
const { activity, byActor } = options
|
||||
|
|
|
@ -2,7 +2,7 @@ import { Transaction } from 'sequelize'
|
|||
import { getServerActor } from '@server/models/application/application'
|
||||
import { ActivityAudience, ActivityDelete } from '../../../../shared/models/activitypub'
|
||||
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 { VideoShareModel } from '../../../models/video/video-share'
|
||||
import { MActorUrl } from '../../../types/models'
|
||||
|
|
|
@ -2,7 +2,7 @@ import { Transaction } from 'sequelize'
|
|||
import { MActorAudience, MVideoImmutable, MVideoUrl } from '@server/types/models'
|
||||
import { ActivityAudience, ActivityView } from '../../../../shared/models/activitypub'
|
||||
import { logger } from '../../../helpers/logger'
|
||||
import { ActorModel } from '../../../models/activitypub/actor'
|
||||
import { ActorModel } from '../../../models/actor/actor'
|
||||
import { audiencify, getAudience } from '../audience'
|
||||
import { getLocalVideoViewActivityPubUrl } from '../url'
|
||||
import { sendVideoRelatedActivity } from './utils'
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
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 { 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: {
|
||||
byActor: MActorLight
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import * as express from 'express'
|
||||
import { AccessDeniedError } from 'oauth2-server'
|
||||
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 { MOAuthTokenUser } from '@server/types/models/oauth/oauth-token'
|
||||
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 { logger } from '../../helpers/logger'
|
||||
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 { OAuthTokenModel } from '../../models/oauth/oauth-token'
|
||||
import { createUserAccountAndChannelAndPlaylist } from '../user'
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
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 { 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) {
|
||||
const payload = job.data as ActivitypubFollowPayload
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import * as Bull from 'bull'
|
||||
import { refreshVideoPlaylistIfNeeded } from '@server/lib/activitypub/playlist'
|
||||
import { RefreshPayload } from '@shared/models'
|
||||
import { logger } from '../../../helpers/logger'
|
||||
import { fetchVideoByUrl } from '../../../helpers/video'
|
||||
import { ActorModel } from '../../../models/actor/actor'
|
||||
import { VideoPlaylistModel } from '../../../models/video/video-playlist'
|
||||
import { refreshActorIfNeeded } from '../../activitypub/actor'
|
||||
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) {
|
||||
const payload = job.data as RefreshPayload
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import * as Bull from 'bull'
|
||||
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 { logger } from '../../../helpers/logger'
|
||||
|
||||
|
|
|
@ -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 { getServerActor } from '@server/models/application/application'
|
||||
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 }
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ import { copy, stat } from 'fs-extra'
|
|||
import { extname } from 'path'
|
||||
import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent'
|
||||
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 { VideoFileImportPayload } from '@shared/models'
|
||||
import { getVideoFileFPS, getVideoFileResolution } from '../../../helpers/ffprobe-utils'
|
||||
|
|
|
@ -2,7 +2,7 @@ import * as Bull from 'bull'
|
|||
import { TranscodeOptionsType } from '@server/helpers/ffmpeg-utils'
|
||||
import { getTranscodingJobPriority, publishAndFederateIfNeeded } from '@server/lib/video'
|
||||
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 {
|
||||
HLSTranscodingPayload,
|
||||
|
|
|
@ -11,7 +11,7 @@ import { computeResolutionsToTranscode, getVideoFileFPS, getVideoFileResolution
|
|||
import { logger } from '@server/helpers/logger'
|
||||
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 { UserModel } from '@server/models/account/user'
|
||||
import { UserModel } from '@server/models/user/user'
|
||||
import { VideoModel } from '@server/models/video/video'
|
||||
import { VideoFileModel } from '@server/models/video/video-file'
|
||||
import { VideoLiveModel } from '@server/models/video/video-live'
|
||||
|
|
|
@ -24,8 +24,8 @@ import { VideoObject } from '../../shared/models/activitypub/objects'
|
|||
import { VideoCommentObject } from '../../shared/models/activitypub/objects/video-comment-object'
|
||||
import { LiveVideoCreate, VideoCreate, VideoImportCreate } from '../../shared/models/videos'
|
||||
import { VideoCommentCreate } from '../../shared/models/videos/video-comment.model'
|
||||
import { UserModel } from '../models/account/user'
|
||||
import { ActorModel } from '../models/activitypub/actor'
|
||||
import { UserModel } from '../models/user/user'
|
||||
import { ActorModel } from '../models/actor/actor'
|
||||
import { VideoModel } from '../models/video/video'
|
||||
import { VideoCommentModel } from '../models/video/video-comment'
|
||||
import { sendAbuse } from './activitypub/send/send-flag'
|
||||
|
|
|
@ -17,8 +17,8 @@ import { VideoPrivacy, VideoState } from '../../shared/models/videos'
|
|||
import { logger } from '../helpers/logger'
|
||||
import { CONFIG } from '../initializers/config'
|
||||
import { AccountBlocklistModel } from '../models/account/account-blocklist'
|
||||
import { UserModel } from '../models/account/user'
|
||||
import { UserNotificationModel } from '../models/account/user-notification'
|
||||
import { UserModel } from '../models/user/user'
|
||||
import { UserNotificationModel } from '../models/user/user-notification'
|
||||
import { MAbuseFull, MAbuseMessage, MAccountServer, MActorFollowFull, MApplication, MPlugin } from '../types/models'
|
||||
import { MCommentOwnerVideo, MVideoAccountLight, MVideoFullLight } from '../types/models/video'
|
||||
import { isBlockedByServerOrAccount } from './blocklist'
|
||||
|
|
|
@ -17,7 +17,7 @@ import { VideoBlacklistCreate } from '@shared/models'
|
|||
import { addAccountInBlocklist, addServerInBlocklist, removeAccountFromBlocklist, removeServerFromBlocklist } from '../blocklist'
|
||||
import { getServerConfig } from '../config'
|
||||
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 {
|
||||
const logger = buildPluginLogger(npmName)
|
||||
|
|
|
@ -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 { 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) {
|
||||
const serverActor = await getServerActor()
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { isTestInstance } from '../../helpers/core-utils'
|
||||
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 { ActorFollowModel } from '../../models/actor/actor-follow'
|
||||
import { ActorFollowScoreCache } from '../files-cache'
|
||||
import { AbstractScheduler } from './abstract-scheduler'
|
||||
|
||||
export class ActorFollowScheduler extends AbstractScheduler {
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { chunk } from 'lodash'
|
||||
import { doJSONRequest } from '@server/helpers/requests'
|
||||
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 { logger } from '../../helpers/logger'
|
||||
import { CONFIG } from '../../initializers/config'
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { logger } from '../../helpers/logger'
|
||||
import { AbstractScheduler } from './abstract-scheduler'
|
||||
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'
|
||||
|
||||
export class RemoveOldHistoryScheduler extends AbstractScheduler {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { CONFIG } from '@server/initializers/config'
|
||||
import { UserModel } from '@server/models/account/user'
|
||||
import { ActorFollowModel } from '@server/models/activitypub/actor-follow'
|
||||
import { UserModel } from '@server/models/user/user'
|
||||
import { ActorFollowModel } from '@server/models/actor/actor-follow'
|
||||
import { VideoRedundancyModel } from '@server/models/redundancy/video-redundancy'
|
||||
import { VideoModel } from '@server/models/video/video'
|
||||
import { VideoChannelModel } from '@server/models/video/video-channel'
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
import { Transaction } from 'sequelize/types'
|
||||
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 { UserNotificationSetting, UserNotificationSettingValue } from '../../shared/models/users'
|
||||
import { SERVER_ACTOR_NAME, WEBSERVER } from '../initializers/constants'
|
||||
import { sequelizeTypescript } from '../initializers/database'
|
||||
import { AccountModel } from '../models/account/account'
|
||||
import { UserNotificationSettingModel } from '../models/account/user-notification-setting'
|
||||
import { ActorModel } from '../models/activitypub/actor'
|
||||
import { MAccountDefault, MActorDefault, MChannelActor } from '../types/models'
|
||||
import { ActorModel } from '../models/actor/actor'
|
||||
import { UserNotificationSettingModel } from '../models/user/user-notification-setting'
|
||||
import { MAccountDefault, MChannelActor } from '../types/models'
|
||||
import { MUser, MUserDefault, MUserId } from '../types/models/user'
|
||||
import { buildActorInstance, generateAndSaveActorKeys } from './activitypub/actor'
|
||||
import { getLocalAccountActivityPubUrl } from './activitypub/url'
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
import * as express from 'express'
|
||||
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 { getServerActor } from '@server/models/application/application'
|
||||
import { MActorFollowActorsDefault } from '@server/types/models'
|
||||
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 = [
|
||||
query('state')
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import * as express from 'express'
|
||||
import { body, param, query } from 'express-validator'
|
||||
import { logger } from '../../helpers/logger'
|
||||
import { areValidationErrors } from './utils'
|
||||
import { ActorFollowModel } from '../../models/activitypub/actor-follow'
|
||||
import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
|
||||
import { areValidActorHandles, isValidActorHandle } from '../../helpers/custom-validators/activitypub/actor'
|
||||
import { toArray } from '../../helpers/custom-validators/misc'
|
||||
import { logger } from '../../helpers/logger'
|
||||
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 = [
|
||||
query('search').optional().not().isEmpty().withMessage('Should have a valid search'),
|
||||
|
|
|
@ -34,8 +34,8 @@ import { doesVideoExist } from '../../helpers/middlewares'
|
|||
import { isSignupAllowed, isSignupAllowedForCurrentIP } from '../../helpers/signup'
|
||||
import { isThemeRegistered } from '../../lib/plugins/theme-utils'
|
||||
import { Redis } from '../../lib/redis'
|
||||
import { UserModel } from '../../models/account/user'
|
||||
import { ActorModel } from '../../models/activitypub/actor'
|
||||
import { UserModel } from '../../models/user/user'
|
||||
import { ActorModel } from '../../models/actor/actor'
|
||||
import { areValidationErrors } from './utils'
|
||||
|
||||
const usersListValidator = [
|
||||
|
|
|
@ -3,6 +3,7 @@ import { body, param, query } from 'express-validator'
|
|||
import { VIDEO_CHANNELS } from '@server/initializers/constants'
|
||||
import { MChannelAccountDefault, MUser } from '@server/types/models'
|
||||
import { UserRight } from '../../../../shared'
|
||||
import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
|
||||
import { isActorPreferredUsernameValid } from '../../../helpers/custom-validators/activitypub/actor'
|
||||
import { isBooleanValid, toBooleanOrNull } from '../../../helpers/custom-validators/misc'
|
||||
import {
|
||||
|
@ -12,10 +13,9 @@ import {
|
|||
} from '../../../helpers/custom-validators/video-channels'
|
||||
import { logger } from '../../../helpers/logger'
|
||||
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 { areValidationErrors } from '../utils'
|
||||
import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
|
||||
|
||||
const videoChannelsAddValidator = [
|
||||
body('name').custom(isActorPreferredUsernameValid).withMessage('Should have a valid channel name'),
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import * as express from 'express'
|
||||
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 { 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 = [
|
||||
query('resource').custom(isWebfingerLocalResourceValid).withMessage('Should have a valid webfinger resource'),
|
||||
|
|
|
@ -2,7 +2,7 @@ import { Op } from 'sequelize'
|
|||
import { BelongsTo, Column, CreatedAt, ForeignKey, Model, Scopes, Table, UpdatedAt } from 'sequelize-typescript'
|
||||
import { MAccountBlocklist, MAccountBlocklistAccounts, MAccountBlocklistFormattable } from '@server/types/models'
|
||||
import { AccountBlock } from '../../../shared/models'
|
||||
import { ActorModel } from '../activitypub/actor'
|
||||
import { ActorModel } from '../actor/actor'
|
||||
import { ServerModel } from '../server/server'
|
||||
import { getSort, searchAttribute } from '../utils'
|
||||
import { AccountModel } from './account'
|
||||
|
|
|
@ -11,7 +11,7 @@ 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 '../activitypub/actor'
|
||||
import { ActorModel } from '../actor/actor'
|
||||
import { buildLocalAccountIdsIn, getSort, throwIfNotValid } from '../utils'
|
||||
import { VideoModel } from '../video/video'
|
||||
import { ScopeNames as VideoChannelScopeNames, SummaryOptions, VideoChannelModel } from '../video/video-channel'
|
||||
|
|
|
@ -30,19 +30,19 @@ import {
|
|||
MAccountSummaryFormattable,
|
||||
MChannelActor
|
||||
} from '../../types/models'
|
||||
import { ActorModel } from '../activitypub/actor'
|
||||
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 { ActorImageModel } from './actor-image'
|
||||
import { ServerModel } from '../server/server'
|
||||
import { ServerBlocklistModel } from '../server/server-blocklist'
|
||||
import { UserModel } from '../user/user'
|
||||
import { getSort, throwIfNotValid } from '../utils'
|
||||
import { VideoModel } from '../video/video'
|
||||
import { VideoChannelModel } from '../video/video-channel'
|
||||
import { VideoCommentModel } from '../video/video-comment'
|
||||
import { VideoPlaylistModel } from '../video/video-playlist'
|
||||
import { AccountBlocklistModel } from './account-blocklist'
|
||||
import { UserModel } from './user'
|
||||
|
||||
export enum ScopeNames {
|
||||
SUMMARY = 'SUMMARY'
|
||||
|
|
|
@ -51,12 +51,12 @@ import {
|
|||
MActorWithInboxes
|
||||
} from '../../types/models'
|
||||
import { AccountModel } from '../account/account'
|
||||
import { ActorImageModel } from '../account/actor-image'
|
||||
import { ServerModel } from '../server/server'
|
||||
import { isOutdated, throwIfNotValid } from '../utils'
|
||||
import { VideoModel } from '../video/video'
|
||||
import { VideoChannelModel } from '../video/video-channel'
|
||||
import { ActorFollowModel } from './actor-follow'
|
||||
import { ActorImageModel } from './actor-image'
|
||||
|
||||
enum ScopeNames {
|
||||
FULL = 'FULL'
|
|
@ -17,8 +17,8 @@ import { MUserAccountId } from '@server/types/models'
|
|||
import { MOAuthTokenUser } from '@server/types/models/oauth/oauth-token'
|
||||
import { logger } from '../../helpers/logger'
|
||||
import { AccountModel } from '../account/account'
|
||||
import { UserModel } from '../account/user'
|
||||
import { ActorModel } from '../activitypub/actor'
|
||||
import { ActorModel } from '../actor/actor'
|
||||
import { UserModel } from '../user/user'
|
||||
import { OAuthClientModel } from './oauth-client'
|
||||
|
||||
export type OAuthTokenInfo = {
|
||||
|
|
|
@ -29,7 +29,7 @@ import { isActivityPubUrlValid, isUrlValid } from '../../helpers/custom-validato
|
|||
import { logger } from '../../helpers/logger'
|
||||
import { CONFIG } from '../../initializers/config'
|
||||
import { CONSTRAINTS_FIELDS, MIMETYPES } from '../../initializers/constants'
|
||||
import { ActorModel } from '../activitypub/actor'
|
||||
import { ActorModel } from '../actor/actor'
|
||||
import { ServerModel } from '../server/server'
|
||||
import { getSort, getVideoSort, parseAggregateResult, throwIfNotValid } from '../utils'
|
||||
import { ScheduleVideoUpdateModel } from '../video/schedule-video-update'
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { AllowNull, Column, CreatedAt, Default, HasMany, Is, Model, Table, UpdatedAt } from 'sequelize-typescript'
|
||||
import { MServer, MServerFormattable } from '@server/types/models/server'
|
||||
import { isHostValid } from '../../helpers/custom-validators/servers'
|
||||
import { ActorModel } from '../activitypub/actor'
|
||||
import { ActorModel } from '../actor/actor'
|
||||
import { throwIfNotValid } from '../utils'
|
||||
import { ServerBlocklistModel } from './server-blocklist'
|
||||
|
||||
|
|
|
@ -7,8 +7,10 @@ import { isUserNotificationTypeValid } from '../../helpers/custom-validators/use
|
|||
import { AbuseModel } from '../abuse/abuse'
|
||||
import { VideoAbuseModel } from '../abuse/video-abuse'
|
||||
import { VideoCommentAbuseModel } from '../abuse/video-comment-abuse'
|
||||
import { ActorModel } from '../activitypub/actor'
|
||||
import { ActorFollowModel } from '../activitypub/actor-follow'
|
||||
import { AccountModel } from '../account/account'
|
||||
import { ActorModel } from '../actor/actor'
|
||||
import { ActorFollowModel } from '../actor/actor-follow'
|
||||
import { ActorImageModel } from '../actor/actor-image'
|
||||
import { ApplicationModel } from '../application/application'
|
||||
import { PluginModel } from '../server/plugin'
|
||||
import { ServerModel } from '../server/server'
|
||||
|
@ -18,8 +20,6 @@ import { VideoBlacklistModel } from '../video/video-blacklist'
|
|||
import { VideoChannelModel } from '../video/video-channel'
|
||||
import { VideoCommentModel } from '../video/video-comment'
|
||||
import { VideoImportModel } from '../video/video-import'
|
||||
import { AccountModel } from './account'
|
||||
import { ActorImageModel } from './actor-image'
|
||||
import { UserModel } from './user'
|
||||
|
||||
enum ScopeNames {
|
|
@ -60,8 +60,10 @@ import {
|
|||
import { comparePassword, cryptPassword } from '../../helpers/peertube-crypto'
|
||||
import { DEFAULT_USER_THEME_NAME, NSFW_POLICY_TYPES } from '../../initializers/constants'
|
||||
import { getThemeOrDefault } from '../../lib/plugins/theme-utils'
|
||||
import { ActorModel } from '../activitypub/actor'
|
||||
import { ActorFollowModel } from '../activitypub/actor-follow'
|
||||
import { AccountModel } from '../account/account'
|
||||
import { ActorModel } from '../actor/actor'
|
||||
import { ActorFollowModel } from '../actor/actor-follow'
|
||||
import { ActorImageModel } from '../actor/actor-image'
|
||||
import { OAuthTokenModel } from '../oauth/oauth-token'
|
||||
import { getSort, throwIfNotValid } from '../utils'
|
||||
import { VideoModel } from '../video/video'
|
||||
|
@ -69,9 +71,7 @@ import { VideoChannelModel } from '../video/video-channel'
|
|||
import { VideoImportModel } from '../video/video-import'
|
||||
import { VideoLiveModel } from '../video/video-live'
|
||||
import { VideoPlaylistModel } from '../video/video-playlist'
|
||||
import { AccountModel } from './account'
|
||||
import { UserNotificationSettingModel } from './user-notification-setting'
|
||||
import { ActorImageModel } from './actor-image'
|
||||
|
||||
enum ScopeNames {
|
||||
FOR_ME_API = 'FOR_ME_API',
|
|
@ -36,9 +36,9 @@ import {
|
|||
MChannelSummaryFormattable
|
||||
} from '../../types/models/video'
|
||||
import { AccountModel, ScopeNames as AccountModelScopeNames, SummaryOptions as AccountSummaryOptions } from '../account/account'
|
||||
import { ActorImageModel } from '../account/actor-image'
|
||||
import { ActorModel, unusedActorAttributesForAPI } from '../activitypub/actor'
|
||||
import { ActorFollowModel } from '../activitypub/actor-follow'
|
||||
import { ActorModel, unusedActorAttributesForAPI } from '../actor/actor'
|
||||
import { ActorFollowModel } from '../actor/actor-follow'
|
||||
import { ActorImageModel } from '../actor/actor-image'
|
||||
import { ServerModel } from '../server/server'
|
||||
import { buildServerIdsFollowedBy, buildTrigramSearchIndex, createSimilarityAttribute, getSort, throwIfNotValid } from '../utils'
|
||||
import { VideoModel } from './video'
|
||||
|
|
|
@ -39,7 +39,7 @@ import {
|
|||
} from '../../types/models/video'
|
||||
import { VideoCommentAbuseModel } from '../abuse/video-comment-abuse'
|
||||
import { AccountModel } from '../account/account'
|
||||
import { ActorModel, unusedActorAttributesForAPI } from '../activitypub/actor'
|
||||
import { ActorModel, unusedActorAttributesForAPI } from '../actor/actor'
|
||||
import {
|
||||
buildBlockedAccountSQL,
|
||||
buildBlockedAccountSQLOptimized,
|
||||
|
|
|
@ -13,15 +13,15 @@ import {
|
|||
Table,
|
||||
UpdatedAt
|
||||
} 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'
|
||||
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'
|
||||
import { UserModel } from '../account/user'
|
||||
import { UserModel } from '../user/user'
|
||||
import { getSort, throwIfNotValid } from '../utils'
|
||||
import { ScopeNames as VideoModelScopeNames, VideoModel } from './video'
|
||||
import { afterCommitIfTransaction } from '@server/helpers/database-utils'
|
||||
|
||||
@DefaultScope(() => ({
|
||||
include: [
|
||||
|
|
|
@ -50,11 +50,11 @@ import {
|
|||
MVideoPlaylistIdWithElements
|
||||
} from '../../types/models/video/video-playlist'
|
||||
import { AccountModel, ScopeNames as AccountScopeNames, SummaryOptions } from '../account/account'
|
||||
import { ActorModel } from '../actor/actor'
|
||||
import { buildServerIdsFollowedBy, buildWhereIdOrUUID, getPlaylistSort, isOutdated, throwIfNotValid } from '../utils'
|
||||
import { ThumbnailModel } from './thumbnail'
|
||||
import { ScopeNames as VideoChannelScopeNames, VideoChannelModel } from './video-channel'
|
||||
import { VideoPlaylistElementModel } from './video-playlist-element'
|
||||
import { ActorModel } from '../activitypub/actor'
|
||||
|
||||
enum ScopeNames {
|
||||
AVAILABLE_FOR_LIST = 'AVAILABLE_FOR_LIST',
|
||||
|
|
|
@ -4,7 +4,7 @@ import { isActivityPubUrlValid } from '../../helpers/custom-validators/activityp
|
|||
import { CONSTRAINTS_FIELDS } from '../../initializers/constants'
|
||||
import { MActorDefault } from '../../types/models'
|
||||
import { MVideoShareActor, MVideoShareFull } from '../../types/models/video'
|
||||
import { ActorModel } from '../activitypub/actor'
|
||||
import { ActorModel } from '../actor/actor'
|
||||
import { buildLocalActorIdsIn, throwIfNotValid } from '../utils'
|
||||
import { VideoModel } from './video'
|
||||
|
||||
|
|
|
@ -100,14 +100,14 @@ import { MVideoFile, MVideoFileStreamingPlaylistVideo } from '../../types/models
|
|||
import { VideoAbuseModel } from '../abuse/video-abuse'
|
||||
import { AccountModel } from '../account/account'
|
||||
import { AccountVideoRateModel } from '../account/account-video-rate'
|
||||
import { ActorImageModel } from '../account/actor-image'
|
||||
import { UserModel } from '../account/user'
|
||||
import { UserVideoHistoryModel } from '../account/user-video-history'
|
||||
import { ActorModel } from '../activitypub/actor'
|
||||
import { ActorModel } from '../actor/actor'
|
||||
import { ActorImageModel } from '../actor/actor-image'
|
||||
import { VideoRedundancyModel } from '../redundancy/video-redundancy'
|
||||
import { ServerModel } from '../server/server'
|
||||
import { TrackerModel } from '../server/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 { ScheduleVideoUpdateModel } from './schedule-video-update'
|
||||
import { TagModel } from './tag'
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import { FunctionProperties, PickWith } from '@shared/core-utils'
|
||||
import { AccountModel } from '../../../models/account/account'
|
||||
import { MChannelDefault } from '../video/video-channels'
|
||||
import { MAccountBlocklistId } from './account-blocklist'
|
||||
import {
|
||||
MActor,
|
||||
MActorAPAccount,
|
||||
|
@ -15,7 +13,9 @@ import {
|
|||
MActorSummary,
|
||||
MActorSummaryFormattable,
|
||||
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>
|
||||
|
||||
|
|
|
@ -1,5 +1,2 @@
|
|||
export * from './account'
|
||||
export * from './account-blocklist'
|
||||
export * from './actor-follow'
|
||||
export * from './actor-image'
|
||||
export * from './actor'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { PickWith } from '@shared/core-utils'
|
||||
import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
|
||||
import { ActorFollowModel } from '../../../models/actor/actor-follow'
|
||||
import {
|
||||
MActor,
|
||||
MActorChannelAccountActor,
|
|
@ -1,5 +1,5 @@
|
|||
import { ActorImageModel } from '../../../models/account/actor-image'
|
||||
import { FunctionProperties } from '@shared/core-utils'
|
||||
import { ActorImageModel } from '../../../models/actor/actor-image'
|
||||
|
||||
export type MActorImage = ActorImageModel
|
||||
|
|
@ -1,9 +1,8 @@
|
|||
|
||||
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 { MChannel, MChannelAccountActor, MChannelAccountDefault, MChannelId, MChannelIdActor } from '../video'
|
||||
import { MAccount, MAccountDefault, MAccountId, MAccountIdActor } from './account'
|
||||
import { MActorImage, MActorImageFormattable } from './actor-image'
|
||||
|
||||
type Use<K extends keyof ActorModel, M> = PickWith<ActorModel, K, M>
|
3
server/types/models/actor/index.ts
Normal file
3
server/types/models/actor/index.ts
Normal file
|
@ -0,0 +1,3 @@
|
|||
export * from './actor-follow'
|
||||
export * from './actor-image'
|
||||
export * from './actor'
|
|
@ -1,6 +1,7 @@
|
|||
export * from './abuse'
|
||||
export * from './account'
|
||||
export * from './actor'
|
||||
export * from './application'
|
||||
export * from './moderation'
|
||||
export * from './oauth'
|
||||
export * from './server'
|
||||
export * from './user'
|
||||
|
|
|
@ -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'>
|
||||
|
||||
|
|
|
@ -2,13 +2,13 @@ import { VideoAbuseModel } from '@server/models/abuse/video-abuse'
|
|||
import { VideoCommentAbuseModel } from '@server/models/abuse/video-comment-abuse'
|
||||
import { ApplicationModel } from '@server/models/application/application'
|
||||
import { PluginModel } from '@server/models/server/plugin'
|
||||
import { UserNotificationModel } from '@server/models/user/user-notification'
|
||||
import { PickWith, PickWithOpt } from '@shared/core-utils'
|
||||
import { AbuseModel } from '../../../models/abuse/abuse'
|
||||
import { AccountModel } from '../../../models/account/account'
|
||||
import { ActorImageModel } from '../../../models/account/actor-image'
|
||||
import { UserNotificationModel } from '../../../models/account/user-notification'
|
||||
import { ActorModel } from '../../../models/activitypub/actor'
|
||||
import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
|
||||
import { ActorModel } from '../../../models/actor/actor'
|
||||
import { ActorFollowModel } from '../../../models/actor/actor-follow'
|
||||
import { ActorImageModel } from '../../../models/actor/actor-image'
|
||||
import { ServerModel } from '../../../models/server/server'
|
||||
import { VideoModel } from '../../../models/video/video'
|
||||
import { VideoBlacklistModel } from '../../../models/video/video-blacklist'
|
||||
|
|
|
@ -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'>
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { AccountModel } from '@server/models/account/account'
|
||||
import { UserModel } from '@server/models/user/user'
|
||||
import { MVideoPlaylist } from '@server/types/models'
|
||||
import { PickWith, PickWithOpt } from '@shared/core-utils'
|
||||
import { UserModel } from '../../../models/account/user'
|
||||
import {
|
||||
MAccount,
|
||||
MAccountDefault,
|
||||
|
|
|
@ -9,7 +9,9 @@ import {
|
|||
MAccountSummaryBlocks,
|
||||
MAccountSummaryFormattable,
|
||||
MAccountUrl,
|
||||
MAccountUserId,
|
||||
MAccountUserId
|
||||
} from '../account'
|
||||
import {
|
||||
MActor,
|
||||
MActorAccountChannelId,
|
||||
MActorAPChannel,
|
||||
|
@ -23,7 +25,7 @@ import {
|
|||
MActorSummary,
|
||||
MActorSummaryFormattable,
|
||||
MActorUrl
|
||||
} from '../account'
|
||||
} from '../actor'
|
||||
import { MVideo } from './video'
|
||||
|
||||
type Use<K extends keyof VideoChannelModel, M> = PickWith<VideoChannelModel, K, M>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { VideoShareModel } from '../../../models/video/video-share'
|
||||
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'
|
||||
|
||||
type Use<K extends keyof VideoShareModel, M> = PickWith<VideoShareModel, K, M>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { Router, Response } from 'express'
|
||||
import { Response, Router } from 'express'
|
||||
import { Logger } from 'winston'
|
||||
import { ActorModel } from '@server/models/activitypub/actor'
|
||||
import { ActorModel } from '@server/models/actor/actor'
|
||||
import {
|
||||
PluginPlaylistPrivacyManager,
|
||||
PluginSettingsManager,
|
||||
|
|
Loading…
Add table
Reference in a new issue