aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-03-16 10:36:33 +0100
committerChocobozzz <me@florianbigard.com>2023-03-16 10:36:33 +0100
commitc3441b0320f632e22318261bcd614d10187de22d (patch)
treee5273fa7d232d52169f59d17a8aa5f6a908c8ed1 /server/lib
parent30f939c4b785e8cf2ad829a86f4b2f5892c2fda8 (diff)
downloadPeerTube-c3441b0320f632e22318261bcd614d10187de22d.tar.gz
PeerTube-c3441b0320f632e22318261bcd614d10187de22d.tar.zst
PeerTube-c3441b0320f632e22318261bcd614d10187de22d.zip
Add video AP hooks
Diffstat (limited to 'server/lib')
-rw-r--r--server/lib/activitypub/videos/shared/creator.ts3
-rw-r--r--server/lib/activitypub/videos/updater.ts3
2 files changed, 6 insertions, 0 deletions
diff --git a/server/lib/activitypub/videos/shared/creator.ts b/server/lib/activitypub/videos/shared/creator.ts
index 07252fea2..77321d8a5 100644
--- a/server/lib/activitypub/videos/shared/creator.ts
+++ b/server/lib/activitypub/videos/shared/creator.ts
@@ -1,6 +1,7 @@
1 1
2import { logger, loggerTagsFactory, LoggerTagsFn } from '@server/helpers/logger' 2import { logger, loggerTagsFactory, LoggerTagsFn } from '@server/helpers/logger'
3import { sequelizeTypescript } from '@server/initializers/database' 3import { sequelizeTypescript } from '@server/initializers/database'
4import { Hooks } from '@server/lib/plugins/hooks'
4import { autoBlacklistVideoIfNeeded } from '@server/lib/video-blacklist' 5import { autoBlacklistVideoIfNeeded } from '@server/lib/video-blacklist'
5import { VideoModel } from '@server/models/video/video' 6import { VideoModel } from '@server/models/video/video'
6import { MThumbnail, MVideoFullLight, MVideoThumbnail } from '@server/types/models' 7import { MThumbnail, MVideoFullLight, MVideoThumbnail } from '@server/types/models'
@@ -61,6 +62,8 @@ export class APVideoCreator extends APVideoAbstractBuilder {
61 62
62 logger.info('Remote video with uuid %s inserted.', this.videoObject.uuid, this.lTags()) 63 logger.info('Remote video with uuid %s inserted.', this.videoObject.uuid, this.lTags())
63 64
65 Hooks.runAction('action:activity-pub.remote-video.created', { video: videoCreated, videoAPObject: this.videoObject })
66
64 return { autoBlacklisted, videoCreated } 67 return { autoBlacklisted, videoCreated }
65 } catch (err) { 68 } catch (err) {
66 // FIXME: Use rollback hook when https://github.com/sequelize/sequelize/pull/13038 is released 69 // FIXME: Use rollback hook when https://github.com/sequelize/sequelize/pull/13038 is released
diff --git a/server/lib/activitypub/videos/updater.ts b/server/lib/activitypub/videos/updater.ts
index 0bf32f440..3677dc3bb 100644
--- a/server/lib/activitypub/videos/updater.ts
+++ b/server/lib/activitypub/videos/updater.ts
@@ -3,6 +3,7 @@ import { resetSequelizeInstance, runInReadCommittedTransaction } from '@server/h
3import { logger, loggerTagsFactory, LoggerTagsFn } from '@server/helpers/logger' 3import { logger, loggerTagsFactory, LoggerTagsFn } from '@server/helpers/logger'
4import { Notifier } from '@server/lib/notifier' 4import { Notifier } from '@server/lib/notifier'
5import { PeerTubeSocket } from '@server/lib/peertube-socket' 5import { PeerTubeSocket } from '@server/lib/peertube-socket'
6import { Hooks } from '@server/lib/plugins/hooks'
6import { autoBlacklistVideoIfNeeded } from '@server/lib/video-blacklist' 7import { autoBlacklistVideoIfNeeded } from '@server/lib/video-blacklist'
7import { VideoLiveModel } from '@server/models/video/video-live' 8import { VideoLiveModel } from '@server/models/video/video-live'
8import { MActor, MChannelAccountLight, MChannelId, MVideoAccountLightBlacklistAllFiles, MVideoFullLight } from '@server/types/models' 9import { MActor, MChannelAccountLight, MChannelId, MVideoAccountLightBlacklistAllFiles, MVideoFullLight } from '@server/types/models'
@@ -81,6 +82,8 @@ export class APVideoUpdater extends APVideoAbstractBuilder {
81 PeerTubeSocket.Instance.sendVideoLiveNewState(videoUpdated) 82 PeerTubeSocket.Instance.sendVideoLiveNewState(videoUpdated)
82 } 83 }
83 84
85 Hooks.runAction('action:activity-pub.remote-video.updated', { video: videoUpdated, videoAPObject: this.videoObject })
86
84 logger.info('Remote video with uuid %s updated', this.videoObject.uuid, this.lTags()) 87 logger.info('Remote video with uuid %s updated', this.videoObject.uuid, this.lTags())
85 88
86 return videoUpdated 89 return videoUpdated