mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-04 10:19:35 +02:00
Begin moving video channel to actor
This commit is contained in:
parent
fadf619ad6
commit
50d6de9c28
100 changed files with 1761 additions and 2041 deletions
|
@ -1,8 +1,7 @@
|
|||
import { Activity, ActivityType } from '../../../../shared/models/activitypub'
|
||||
import { logger } from '../../../helpers'
|
||||
import { AccountModel } from '../../../models/account/account'
|
||||
import { ActorModel } from '../../../models/activitypub/actor'
|
||||
import { processAcceptActivity } from './process-accept'
|
||||
import { processAddActivity } from './process-add'
|
||||
import { processAnnounceActivity } from './process-announce'
|
||||
import { processCreateActivity } from './process-create'
|
||||
import { processDeleteActivity } from './process-delete'
|
||||
|
@ -11,9 +10,8 @@ import { processLikeActivity } from './process-like'
|
|||
import { processUndoActivity } from './process-undo'
|
||||
import { processUpdateActivity } from './process-update'
|
||||
|
||||
const processActivity: { [ P in ActivityType ]: (activity: Activity, inboxAccount?: AccountModel) => Promise<any> } = {
|
||||
const processActivity: { [ P in ActivityType ]: (activity: Activity, inboxActor?: ActorModel) => Promise<any> } = {
|
||||
Create: processCreateActivity,
|
||||
Add: processAddActivity,
|
||||
Update: processUpdateActivity,
|
||||
Delete: processDeleteActivity,
|
||||
Follow: processFollowActivity,
|
||||
|
@ -23,11 +21,11 @@ const processActivity: { [ P in ActivityType ]: (activity: Activity, inboxAccoun
|
|||
Like: processLikeActivity
|
||||
}
|
||||
|
||||
async function processActivities (activities: Activity[], signatureAccount?: AccountModel, inboxAccount?: AccountModel) {
|
||||
async function processActivities (activities: Activity[], signatureActor?: ActorModel, inboxActor?: ActorModel) {
|
||||
for (const activity of activities) {
|
||||
// When we fetch remote data, we don't have signature
|
||||
if (signatureAccount && activity.actor !== signatureAccount.url) {
|
||||
logger.warn('Signature mismatch between %s and %s.', activity.actor, signatureAccount.url)
|
||||
if (signatureActor && activity.actor !== signatureActor.url) {
|
||||
logger.warn('Signature mismatch between %s and %s.', activity.actor, signatureActor.url)
|
||||
continue
|
||||
}
|
||||
|
||||
|
@ -38,7 +36,7 @@ async function processActivities (activities: Activity[], signatureAccount?: Acc
|
|||
}
|
||||
|
||||
try {
|
||||
await activityProcessor(activity, inboxAccount)
|
||||
await activityProcessor(activity, inboxActor)
|
||||
} catch (err) {
|
||||
logger.warn('Cannot process activity %s.', activity.type, err)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue