diff options
author | Chocobozzz <me@florianbigard.com> | 2023-03-16 10:36:33 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-03-16 10:36:33 +0100 |
commit | c3441b0320f632e22318261bcd614d10187de22d (patch) | |
tree | e5273fa7d232d52169f59d17a8aa5f6a908c8ed1 /server/lib/activitypub | |
parent | 30f939c4b785e8cf2ad829a86f4b2f5892c2fda8 (diff) | |
download | PeerTube-c3441b0320f632e22318261bcd614d10187de22d.tar.gz PeerTube-c3441b0320f632e22318261bcd614d10187de22d.tar.zst PeerTube-c3441b0320f632e22318261bcd614d10187de22d.zip |
Add video AP hooks
Diffstat (limited to 'server/lib/activitypub')
-rw-r--r-- | server/lib/activitypub/videos/shared/creator.ts | 3 | ||||
-rw-r--r-- | server/lib/activitypub/videos/updater.ts | 3 |
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 | ||
2 | import { logger, loggerTagsFactory, LoggerTagsFn } from '@server/helpers/logger' | 2 | import { logger, loggerTagsFactory, LoggerTagsFn } from '@server/helpers/logger' |
3 | import { sequelizeTypescript } from '@server/initializers/database' | 3 | import { sequelizeTypescript } from '@server/initializers/database' |
4 | import { Hooks } from '@server/lib/plugins/hooks' | ||
4 | import { autoBlacklistVideoIfNeeded } from '@server/lib/video-blacklist' | 5 | import { autoBlacklistVideoIfNeeded } from '@server/lib/video-blacklist' |
5 | import { VideoModel } from '@server/models/video/video' | 6 | import { VideoModel } from '@server/models/video/video' |
6 | import { MThumbnail, MVideoFullLight, MVideoThumbnail } from '@server/types/models' | 7 | import { 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 | |||
3 | import { logger, loggerTagsFactory, LoggerTagsFn } from '@server/helpers/logger' | 3 | import { logger, loggerTagsFactory, LoggerTagsFn } from '@server/helpers/logger' |
4 | import { Notifier } from '@server/lib/notifier' | 4 | import { Notifier } from '@server/lib/notifier' |
5 | import { PeerTubeSocket } from '@server/lib/peertube-socket' | 5 | import { PeerTubeSocket } from '@server/lib/peertube-socket' |
6 | import { Hooks } from '@server/lib/plugins/hooks' | ||
6 | import { autoBlacklistVideoIfNeeded } from '@server/lib/video-blacklist' | 7 | import { autoBlacklistVideoIfNeeded } from '@server/lib/video-blacklist' |
7 | import { VideoLiveModel } from '@server/models/video/video-live' | 8 | import { VideoLiveModel } from '@server/models/video/video-live' |
8 | import { MActor, MChannelAccountLight, MChannelId, MVideoAccountLightBlacklistAllFiles, MVideoFullLight } from '@server/types/models' | 9 | import { 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 |