aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib')
-rw-r--r--server/lib/activitypub/index.ts1
-rw-r--r--server/lib/activitypub/process-add.ts4
-rw-r--r--server/lib/activitypub/process-announce.ts10
-rw-r--r--server/lib/activitypub/process-create.ts2
-rw-r--r--server/lib/activitypub/process-delete.ts2
-rw-r--r--server/lib/activitypub/process-flag.ts17
-rw-r--r--server/lib/activitypub/process-update.ts2
-rw-r--r--server/lib/activitypub/send-request.ts2
-rw-r--r--server/lib/jobs/job-scheduler.ts1
-rw-r--r--server/lib/video-channel.ts8
10 files changed, 13 insertions, 36 deletions
diff --git a/server/lib/activitypub/index.ts b/server/lib/activitypub/index.ts
index dca446fd4..e08108aac 100644
--- a/server/lib/activitypub/index.ts
+++ b/server/lib/activitypub/index.ts
@@ -3,7 +3,6 @@ export * from './process-add'
3export * from './process-announce' 3export * from './process-announce'
4export * from './process-create' 4export * from './process-create'
5export * from './process-delete' 5export * from './process-delete'
6export * from './process-flag'
7export * from './process-follow' 6export * from './process-follow'
8export * from './process-update' 7export * from './process-update'
9export * from './send-request' 8export * from './send-request'
diff --git a/server/lib/activitypub/process-add.ts b/server/lib/activitypub/process-add.ts
index c83d9e98e..e1769bee8 100644
--- a/server/lib/activitypub/process-add.ts
+++ b/server/lib/activitypub/process-add.ts
@@ -17,7 +17,7 @@ async function processAddActivity (activity: ActivityAdd) {
17 const videoChannelUrl = activity.target 17 const videoChannelUrl = activity.target
18 const videoChannel = await getOrCreateVideoChannel(account, videoChannelUrl) 18 const videoChannel = await getOrCreateVideoChannel(account, videoChannelUrl)
19 19
20 return processAddVideo(account, activity, videoChannel, activityObject as VideoTorrentObject) 20 return processAddVideo(account, activity, videoChannel, activityObject)
21 } 21 }
22 22
23 logger.warn('Unknown activity object type %s when creating activity.', activityType, { activity: activity.id }) 23 logger.warn('Unknown activity object type %s when creating activity.', activityType, { activity: activity.id })
@@ -68,7 +68,7 @@ function addRemoteVideo (
68 68
69 const videoCreated = await video.save(sequelizeOptions) 69 const videoCreated = await video.save(sequelizeOptions)
70 70
71 const videoFileAttributes = await videoFileActivityUrlToDBAttributes(videoCreated, videoToCreateData) 71 const videoFileAttributes = videoFileActivityUrlToDBAttributes(videoCreated, videoToCreateData)
72 if (videoFileAttributes.length === 0) { 72 if (videoFileAttributes.length === 0) {
73 throw new Error('Cannot find valid files for video %s ' + videoToCreateData.url) 73 throw new Error('Cannot find valid files for video %s ' + videoToCreateData.url)
74 } 74 }
diff --git a/server/lib/activitypub/process-announce.ts b/server/lib/activitypub/process-announce.ts
index f9674e095..eb38aecca 100644
--- a/server/lib/activitypub/process-announce.ts
+++ b/server/lib/activitypub/process-announce.ts
@@ -1,13 +1,11 @@
1import { ActivityAnnounce } from '../../../shared/models/activitypub/activity' 1import { ActivityAnnounce } from '../../../shared/models/activitypub/activity'
2import { VideoChannelObject } from '../../../shared/models/activitypub/objects/video-channel-object' 2import { getOrCreateAccount } from '../../helpers/activitypub'
3import { VideoTorrentObject } from '../../../shared/models/activitypub/objects/video-torrent-object'
4import { logger } from '../../helpers/logger' 3import { logger } from '../../helpers/logger'
5import { processAddActivity } from './process-add'
6import { processCreateActivity } from './process-create'
7import { database as db } from '../../initializers/index' 4import { database as db } from '../../initializers/index'
8import { getOrCreateAccount } from '../../helpers/activitypub'
9import { VideoChannelInstance } from '../../models/video/video-channel-interface'
10import { VideoInstance } from '../../models/index' 5import { VideoInstance } from '../../models/index'
6import { VideoChannelInstance } from '../../models/video/video-channel-interface'
7import { processAddActivity } from './process-add'
8import { processCreateActivity } from './process-create'
11 9
12async function processAnnounceActivity (activity: ActivityAnnounce) { 10async function processAnnounceActivity (activity: ActivityAnnounce) {
13 const announcedActivity = activity.object 11 const announcedActivity = activity.object
diff --git a/server/lib/activitypub/process-create.ts b/server/lib/activitypub/process-create.ts
index faea3f48a..de8e09adf 100644
--- a/server/lib/activitypub/process-create.ts
+++ b/server/lib/activitypub/process-create.ts
@@ -72,7 +72,7 @@ function addRemoteVideoAbuse (account: AccountInstance, videoAbuseToCreateData:
72 const video = await db.Video.loadByUrlAndPopulateAccount(videoAbuseToCreateData.object, t) 72 const video = await db.Video.loadByUrlAndPopulateAccount(videoAbuseToCreateData.object, t)
73 if (!video) { 73 if (!video) {
74 logger.warn('Unknown video %s for remote video abuse.', videoAbuseToCreateData.object) 74 logger.warn('Unknown video %s for remote video abuse.', videoAbuseToCreateData.object)
75 return 75 return undefined
76 } 76 }
77 77
78 const videoAbuseData = { 78 const videoAbuseData = {
diff --git a/server/lib/activitypub/process-delete.ts b/server/lib/activitypub/process-delete.ts
index d4487d2cc..0d5756e9c 100644
--- a/server/lib/activitypub/process-delete.ts
+++ b/server/lib/activitypub/process-delete.ts
@@ -28,7 +28,7 @@ async function processDeleteActivity (activity: ActivityDelete) {
28 } 28 }
29 } 29 }
30 30
31 return undefined 31 return
32} 32}
33 33
34// --------------------------------------------------------------------------- 34// ---------------------------------------------------------------------------
diff --git a/server/lib/activitypub/process-flag.ts b/server/lib/activitypub/process-flag.ts
deleted file mode 100644
index b562dce4d..000000000
--- a/server/lib/activitypub/process-flag.ts
+++ /dev/null
@@ -1,17 +0,0 @@
1import {
2 ActivityCreate,
3 VideoTorrentObject,
4 VideoChannelObject
5} from '../../../shared'
6
7function processFlagActivity (activity: ActivityCreate) {
8 return Promise.resolve(undefined)
9}
10
11// ---------------------------------------------------------------------------
12
13export {
14 processFlagActivity
15}
16
17// ---------------------------------------------------------------------------
diff --git a/server/lib/activitypub/process-update.ts b/server/lib/activitypub/process-update.ts
index b732fce33..a9aa5eeb4 100644
--- a/server/lib/activitypub/process-update.ts
+++ b/server/lib/activitypub/process-update.ts
@@ -80,7 +80,7 @@ async function updateRemoteVideo (account: AccountInstance, videoAttributesToUpd
80 } 80 }
81 await Promise.all(videoFileDestroyTasks) 81 await Promise.all(videoFileDestroyTasks)
82 82
83 const videoFileAttributes = await videoFileActivityUrlToDBAttributes(videoInstance, videoAttributesToUpdate) 83 const videoFileAttributes = videoFileActivityUrlToDBAttributes(videoInstance, videoAttributesToUpdate)
84 const tasks: Bluebird<any>[] = videoFileAttributes.map(f => db.VideoFile.create(f)) 84 const tasks: Bluebird<any>[] = videoFileAttributes.map(f => db.VideoFile.create(f))
85 await Promise.all(tasks) 85 await Promise.all(tasks)
86 86
diff --git a/server/lib/activitypub/send-request.ts b/server/lib/activitypub/send-request.ts
index 68a631a36..261ff04ab 100644
--- a/server/lib/activitypub/send-request.ts
+++ b/server/lib/activitypub/send-request.ts
@@ -147,7 +147,7 @@ async function broadcastToFollowers (data: any, byAccount: AccountInstance, toAc
147 const result = await db.AccountFollow.listAcceptedFollowerSharedInboxUrls(toAccountFollowerIds) 147 const result = await db.AccountFollow.listAcceptedFollowerSharedInboxUrls(toAccountFollowerIds)
148 if (result.data.length === 0) { 148 if (result.data.length === 0) {
149 logger.info('Not broadcast because of 0 followers for %s.', toAccountFollowerIds.join(', ')) 149 logger.info('Not broadcast because of 0 followers for %s.', toAccountFollowerIds.join(', '))
150 return 150 return undefined
151 } 151 }
152 152
153 const jobPayload = { 153 const jobPayload = {
diff --git a/server/lib/jobs/job-scheduler.ts b/server/lib/jobs/job-scheduler.ts
index 73c440279..62ce6927e 100644
--- a/server/lib/jobs/job-scheduler.ts
+++ b/server/lib/jobs/job-scheduler.ts
@@ -4,7 +4,6 @@ import { JobCategory } from '../../../shared'
4import { logger } from '../../helpers' 4import { logger } from '../../helpers'
5import { database as db, JOB_STATES, JOBS_FETCH_LIMIT_PER_CYCLE, JOBS_FETCHING_INTERVAL } from '../../initializers' 5import { database as db, JOB_STATES, JOBS_FETCH_LIMIT_PER_CYCLE, JOBS_FETCHING_INTERVAL } from '../../initializers'
6import { JobInstance } from '../../models' 6import { JobInstance } from '../../models'
7import { error } from 'util'
8 7
9export interface JobHandler<P, T> { 8export interface JobHandler<P, T> {
10 process (data: object, jobId: number): Promise<T> 9 process (data: object, jobId: number): Promise<T>
diff --git a/server/lib/video-channel.ts b/server/lib/video-channel.ts
index 6f9ae2d95..5bb1814ea 100644
--- a/server/lib/video-channel.ts
+++ b/server/lib/video-channel.ts
@@ -1,11 +1,9 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2 2import { VideoChannelCreate } from '../../shared/models'
3import { database as db } from '../initializers'
4import { logger } from '../helpers' 3import { logger } from '../helpers'
4import { getActivityPubUrl } from '../helpers/activitypub'
5import { database as db } from '../initializers'
5import { AccountInstance } from '../models' 6import { AccountInstance } from '../models'
6import { VideoChannelCreate } from '../../shared/models'
7import { sendCreateVideoChannel } from './activitypub/send-request'
8import { getActivityPubUrl, shareVideoChannelByServer } from '../helpers/activitypub'
9 7
10async function createVideoChannel (videoChannelInfo: VideoChannelCreate, account: AccountInstance, t: Sequelize.Transaction) { 8async function createVideoChannel (videoChannelInfo: VideoChannelCreate, account: AccountInstance, t: Sequelize.Transaction) {
11 const videoChannelData = { 9 const videoChannelData = {