1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 10:49:28 +02:00

Put ap:public in cc for unlisted data

This commit is contained in:
Chocobozzz 2025-06-16 11:00:47 +02:00
parent 24b59a2560
commit 0c7a89a70a
No known key found for this signature in database
GPG key ID: 583A612D890159BE
15 changed files with 90 additions and 69 deletions

View file

@ -1,13 +1,12 @@
import { AbstractUserExporter } from './abstract-user-exporter.js'
import { MCommentExport } from '@server/types/models/index.js'
import { CommentsExportJSON, VideoCommentObject } from '@peertube/peertube-models'
import { VideoCommentModel } from '@server/models/video/video-comment.js'
import Bluebird from 'bluebird'
import { audiencify, getAudience } from '@server/lib/activitypub/audience.js'
import { audiencify, getPublicAudience } from '@server/lib/activitypub/audience.js'
import { buildCreateActivity } from '@server/lib/activitypub/send/send-create.js'
import { VideoCommentModel } from '@server/models/video/video-comment.js'
import { MCommentExport } from '@server/types/models/index.js'
import Bluebird from 'bluebird'
import { AbstractUserExporter } from './abstract-user-exporter.js'
export class CommentsExporter extends AbstractUserExporter <CommentsExportJSON> {
export class CommentsExporter extends AbstractUserExporter<CommentsExportJSON> {
async export () {
const comments = await VideoCommentModel.listForExport(this.user.Account.id)
@ -39,8 +38,7 @@ export class CommentsExporter extends AbstractUserExporter <CommentsExportJSON>
const threadParentComments = await VideoCommentModel.listThreadParentComments({ comment })
let commentObject = comment.toActivityPubObject(threadParentComments) as VideoCommentObject
const isPublic = true // Comments are always public
const audience = getAudience(comment.Account.Actor, isPublic)
const audience = getPublicAudience(comment.Account.Actor)
commentObject = audiencify(commentObject, audience)

View file

@ -2,7 +2,7 @@ import { pick } from '@peertube/peertube-core-utils'
import { ActivityCreate, FileStorage, VideoCommentPolicy, VideoExportJSON, VideoObject, VideoPrivacy } from '@peertube/peertube-models'
import { logger } from '@server/helpers/logger.js'
import { USER_EXPORT_MAX_ITEMS } from '@server/initializers/constants.js'
import { audiencify, getAudience } from '@server/lib/activitypub/audience.js'
import { audiencify, getVideoAudience } from '@server/lib/activitypub/audience.js'
import { buildCreateActivity } from '@server/lib/activitypub/send/send-create.js'
import { buildChaptersAPHasPart } from '@server/lib/activitypub/video-chapters.js'
import {
@ -266,7 +266,7 @@ export class VideosExporter extends AbstractUserExporter<VideoExportJSON> {
): Promise<ActivityCreate<VideoObject>> {
const icon = video.getPreview()
const audience = getAudience(video.VideoChannel.Account.Actor, video.privacy === VideoPrivacy.PUBLIC)
const audience = getVideoAudience(video.VideoChannel.Account.Actor, video.privacy, { skipPrivacyCheck: true })
const videoObject = {
...audiencify(await video.toActivityPubObject(), audience),