import { Activity, ActivityPubCollection, ActivityPubOrderedCollection, ActivityType, RootActivity } from '../../../shared'
import { logger } from '../../helpers'
import { isActivityValid } from '../../helpers/custom-validators/activitypub/activity'
-import { processCreateActivity, processFlagActivity, processUpdateActivity } from '../../lib'
+import { processCreateActivity, processUpdateActivity } from '../../lib'
import { processAcceptActivity } from '../../lib/activitypub/process-accept'
import { processAddActivity } from '../../lib/activitypub/process-add'
import { processAnnounceActivity } from '../../lib/activitypub/process-announce'
Create: processCreateActivity,
Add: processAddActivity,
Update: processUpdateActivity,
- Flag: processFlagActivity,
Delete: processDeleteActivity,
Follow: processFollowActivity,
Accept: processAcceptActivity,
import * as express from 'express'
-
-import { CONFIG, PREVIEWS_SIZE, EMBED_SIZE } from '../initializers'
-import { oembedValidator } from '../middlewares'
-import { VideoInstance } from '../models'
import { webfingerValidator } from '../middlewares/validators/webfinger'
import { AccountInstance } from '../models/account/account-interface'
-import { values } from 'lodash'
-import * as validator from 'validator'
import * as Promise from 'bluebird'
import * as express from 'express'
import 'express-validator'
+import { values } from 'lodash'
import 'multer'
-
+import * as validator from 'validator'
+import { VideoRateType } from '../../../shared'
+import { logger } from '../../helpers'
import {
CONSTRAINTS_FIELDS,
+ database as db,
VIDEO_CATEGORIES,
- VIDEO_LICENCES,
VIDEO_LANGUAGES,
- VIDEO_RATE_TYPES,
+ VIDEO_LICENCES,
VIDEO_PRIVACIES,
- database as db
+ VIDEO_RATE_TYPES
} from '../../initializers'
-import { isUserUsernameValid } from './users'
-import { isArray, exists } from './misc'
import { VideoInstance } from '../../models'
-import { logger } from '../../helpers'
-import { VideoRateType } from '../../../shared'
import { isActivityPubUrlValid } from './activitypub/misc'
+import { exists, isArray } from './misc'
const VIDEOS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEOS
const VIDEO_ABUSES_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.VIDEO_ABUSES
export * from './process-announce'
export * from './process-create'
export * from './process-delete'
-export * from './process-flag'
export * from './process-follow'
export * from './process-update'
export * from './send-request'
const videoChannelUrl = activity.target
const videoChannel = await getOrCreateVideoChannel(account, videoChannelUrl)
- return processAddVideo(account, activity, videoChannel, activityObject as VideoTorrentObject)
+ return processAddVideo(account, activity, videoChannel, activityObject)
}
logger.warn('Unknown activity object type %s when creating activity.', activityType, { activity: activity.id })
const videoCreated = await video.save(sequelizeOptions)
- const videoFileAttributes = await videoFileActivityUrlToDBAttributes(videoCreated, videoToCreateData)
+ const videoFileAttributes = videoFileActivityUrlToDBAttributes(videoCreated, videoToCreateData)
if (videoFileAttributes.length === 0) {
throw new Error('Cannot find valid files for video %s ' + videoToCreateData.url)
}
import { ActivityAnnounce } from '../../../shared/models/activitypub/activity'
-import { VideoChannelObject } from '../../../shared/models/activitypub/objects/video-channel-object'
-import { VideoTorrentObject } from '../../../shared/models/activitypub/objects/video-torrent-object'
+import { getOrCreateAccount } from '../../helpers/activitypub'
import { logger } from '../../helpers/logger'
-import { processAddActivity } from './process-add'
-import { processCreateActivity } from './process-create'
import { database as db } from '../../initializers/index'
-import { getOrCreateAccount } from '../../helpers/activitypub'
-import { VideoChannelInstance } from '../../models/video/video-channel-interface'
import { VideoInstance } from '../../models/index'
+import { VideoChannelInstance } from '../../models/video/video-channel-interface'
+import { processAddActivity } from './process-add'
+import { processCreateActivity } from './process-create'
async function processAnnounceActivity (activity: ActivityAnnounce) {
const announcedActivity = activity.object
const video = await db.Video.loadByUrlAndPopulateAccount(videoAbuseToCreateData.object, t)
if (!video) {
logger.warn('Unknown video %s for remote video abuse.', videoAbuseToCreateData.object)
- return
+ return undefined
}
const videoAbuseData = {
}
}
- return undefined
+ return
}
// ---------------------------------------------------------------------------
+++ /dev/null
-import {
- ActivityCreate,
- VideoTorrentObject,
- VideoChannelObject
-} from '../../../shared'
-
-function processFlagActivity (activity: ActivityCreate) {
- return Promise.resolve(undefined)
-}
-
-// ---------------------------------------------------------------------------
-
-export {
- processFlagActivity
-}
-
-// ---------------------------------------------------------------------------
}
await Promise.all(videoFileDestroyTasks)
- const videoFileAttributes = await videoFileActivityUrlToDBAttributes(videoInstance, videoAttributesToUpdate)
+ const videoFileAttributes = videoFileActivityUrlToDBAttributes(videoInstance, videoAttributesToUpdate)
const tasks: Bluebird<any>[] = videoFileAttributes.map(f => db.VideoFile.create(f))
await Promise.all(tasks)
const result = await db.AccountFollow.listAcceptedFollowerSharedInboxUrls(toAccountFollowerIds)
if (result.data.length === 0) {
logger.info('Not broadcast because of 0 followers for %s.', toAccountFollowerIds.join(', '))
- return
+ return undefined
}
const jobPayload = {
import { logger } from '../../helpers'
import { database as db, JOB_STATES, JOBS_FETCH_LIMIT_PER_CYCLE, JOBS_FETCHING_INTERVAL } from '../../initializers'
import { JobInstance } from '../../models'
-import { error } from 'util'
export interface JobHandler<P, T> {
process (data: object, jobId: number): Promise<T>
import * as Sequelize from 'sequelize'
-
-import { database as db } from '../initializers'
+import { VideoChannelCreate } from '../../shared/models'
import { logger } from '../helpers'
+import { getActivityPubUrl } from '../helpers/activitypub'
+import { database as db } from '../initializers'
import { AccountInstance } from '../models'
-import { VideoChannelCreate } from '../../shared/models'
-import { sendCreateVideoChannel } from './activitypub/send-request'
-import { getActivityPubUrl, shareVideoChannelByServer } from '../helpers/activitypub'
async function createVideoChannel (videoChannelInfo: VideoChannelCreate, account: AccountInstance, t: Sequelize.Transaction) {
const videoChannelData = {
import * as express from 'express'
import { param } from 'express-validator/check'
-import {
- isUserDisplayNSFWValid,
- isUserPasswordValid,
- isUserRoleValid,
- isUserUsernameValid,
- isUserVideoQuotaValid,
- logger
-} from '../../helpers'
+import { logger } from '../../helpers'
import { isAccountNameValid } from '../../helpers/custom-validators/accounts'
import { database as db } from '../../initializers/database'
import { AccountInstance } from '../../models'
checkErrors(req, res, () => {
// Remove 'acct:' from the beginning of the string
const nameWithHost = req.query.resource.substr(5)
- const [ name, ] = nameWithHost.split('@')
+ const [ name ] = nameWithHost.split('@')
db.Account.loadLocalByName(name)
.then(account => {
videoId: number
}
-export interface AccountVideoRateInstance extends AccountVideoRateClass, AccountVideoRateAttributes, Sequelize.Instance<AccountVideoRateAttributes> {
+export interface AccountVideoRateInstance
+ extends AccountVideoRateClass, AccountVideoRateAttributes, Sequelize.Instance<AccountVideoRateAttributes> {
id: number
createdAt: Date
updatedAt: Date
}
-export interface AccountVideoRateModel extends AccountVideoRateClass, Sequelize.Model<AccountVideoRateInstance, AccountVideoRateAttributes> {}
+export interface AccountVideoRateModel
+ extends AccountVideoRateClass, Sequelize.Model<AccountVideoRateInstance, AccountVideoRateAttributes> {}
import * as Sequelize from 'sequelize'
import {
- isUserUsernameValid,
- isAccountPublicKeyValid,
- isAccountUrlValid,
- isAccountPrivateKeyValid,
+ activityPubContextify,
isAccountFollowersCountValid,
+ isAccountFollowersValid,
isAccountFollowingCountValid,
+ isAccountFollowingValid,
isAccountInboxValid,
isAccountOutboxValid,
+ isAccountPrivateKeyValid,
+ isAccountPublicKeyValid,
isAccountSharedInboxValid,
- isAccountFollowersValid,
- isAccountFollowingValid,
- activityPubContextify
+ isAccountUrlValid,
+ isUserUsernameValid
} from '../../helpers'
-
-import { addMethodsToModel, getSort } from '../utils'
-import {
- AccountInstance,
- AccountAttributes,
-
- AccountMethods
-} from './account-interface'
-import { sendDeleteAccount } from '../../lib/activitypub/send-request'
import { CONFIG, CONSTRAINTS_FIELDS } from '../../initializers/constants'
+import { sendDeleteAccount } from '../../lib/activitypub/send-request'
+
+import { addMethodsToModel } from '../utils'
+import { AccountAttributes, AccountInstance, AccountMethods } from './account-interface'
let Account: Sequelize.Model<AccountInstance, AccountAttributes>
let loadAccountByServerAndUUID: AccountMethods.LoadAccountByServerAndUUID
/* tslint:disable:no-unused-expression */
-import * as request from 'supertest'
import 'mocha'
+import * as request from 'supertest'
import {
- ServerInfo,
- flushTests,
- runServer,
createUser,
- loginAndGetAccessToken,
- setAccessTokensToServers,
+ flushTests,
killallServers,
- makePostBodyRequest
+ loginAndGetAccessToken,
+ runServer,
+ ServerInfo,
+ setAccessTokensToServers
} from '../../utils'
describe('Test server follows API validators', function () {
// Order of the tests we want to execute
-import './multiple-servers'
+// import './multiple-servers'
import './video-transcoder'
import { ActivityPubSignature } from './activitypub-signature'
import { VideoAbuseObject } from './objects/video-abuse-object'
-export type Activity = ActivityCreate | ActivityAdd | ActivityUpdate | ActivityFlag |
+export type Activity = ActivityCreate | ActivityAdd | ActivityUpdate |
ActivityDelete | ActivityFollow | ActivityAccept | ActivityAnnounce
// Flag -> report abuse
-export type ActivityType = 'Create' | 'Add' | 'Update' | 'Flag' | 'Delete' | 'Follow' | 'Accept' | 'Announce'
+export type ActivityType = 'Create' | 'Add' | 'Update' | 'Delete' | 'Follow' | 'Accept' | 'Announce'
export interface BaseActivity {
'@context'?: any[]
object: VideoTorrentObject | VideoChannelObject
}
-export interface ActivityFlag extends BaseActivity {
- type: 'Flag'
- object: string
-}
-
export interface ActivityDelete extends BaseActivity {
type: 'Delete'
}