Skip to content

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

Add player settings URL to channel object

Chocobozzz3d3240ae01d3
diff --git a/server/core/helpers/activity-pub-utils.ts b/server/core/helpers/activity-pub-utils.ts
index efd02ec9b4..37feebae58 100644
--- a/server/core/helpers/activity-pub-utils.ts
+++ b/server/core/helpers/activity-pub-utils.ts
@@ -75,8 +75,6 @@ type ContextValue = { [id: string]: string | { '@type': string, '@id': string }
const contextStore: { [id in ContextType]: (string | { [id: string]: string })[] } = {
Video: buildContext({
- ...getPlayerSettingsTypeContext(),
-
Hashtag: 'as:Hashtag',
category: 'sc:category',
licence: 'sc:license',
@@ -241,7 +239,7 @@ const contextStore: { [id in ContextType]: (string | { [id: string]: string })[]
}),
Actor: buildContext({
- ...getPlayerSettingsTypeContext(),
+ playerSettings: 'pt:playerSettings',
playlists: {
'@id': 'pt:playlists',
@@ -313,19 +311,13 @@ const contextStore: { [id in ContextType]: (string | { [id: string]: string })[]
}),
PlayerSettings: buildContext({
- ...getPlayerSettingsTypeContext(),
-
- theme: 'pt:theme'
- })
-}
-
-function getPlayerSettingsTypeContext () {
- return {
PlayerSettings: {
'@type': '@id',
'@id': 'pt:PlayerSettings'
- }
- }
+ },
+
+ theme: 'pt:theme'
+ })
}
let allContext: (string | ContextValue)[]
diff --git a/server/core/lib/activitypub/url.ts b/server/core/lib/activitypub/url.ts
index dc7ae9776b..535c6d2def 100644
--- a/server/core/lib/activitypub/url.ts
+++ b/server/core/lib/activitypub/url.ts
@@ -121,6 +121,10 @@ export function getUndoActivityPubUrl (originalUrl: string) {
return originalUrl + '/undo'
}
+export function getLocalActorPlayerSettingsActivityPubUrl (actor: MActorUrl) {
+ return actor.url + '/player-settings'
+}
+
export function getLocalApproveReplyActivityPubUrl (video: MVideoUUID, comment: MCommentId) {
return getLocalVideoCommentActivityPubUrl(video, comment) + '/approve-reply'
}
diff --git a/server/core/models/video/video-channel.ts b/server/core/models/video/video-channel.ts
index 28ad2a757b..531793f619 100644
--- a/server/core/models/video/video-channel.ts
+++ b/server/core/models/video/video-channel.ts
@@ -1,6 +1,7 @@
import { ActivityPubActor, VideoChannel, VideoChannelSummary, VideoPrivacy } from '@peertube/peertube-models'
import { AttributesOnly } from '@peertube/peertube-typescript-utils'
import { CONFIG } from '@server/initializers/config.js'
+import { getLocalActorPlayerSettingsActivityPubUrl } from '@server/lib/activitypub/url.js'
import { InternalEventEmitter } from '@server/lib/internal-event-emitter.js'
import { MAccountIdHost } from '@server/types/models/index.js'
import { FindOptions, Includeable, literal, Op, QueryTypes, Transaction } from 'sequelize'
@@ -590,6 +591,7 @@ export class VideoChannelModel extends SequelizeModel<VideoChannelModel> {
// ] as ActivityUrlObject[],
url: this.Actor.url,
+ playerSettings: getLocalActorPlayerSettingsActivityPubUrl(this.Actor),
summary: this.description,
support: this.support,