Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Fix Lemmy compatibility

Chocobozzz91680e89439f
diff --git a/client/src/app/+videos-publish-manage/+video-manage/video-manage.resolver.ts b/client/src/app/+videos-publish-manage/+video-manage/video-manage.resolver.ts
index 146efc7676..5e4a246284 100644
--- a/client/src/app/+videos-publish-manage/+video-manage/video-manage.resolver.ts
+++ b/client/src/app/+videos-publish-manage/+video-manage/video-manage.resolver.ts
@@ -12,7 +12,6 @@ import { PlayerSettingsService } from '@app/shared/shared-video/player-settings.
import {
LiveVideo,
PlayerVideoSettings,
- UserRight,
UserVideoQuota,
VideoCaption,
VideoChapter,
diff --git a/packages/models/src/activitypub/objects/playlist-object.ts b/packages/models/src/activitypub/objects/playlist-object.ts
index 34665f25ad..67fd53f9a4 100644
--- a/packages/models/src/activitypub/objects/playlist-object.ts
+++ b/packages/models/src/activitypub/objects/playlist-object.ts
@@ -21,6 +21,8 @@ export interface PlaylistObject {
videoChannelPosition: number
+ audience: string
+
orderedItems?: string[]
partOf?: string
diff --git a/packages/models/src/activitypub/objects/video-comment-object.ts b/packages/models/src/activitypub/objects/video-comment-object.ts
index 63260d2252..b210e1f1d5 100644
--- a/packages/models/src/activitypub/objects/video-comment-object.ts
+++ b/packages/models/src/activitypub/objects/video-comment-object.ts
@@ -16,6 +16,8 @@ export interface VideoCommentObject {
replyApproval: string | null
+ audience: string
+
to?: string[]
cc?: string[]
}
diff --git a/packages/models/src/activitypub/objects/video-object.ts b/packages/models/src/activitypub/objects/video-object.ts
index 3ba6b6078d..084615bd6a 100644
--- a/packages/models/src/activitypub/objects/video-object.ts
+++ b/packages/models/src/activitypub/objects/video-object.ts
@@ -65,13 +65,15 @@ export interface VideoObject {
hasParts: string | VideoChapterObject[]
playerSettings: string
- attributedTo: ActivityPubAttributedTo[]
+ attributedTo: ActivityPubAttributedTo[] | string
preview?: ActivityPubStoryboard[]
to?: string[]
cc?: string[]
+ audience: string
+
// For export
attachment?: {
type: 'Video'
diff --git a/packages/tests/src/api/activitypub/audience.ts b/packages/tests/src/api/activitypub/audience.ts
index efc0fd8140..cf7f53bfd6 100644
--- a/packages/tests/src/api/activitypub/audience.ts
+++ b/packages/tests/src/api/activitypub/audience.ts
@@ -39,6 +39,7 @@ describe('Test ActivityPub audience', function () {
expect(body.to).to.have.members([ publicUrl, servers[0].url + '/video-channels/root_channel' ])
expect(body.cc).to.have.members([ servers[0].url + '/accounts/root/followers' ])
+ expect(body.audience).to.equal(servers[0].url + '/video-channels/root_channel')
})
it('Should have a correct audience for a thread', async function () {
@@ -52,6 +53,7 @@ describe('Test ActivityPub audience', function () {
servers[0].url + '/accounts/user/followers',
servers[0].url + '/accounts/root'
])
+ expect(body.audience).to.equal(servers[0].url + '/video-channels/root_channel')
})
it('Should have the correct audience for a reply', async function () {
@@ -69,6 +71,7 @@ describe('Test ActivityPub audience', function () {
servers[0].url + '/accounts/root',
servers[1].url + '/accounts/root/followers'
])
+ expect(body.audience).to.equal(servers[0].url + '/video-channels/root_channel')
})
after(async function () {
diff --git a/packages/tests/src/api/videos/fep-1b12.ts b/packages/tests/src/api/videos/fep-1b12.ts
new file mode 100644
index 0000000000..47784660c2
--- /dev/null
+++ b/packages/tests/src/api/videos/fep-1b12.ts
@@ -0,0 +1,93 @@
+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
+
+import { VideoPlaylistPrivacy } from '@peertube/peertube-models'
+import {
+ cleanupTests,
+ createMultipleServers,
+ doubleFollow,
+ makeActivityPubGetRequest,
+ PeerTubeServer,
+ setAccessTokensToServers,
+ waitJobs
+} from '@peertube/peertube-server-commands'
+import { expect } from 'chai'
+
+describe('Test FEP-1b12', function () {
+ let servers: PeerTubeServer[] = []
+ let userToken: string
+ let videoId: string
+
+ before(async function () {
+ servers = await createMultipleServers(2, {}, { env: { FEP_1B12_ONLY: 'true' } })
+
+ await setAccessTokensToServers(servers)
+
+ userToken = await servers[0].users.generateUserAndToken('user')
+
+ await doubleFollow(servers[0], servers[1])
+ })
+
+ describe('With FEP-1b12 only enabled', function () {
+ it('Should federate videos', async function () {
+ const { uuid } = await servers[0].videos.quickUpload({ name: 'video' })
+ videoId = uuid
+
+ await waitJobs(servers)
+
+ {
+ const { body } = await makeActivityPubGetRequest(servers[0].url, '/w/' + uuid)
+ expect(body.attributedTo).to.be.a('string')
+ expect(body.audience).to.exist
+ }
+
+ for (const server of servers) {
+ const video = await server.videos.get({ id: uuid })
+
+ expect(video.channel.name).to.equal('root_channel')
+ }
+ })
+
+ it('Should update video channels', async function () {
+ await servers[0].videos.update({
+ id: videoId,
+ attributes: { channelId: await servers[0].channels.getDefaultId({ token: userToken }) }
+ })
+
+ await waitJobs(servers)
+
+ for (const server of servers) {
+ const video = await server.videos.get({ id: videoId })
+
+ expect(video.channel.name).to.equal('user_channel')
+ }
+ })
+
+ it('Should federate playlists', async function () {
+ const { uuid } = await servers[0].playlists.create({
+ attributes: {
+ displayName: 'playlist',
+ privacy: VideoPlaylistPrivacy.PUBLIC,
+ videoChannelId: await servers[0].channels.getDefaultId({ token: userToken })
+ }
+ })
+
+ await waitJobs(servers)
+
+ {
+ const { body } = await makeActivityPubGetRequest(servers[0].url, '/w/p/' + uuid)
+ expect(body.attributedTo).to.be.empty
+ expect(body.audience).to.exist
+ }
+
+ for (const server of servers) {
+ const playlist = await server.playlists.get({ playlistId: uuid })
+
+ expect(playlist.videoChannel.name).to.equal('user_channel')
+ }
+ })
+ })
+
+ after(async function () {
+ await cleanupTests(servers)
+ })
+})
diff --git a/packages/tests/src/api/videos/index.ts b/packages/tests/src/api/videos/index.ts
index bbb5157ec8..f178624d13 100644
--- a/packages/tests/src/api/videos/index.ts
+++ b/packages/tests/src/api/videos/index.ts
@@ -1,5 +1,6 @@
import './channel-activities.js'
import './channel-import-videos.js'
+import './fep-1b12.js'
import './generate-download.js'
import './multiple-servers.js'
import './player-settings.js'
diff --git a/server/core/controllers/activitypub/client.ts b/server/core/controllers/activitypub/client.ts
index 59a2ab1667..e9f5974cbe 100644
--- a/server/core/controllers/activitypub/client.ts
+++ b/server/core/controllers/activitypub/client.ts
@@ -535,7 +535,7 @@ async function videoPlaylistController (req: express.Request, res: express.Respo
playlist.OwnerAccount = await AccountModel.load(playlist.ownerAccountId)
const json = await playlist.toActivityPubObject(req.query.page, null)
- const audience = getPlaylistAudience(playlist.OwnerAccount.Actor, playlist.privacy)
+ const audience = getPlaylistAudience({ account: playlist.OwnerAccount, channel: playlist.VideoChannel, privacy: playlist.privacy })
const object = audiencify(json, audience)
return activityPubResponse(activityPubContextify(object, 'Playlist', getContextFilter()), res)
diff --git a/server/core/helpers/custom-validators/activitypub/misc.ts b/server/core/helpers/custom-validators/activitypub/misc.ts
index 3ffd3ce17e..6cc4d207e8 100644
--- a/server/core/helpers/custom-validators/activitypub/misc.ts
+++ b/server/core/helpers/custom-validators/activitypub/misc.ts
@@ -3,6 +3,7 @@ import { CONFIG } from '@server/initializers/config.js'
import validator from 'validator'
import { CONSTRAINTS_FIELDS } from '../../../initializers/constants.js'
import { exists } from '../misc.js'
+import { arrayify } from '@peertube/peertube-core-utils'
export function isUrlValid (url: string) {
const isURLOptions = {
@@ -53,12 +54,7 @@ export function isActivityPubHTMLUrlValid (url: ActivityHtmlUrlObject) {
}
export function setValidAttributedTo (obj: any) {
- if (Array.isArray(obj.attributedTo) === false) {
- obj.attributedTo = []
- return true
- }
-
- obj.attributedTo = obj.attributedTo.filter(a => {
+ obj.attributedTo = arrayify(obj.attributedTo).filter(a => {
return isActivityPubUrlValid(a) ||
((a.type === 'Group' || a.type === 'Person') && isActivityPubUrlValid(a.id))
})
diff --git a/server/core/helpers/custom-validators/activitypub/playlist.ts b/server/core/helpers/custom-validators/activitypub/playlist.ts
index 7d1fd79483..f51ae6e764 100644
--- a/server/core/helpers/custom-validators/activitypub/playlist.ts
+++ b/server/core/helpers/custom-validators/activitypub/playlist.ts
@@ -2,16 +2,19 @@ import { PlaylistElementObject, PlaylistObject } from '@peertube/peertube-models
import validator from 'validator'
import { exists, isDateValid, isUUIDValid } from '../misc.js'
import { isVideoPlaylistNameValid } from '../video-playlists.js'
-import { isActivityPubUrlValid } from './misc.js'
+import { isActivityPubUrlValid, setValidAttributedTo } from './misc.js'
export function isPlaylistObjectValid (object: PlaylistObject) {
if (object?.type !== 'Playlist') return false
+ setValidAttributedTo(object)
+
return validator.default.isInt(object.totalItems + '') &&
isVideoPlaylistNameValid(object.name) &&
isUUIDValid(object.uuid) &&
isDateValid(object.published) &&
- isDateValid(object.updated)
+ isDateValid(object.updated) &&
+ (!exists(object.audience) || isActivityPubUrlValid(object.audience))
}
export function isPlaylistElementObjectValid (object: PlaylistElementObject) {
diff --git a/server/core/helpers/custom-validators/activitypub/videos.ts b/server/core/helpers/custom-validators/activitypub/videos.ts
index df8461327f..296e946c5d 100644
--- a/server/core/helpers/custom-validators/activitypub/videos.ts
+++ b/server/core/helpers/custom-validators/activitypub/videos.ts
@@ -86,6 +86,8 @@ export function sanitizeAndCheckVideoTorrentObject (video: VideoObject) {
if (exists(video.uploadDate) && !isDateValid(video.uploadDate)) return fail('uploadDate')
if (exists(video.content) && !isRemoteVideoContentValid(video.mediaType, video.content)) return fail('mediaType/content')
+ if (exists(video.audience) && !isActivityPubUrlValid(video.audience)) return fail('audience')
+
if (video.attributedTo.length === 0) return fail('attributedTo')
return true
diff --git a/server/core/lib/activitypub/actors/get.ts b/server/core/lib/activitypub/actors/get.ts
index c38625cdf5..5811109f15 100644
--- a/server/core/lib/activitypub/actors/get.ts
+++ b/server/core/lib/activitypub/actors/get.ts
@@ -77,7 +77,7 @@ async function getOrCreateAPActor (
}
async function getOrCreateAPOwner (actorObject: ActivityPubActor, actorId: string) {
- const accountAttributedTo = await findOwner(actorId, actorObject.attributedTo, 'Person')
+ const accountAttributedTo = await findOwner({ rootUrl: actorId, attributedTo: actorObject.attributedTo, type: 'Person' })
if (!accountAttributedTo) {
throw new Error(`Cannot find account attributed to video channel ${actorId}`)
}
@@ -94,8 +94,19 @@ async function getOrCreateAPOwner (actorObject: ActivityPubActor, actorId: strin
}
}
-async function findOwner (rootUrl: string, attributedTo: APObjectId[] | APObjectId, type: 'Person' | 'Group') {
- for (const actorToCheck of arrayify(attributedTo)) {
+async function findOwner (options: {
+ rootUrl: string
+ attributedTo: APObjectId[] | APObjectId
+ audience?: string
+ type: 'Person' | 'Group'
+}) {
+ const { rootUrl, attributedTo, audience, type } = options
+
+ const actorsToCheck = arrayify(attributedTo)
+ // Priority to audience
+ if (audience) actorsToCheck.unshift(audience) // fep-1b12
+
+ for (const actorToCheck of actorsToCheck) {
const actorObject = await fetchAPObjectIfNeeded<ActivityPubActor>(getAPId(actorToCheck))
if (!actorObject) {
diff --git a/server/core/lib/activitypub/audience.ts b/server/core/lib/activitypub/audience.ts
index 567760469e..1a0dfe2249 100644
--- a/server/core/lib/activitypub/audience.ts
+++ b/server/core/lib/activitypub/audience.ts
@@ -1,4 +1,4 @@
-import { ActivityAudience, VideoPlaylistPrivacy, VideoPlaylistPrivacyType, VideoPrivacy, VideoPrivacyType } from '@peertube/peertube-models'
+import { ActivityAudience, VideoPlaylistPrivacyType, VideoPrivacy, VideoPrivacyType } from '@peertube/peertube-models'
import { getAPPublicValue } from '@server/helpers/activity-pub-utils.js'
import {
MAccountAudience,
@@ -72,11 +72,24 @@ export function getCommentAudience (options: {
return audience
}
-export function getPlaylistAudience (actorSender: MActorFollowersUrl, privacy: VideoPlaylistPrivacyType) {
- const followerUrls = [ actorSender.followersUrl ]
+export function getPlaylistAudience (options: {
+ account: MAccountAudience
+ channel: MChannelAudience
+ privacy: VideoPlaylistPrivacyType
+}) {
+ const { account, channel, privacy } = options
+ const followerUrls = [ account.Actor.followersUrl ]
+
+ if (privacy === VideoPrivacy.PUBLIC) {
+ return _buildPublicAudience({
+ to: [ channel.Actor.url ], // fep-1b12
+ cc: followerUrls
+ })
+ }
- if (privacy === VideoPlaylistPrivacy.PUBLIC) return _buildPublicAudience({ cc: followerUrls })
- else if (privacy === VideoPlaylistPrivacy.UNLISTED) return _buildUnlistedAudience()
+ if (privacy === VideoPrivacy.UNLISTED) {
+ return _buildUnlistedAudience()
+ }
throw new Error(`Cannot get audience of non public/unlisted playlist privacy type (${privacy})`)
}
diff --git a/server/core/lib/activitypub/playlists/create-update.ts b/server/core/lib/activitypub/playlists/create-update.ts
index 91acbc8591..0f72bf89b5 100644
--- a/server/core/lib/activitypub/playlists/create-update.ts
+++ b/server/core/lib/activitypub/playlists/create-update.ts
@@ -1,5 +1,5 @@
import { HttpStatusCode, PlaylistObject } from '@peertube/peertube-models'
-import { isArray } from '@server/helpers/custom-validators/misc.js'
+import { isActivityPubUrlValid } from '@server/helpers/custom-validators/activitypub/misc.js'
import { retryTransactionWrapper } from '@server/helpers/database-utils.js'
import { logger, loggerTagsFactory } from '@server/helpers/logger.js'
import { PeerTubeRequestError } from '@server/helpers/requests.js'
@@ -22,7 +22,6 @@ import {
playlistElementObjectToDBAttributes,
playlistObjectToDBAttributes
} from './shared/index.js'
-import { isActivityPubUrlValid } from '@server/helpers/custom-validators/activitypub/misc.js'
const lTags = loggerTagsFactory('ap', 'video-playlist')
@@ -96,19 +95,24 @@ export async function createOrUpdateVideoPlaylist (options: {
// ---------------------------------------------------------------------------
async function getRemotePlaylistChannel (playlistObject: PlaylistObject) {
- if (!isArray(playlistObject.attributedTo) || playlistObject.attributedTo.length !== 1) {
- throw new Error('Not attributed to for playlist object ' + getAPId(playlistObject))
+ let channelUrl: string
+
+ if (isActivityPubUrlValid(playlistObject.audience)) { // fep-1b12
+ channelUrl = getAPId(playlistObject.audience)
+ } else if (playlistObject.attributedTo.length !== 0) {
+ channelUrl = getAPId(playlistObject.attributedTo[0])
+ } else {
+ throw new Error('Missing "audience" or "attributedTo" attribute for playlist object ' + getAPId(playlistObject))
}
- const channelUrl = getAPId(playlistObject.attributedTo[0])
if (!checkUrlsSameHost(channelUrl, playlistObject.id)) {
- throw new Error(`Playlist ${playlistObject.id} and "attributedTo" channel ${channelUrl} are not on the same host`)
+ throw new Error(`Playlist ${getAPId(playlistObject)} and "audience" or "attributedTo" channel ${channelUrl} are not on the same host`)
}
const actor = await getOrCreateAPActor(channelUrl, 'all')
if (!actor.VideoChannel) {
- throw new Error(`Playlist ${playlistObject.id} "attributedTo" is not a video channel.`)
+ throw new Error(`Playlist ${getAPId(playlistObject)} "audience" or "attributedTo" is not a video channel`)
}
return actor.VideoChannel
diff --git a/server/core/lib/activitypub/send/send-create.ts b/server/core/lib/activitypub/send/send-create.ts
index f77798d30e..e29f12a372 100644
--- a/server/core/lib/activitypub/send/send-create.ts
+++ b/server/core/lib/activitypub/send/send-create.ts
@@ -87,10 +87,11 @@ export async function sendCreateVideoPlaylist (playlist: MVideoPlaylistFull, tra
logger.info('Creating job to send create video playlist of %s.', playlist.url, lTags(playlist.uuid))
- const byActor = playlist.OwnerAccount.Actor
- const audience = getPlaylistAudience(byActor, playlist.privacy)
+ const audience = getPlaylistAudience({ account: playlist.OwnerAccount, channel: playlist.VideoChannel, privacy: playlist.privacy })
const object = await playlist.toActivityPubObject(null, transaction)
+
+ const byActor = playlist.OwnerAccount.Actor
const createActivity = buildCreateActivity(playlist.url, byActor, object, audience)
const serverActor = await getServerActor()
diff --git a/server/core/lib/activitypub/send/send-update.ts b/server/core/lib/activitypub/send/send-update.ts
index b4f1b76bdf..738cec8bcd 100644
--- a/server/core/lib/activitypub/send/send-update.ts
+++ b/server/core/lib/activitypub/send/send-update.ts
@@ -100,7 +100,11 @@ export async function sendUpdateVideoPlaylist (videoPlaylist: MVideoPlaylistFull
const url = getUpdateActivityPubUrl(videoPlaylist.url, videoPlaylist.updatedAt.toISOString())
const object = await videoPlaylist.toActivityPubObject(null, transaction)
- const audience = getPlaylistAudience(byActor, videoPlaylist.privacy)
+ const audience = getPlaylistAudience({
+ account: videoPlaylist.OwnerAccount,
+ channel: videoPlaylist.VideoChannel,
+ privacy: videoPlaylist.privacy
+ })
const updateActivity = buildUpdateActivity(url, byActor, object, audience)
diff --git a/server/core/lib/activitypub/video-comments.ts b/server/core/lib/activitypub/video-comments.ts
index 7360afbc23..f23fc860ef 100644
--- a/server/core/lib/activitypub/video-comments.ts
+++ b/server/core/lib/activitypub/video-comments.ts
@@ -79,7 +79,7 @@ export async function resolveThread (params: ResolveThreadParams): ResolveThread
async function resolveCommentFromDB (params: ResolveThreadParams) {
const { url, comments, commentCreated } = params
- const commentFromDatabase = await VideoCommentModel.loadByUrlAndPopulateReplyAndVideoImmutableAndAccount(url)
+ const commentFromDatabase = await VideoCommentModel.loadByUrlAndPopulateAccountAndVideoAndReply(url)
if (!commentFromDatabase) return undefined
let parentComments = comments.concat([ commentFromDatabase ])
diff --git a/server/core/lib/activitypub/videos/shared/abstract-builder.ts b/server/core/lib/activitypub/videos/shared/abstract-builder.ts
index bcffe470db..8b4ae9a941 100644
--- a/server/core/lib/activitypub/videos/shared/abstract-builder.ts
+++ b/server/core/lib/activitypub/videos/shared/abstract-builder.ts
@@ -43,7 +43,13 @@ export abstract class APVideoAbstractBuilder {
protected abstract lTags: LoggerTagsFn
protected async getOrCreateVideoChannelFromVideoObject () {
- const channel = await findOwner(this.videoObject.id, this.videoObject.attributedTo, 'Group')
+ const channel = await findOwner({
+ rootUrl: this.videoObject.id,
+ attributedTo: this.videoObject.attributedTo,
+ audience: this.videoObject.audience,
+ type: 'Group'
+ })
+
if (!channel) throw new Error('Cannot find associated video channel to video ' + this.videoObject.id)
return getOrCreateAPActor(channel.id, 'all')
diff --git a/server/core/lib/user-import-export/exporters/comments-exporter.ts b/server/core/lib/user-import-export/exporters/comments-exporter.ts
index 975384b48b..37280bebfc 100644
--- a/server/core/lib/user-import-export/exporters/comments-exporter.ts
+++ b/server/core/lib/user-import-export/exporters/comments-exporter.ts
@@ -33,7 +33,7 @@ export class CommentsExporter extends AbstractUserExporter<CommentsExportJSON> {
private formatCommentsAP (comments: MCommentExport[]) {
return Bluebird.mapSeries(comments, async ({ url }) => {
- const comment = await VideoCommentModel.loadByUrlAndPopulateReplyAndVideoImmutableAndAccount(url)
+ const comment = await VideoCommentModel.loadByUrlAndPopulateAccountAndVideoAndReply(url)
const threadParentComments = await VideoCommentModel.listThreadParentComments({ comment })
let commentObject = comment.toActivityPubObject(threadParentComments) as VideoCommentObject
diff --git a/server/core/models/video/formatter/video-activity-pub-format.ts b/server/core/models/video/formatter/video-activity-pub-format.ts
index e99874a21c..d35b44c7e4 100644
--- a/server/core/models/video/formatter/video-activity-pub-format.ts
+++ b/server/core/models/video/formatter/video-activity-pub-format.ts
@@ -125,10 +125,20 @@ export function videoModelToActivityPubObject (video: MVideoAP): VideoObject {
hasParts: getLocalVideoChaptersActivityPubUrl(video),
playerSettings: getLocalVideoPlayerSettingsActivityPubUrl(video),
- attributedTo: [
- video.VideoChannel.Account.Actor.url,
- video.VideoChannel.Actor.url
- ],
+ attributedTo: process.env.FEP_1B12_ONLY !== 'true'
+ ? [
+ {
+ type: 'Person',
+ id: video.VideoChannel.Account.Actor.url
+ },
+ {
+ type: 'Group',
+ id: video.VideoChannel.Actor.url
+ }
+ ]
+ : video.VideoChannel.Account.Actor.url,
+
+ audience: video.VideoChannel.Actor.url,
...buildLiveAPAttributes(video)
}
diff --git a/server/core/models/video/video-comment.ts b/server/core/models/video/video-comment.ts
index dfaad7976d..80f09d50d3 100644
--- a/server/core/models/video/video-comment.ts
+++ b/server/core/models/video/video-comment.ts
@@ -41,7 +41,6 @@ import {
MCommentFormattable,
MCommentId,
MCommentOwner,
- MCommentOwnerReplyVideoImmutable,
MCommentOwnerVideoFeed,
MCommentOwnerVideoReply,
MVideo,
@@ -318,26 +317,6 @@ export class VideoCommentModel extends SequelizeModel<VideoCommentModel> {
return VideoCommentModel.scope([ ScopeNames.WITH_ACCOUNT, ScopeNames.WITH_VIDEO, ScopeNames.WITH_IN_REPLY_TO ]).findOne(query)
}
- static loadByUrlAndPopulateReplyAndVideoImmutableAndAccount (
- url: string,
- transaction?: Transaction
- ): Promise<MCommentOwnerReplyVideoImmutable> {
- const query = {
- where: {
- url
- },
- include: [
- {
- attributes: [ 'id', 'uuid', 'url', 'remote' ],
- model: VideoModel.unscoped()
- }
- ],
- transaction
- }
-
- return VideoCommentModel.scope([ ScopeNames.WITH_IN_REPLY_TO, ScopeNames.WITH_ACCOUNT ]).findOne(query)
- }
-
// ---------------------------------------------------------------------------
static listForApi (parameters: {
@@ -816,6 +795,7 @@ export class VideoCommentModel extends SequelizeModel<VideoCommentModel> {
mediaType: 'text/markdown',
inReplyTo,
+ audience: this.Video.VideoChannel.Actor.url,
updated: this.updatedAt.toISOString(),
published: this.createdAt.toISOString(),
url: this.url,
diff --git a/server/core/models/video/video-playlist.ts b/server/core/models/video/video-playlist.ts
index 7c32a7d645..f72791a87b 100644
--- a/server/core/models/video/video-playlist.ts
+++ b/server/core/models/video/video-playlist.ts
@@ -690,6 +690,9 @@ export class VideoPlaylistModel extends SequelizeModel<VideoPlaylistModel> {
.then(o => {
return Object.assign(o, {
type: 'Playlist' as 'Playlist',
+
+ audience: this.VideoChannel?.Actor.url,
+
name: this.name,
content: this.description,
mediaType: 'text/markdown' as 'text/markdown',
@@ -697,7 +700,9 @@ export class VideoPlaylistModel extends SequelizeModel<VideoPlaylistModel> {
videoChannelPosition: this.videoChannelPosition,
published: this.createdAt.toISOString(),
updated: this.updatedAt.toISOString(),
- attributedTo: this.VideoChannel ? [ this.VideoChannel.Actor.url ] : [],
+ attributedTo: process.env.FEP_1B12_ONLY !== 'true' && this.VideoChannel
+ ? [ this.VideoChannel.Actor.url ]
+ : [],
icon
})
})
diff --git a/server/core/types/models/video/video-comment.ts b/server/core/types/models/video/video-comment.ts
index f430513a48..c4d3323bab 100644
--- a/server/core/types/models/video/video-comment.ts
+++ b/server/core/types/models/video/video-comment.ts
@@ -4,7 +4,7 @@ import { VideoCommentModel } from '../../../models/video/video-comment.js'
import { MAccountDefault, MAccountFormattable, MAccountUrl } from '../account/index.js'
import { MCommentAutomaticTagWithTag } from '../automatic-tag/comment-automatic-tag.js'
import { MChannelSummary } from './video-channel.js'
-import { MVideo, MVideoAccountIdUrl, MVideoAccountLight, MVideoFeed, MVideoIdUrl, MVideoImmutable, MVideoUUID } from './video.js'
+import { MVideo, MVideoAccountIdUrl, MVideoAccountLight, MVideoFeed, MVideoIdUrl, MVideoUUID } from './video.js'
type Use<K extends keyof VideoCommentModel, M> = PickWith<VideoCommentModel, K, M>
@@ -51,12 +51,6 @@ export type MCommentOwnerVideoReply =
& Use<'Video', MVideoAccountIdUrl>
& Use<'InReplyToVideoComment', MComment>
-export type MCommentOwnerReplyVideoImmutable =
- & MComment
- & Use<'Account', MAccountDefault>
- & Use<'InReplyToVideoComment', MComment>
- & Use<'Video', MVideoImmutable>
-
export type MCommentOwnerVideoFeed =
& MCommentOwner
& Use<'Video', MVideoFeed>
@@ -82,5 +76,5 @@ export type MCommentAdminOrUserFormattable =
export type MCommentAP =
& MComment
& Use<'Account', MAccountUrl>
- & PickWithOpt<VideoCommentModel, 'Video', MVideoImmutable>
+ & PickWithOpt<VideoCommentModel, 'Video', MVideoAccountIdUrl>
& PickWithOpt<VideoCommentModel, 'InReplyToVideoComment', MCommentUrl>