1
0
Fork 0

Add RSS feed discovery

This commit is contained in:
Chocobozzz 2025-02-14 15:47:01 +01:00
parent 02d53b1786
commit 21f0fbde0d
No known key found for this signature in database
GPG key ID: 583A612D890159BE
17 changed files with 259 additions and 88 deletions

View file

@ -1,16 +1,15 @@
import { Component, OnInit } from '@angular/core'
import { AuthService, ConfirmService, Notifier, ScopedTokensService } from '@app/core'
import { VideoService } from '@app/shared/shared-main/video/video.service'
import { FeedFormat, ScopedToken } from '@peertube/peertube-models'
import { environment } from '../../../environments/environment'
import { InputTextComponent } from '../../shared/shared-forms/input-text.component'
import { GlobalIconComponent } from '../../shared/shared-icons/global-icon.component'
import { VideoService } from '@app/shared/shared-main/video/video.service'
@Component({
selector: 'my-account-applications',
templateUrl: './my-account-applications.component.html',
styleUrls: [ './my-account-applications.component.scss' ],
imports: [ GlobalIconComponent, InputTextComponent ]
imports: [ InputTextComponent ]
})
export class MyAccountApplicationsComponent implements OnInit {
feedUrl: string

View file

@ -1,7 +1,8 @@
import { NgClass, NgIf, NgTemplateOutlet } from '@angular/common'
import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core'
import { ActivatedRoute, RouterLink, RouterOutlet } from '@angular/router'
import { AuthService, Hotkey, HotkeysService, MarkdownService, MetaService, RestExtractor, ScreenService } from '@app/core'
import { AuthService, Hotkey, HotkeysService, MarkdownService, MetaService, RestExtractor, ScreenService, ServerService } from '@app/core'
import { getOriginUrl } from '@app/helpers'
import { Account } from '@app/shared/shared-main/account/account.model'
import { VideoChannel } from '@app/shared/shared-main/channel/video-channel.model'
import { VideoChannelService } from '@app/shared/shared-main/channel/video-channel.service'
@ -10,6 +11,7 @@ import { VideoService } from '@app/shared/shared-main/video/video.service'
import { BlocklistService } from '@app/shared/shared-moderation/blocklist.service'
import { SupportModalComponent } from '@app/shared/shared-support-modal/support-modal.component'
import { SubscribeButtonComponent } from '@app/shared/shared-user-subscription/subscribe-button.component'
import { getChannelRSSFeeds } from '@peertube/peertube-core-utils'
import { HttpStatusCode, UserRight } from '@peertube/peertube-models'
import { Subscription } from 'rxjs'
import { catchError, distinctUntilChanged, map, switchMap } from 'rxjs/operators'
@ -63,7 +65,8 @@ export class VideoChannelsComponent implements OnInit, OnDestroy {
private screenService: ScreenService,
private markdown: MarkdownService,
private blocklist: BlocklistService,
private metaService: MetaService
private metaService: MetaService,
private server: ServerService
) { }
ngOnInit () {
@ -79,6 +82,7 @@ export class VideoChannelsComponent implements OnInit, OnDestroy {
)
.subscribe(async videoChannel => {
this.metaService.setTitle(videoChannel.displayName)
this.metaService.setRSSFeeds(getChannelRSSFeeds(getOriginUrl(), this.server.getHTMLConfig().instance.name, videoChannel))
this.channelDescriptionHTML = await this.markdown.textMarkdownToHTML({
markdown: videoChannel.description,
@ -121,6 +125,8 @@ export class VideoChannelsComponent implements OnInit, OnDestroy {
// Unbind hotkeys
if (this.isUserLoggedIn()) this.hotkeysService.remove(this.hotkeys)
this.metaService.revertMetaTags()
}
isInSmallView () {

View file

@ -18,7 +18,7 @@ import {
UserService
} from '@app/core'
import { HooksService } from '@app/core/plugins/hooks.service'
import { isXPercentInViewport, scrollToTop, toBoolean } from '@app/helpers'
import { getOriginUrl, isXPercentInViewport, scrollToTop, toBoolean } from '@app/helpers'
import { VideoCaptionService } from '@app/shared/shared-main/video-caption/video-caption.service'
import { VideoChapterService } from '@app/shared/shared-main/video/video-chapter.service'
import { VideoDetails } from '@app/shared/shared-main/video/video-details.model'
@ -29,7 +29,7 @@ import { SubscribeButtonComponent } from '@app/shared/shared-user-subscription/s
import { LiveVideoService } from '@app/shared/shared-video-live/live-video.service'
import { VideoPlaylist } from '@app/shared/shared-video-playlist/video-playlist.model'
import { VideoPlaylistService } from '@app/shared/shared-video-playlist/video-playlist.service'
import { timeToInt } from '@peertube/peertube-core-utils'
import { getVideoWatchRSSFeeds, timeToInt } from '@peertube/peertube-core-utils'
import {
HTMLServerConfig,
HttpStatusCode,
@ -43,11 +43,6 @@ import {
VideoState,
VideoStateType
} from '@peertube/peertube-models'
import { logger } from '@root-helpers/logger'
import { isP2PEnabled, videoRequiresFileToken, videoRequiresUserAuth } from '@root-helpers/video'
import debug from 'debug'
import { forkJoin, map, Observable, of, Subscription, switchMap } from 'rxjs'
import { environment } from '../../../environments/environment'
import {
cleanupVideoWatch,
getStoredTheater,
@ -59,6 +54,11 @@ import {
PlayerMode,
videojs
} from '@peertube/player'
import { logger } from '@root-helpers/logger'
import { isP2PEnabled, videoRequiresFileToken, videoRequiresUserAuth } from '@root-helpers/video'
import debug from 'debug'
import { forkJoin, map, Observable, of, Subscription, switchMap } from 'rxjs'
import { environment } from '../../../environments/environment'
import { DateToggleComponent } from '../../shared/shared-main/date/date-toggle.component'
import { PluginPlaceholderComponent } from '../../shared/shared-main/plugins/plugin-placeholder.component'
import { VideoViewsCounterComponent } from '../../shared/shared-video/video-views-counter.component'
@ -229,6 +229,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
// Unbind hotkeys
this.hotkeysService.remove(this.hotkeys)
this.metaService.revertMetaTags()
}
getCurrentTime () {
@ -990,7 +992,11 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
private setMetaTags (video: Video) {
this.metaService.setTitle(video.name)
this.metaService.setTag('description', video.description)
this.metaService.setDescription(video.description)
this.metaService.setRSSFeeds(
getVideoWatchRSSFeeds(getOriginUrl(), this.serverConfig.instance.name, { ...video, privacy: video.privacy.id })
)
}
private getUrlOptions (): URLOptions {

View file

@ -1,5 +1,7 @@
import { Injectable } from '@angular/core'
import { Meta, Title } from '@angular/platform-browser'
import { getOriginUrl } from '@app/helpers'
import { getDefaultRSSFeeds } from '@peertube/peertube-core-utils'
import { HTMLServerConfig } from '@peertube/peertube-models'
import { ServerService } from '../server'
@ -19,6 +21,10 @@ export class MetaService {
this.config = this.server.getHTMLConfig()
}
update (meta: MetaSettings) {
this.setTitle(meta.title)
}
setTitle (subTitle?: string) {
let title = ''
if (subTitle) title += `${subTitle} - `
@ -28,11 +34,30 @@ export class MetaService {
this.titleService.setTitle(title)
}
setTag (name: string, value: string) {
this.meta.addTag({ name, content: value })
setDescription (description?: string) {
this.meta.updateTag({ name: 'description', content: description || this.config.instance.shortDescription })
}
update (meta: MetaSettings) {
this.setTitle(meta.title)
revertMetaTags () {
this.setTitle()
this.setDescription()
this.setRSSFeeds(getDefaultRSSFeeds(getOriginUrl(), this.config.instance.name))
}
setRSSFeeds (rssFeeds: { title: string, url: string }[]) {
const head = document.getElementsByTagName('head')[0]
head.querySelectorAll('link[rel="alternate"]').forEach((el) => head.removeChild(el))
for (const rssFeed of rssFeeds) {
const link = document.createElement('link')
link.rel = 'alternate'
link.type = 'application/rss+xml'
link.title = rssFeed.title
link.href = rssFeed.url
head.appendChild(link)
}
}
}

View file

@ -1,6 +1,6 @@
import { environment } from '../../../environments/environment'
function getAbsoluteAPIUrl () {
export function getAbsoluteAPIUrl () {
let absoluteAPIUrl = environment.hmr === true
? 'http://localhost:9000'
: environment.apiUrl
@ -13,11 +13,15 @@ function getAbsoluteAPIUrl () {
return absoluteAPIUrl
}
function getAPIHost () {
export function getOriginUrl () {
return environment.originServerUrl || window.location.origin
}
export function getAPIHost () {
return new URL(getAbsoluteAPIUrl()).host
}
function getAbsoluteEmbedUrl () {
export function getAbsoluteEmbedUrl () {
let absoluteEmbedUrl = environment.originServerUrl
if (!absoluteEmbedUrl) {
// The Embed is on the same domain
@ -28,7 +32,7 @@ function getAbsoluteEmbedUrl () {
}
// Thanks: https://gist.github.com/ghinda/8442a57f22099bdb2e34
function objectToFormData (obj: any, form?: FormData, namespace?: string) {
export function objectToFormData (obj: any, form?: FormData, namespace?: string) {
const fd = form || new FormData()
let formKey
@ -52,11 +56,3 @@ function objectToFormData (obj: any, form?: FormData, namespace?: string) {
return fd
}
export {
getAbsoluteAPIUrl,
getAPIHost,
getAbsoluteEmbedUrl,
objectToFormData
}

View file

@ -1,16 +1,16 @@
function getParamToggle (params: URLSearchParams, name: string, defaultValue?: boolean) {
export function getParamToggle (params: URLSearchParams, name: string, defaultValue?: boolean) {
return params.has(name)
? (params.get(name) === '1' || params.get(name) === 'true')
: defaultValue
}
function getParamString (params: URLSearchParams, name: string, defaultValue?: string) {
export function getParamString (params: URLSearchParams, name: string, defaultValue?: string) {
return params.has(name)
? params.get(name)
: defaultValue
}
function objectToUrlEncoded (obj: any) {
export function objectToUrlEncoded (obj: any) {
const str: string[] = []
for (const key of Object.keys(obj)) {
str.push(encodeURIComponent(key) + '=' + encodeURIComponent(obj[key]))
@ -18,9 +18,3 @@ function objectToUrlEncoded (obj: any) {
return str.join('&')
}
export {
getParamToggle,
getParamString,
objectToUrlEncoded
}

View file

@ -1,2 +1,3 @@
export * from './markdown.js'
export * from './html.js'
export * from './markdown.js'
export * from './rss.js'

View file

@ -0,0 +1,41 @@
import { VideoPrivacy, VideoPrivacyType } from '@peertube/peertube-models'
export function getDefaultRSSFeeds (url: string, instanceName: string) {
return [
{
url: `${url}/feeds/videos.xml`,
// TODO: translate
title: `${instanceName} - Videos feed`
}
]
}
export function getChannelRSSFeeds (url: string, instanceName: string, channel: { name: string, id: number }) {
return [
{
url: `${url}/feeds/podcast/videos.xml?videoChannelId=${channel.id}`,
// TODO: translate
title: `${channel.name} feed`
},
...getDefaultRSSFeeds(url, instanceName)
]
}
export function getVideoWatchRSSFeeds (
url: string,
instanceName: string,
video: { name: string, uuid: string, privacy: VideoPrivacyType }
) {
if (video.privacy !== VideoPrivacy.PUBLIC) return getDefaultRSSFeeds(url, instanceName)
return [
{
url: `${url}/feeds/video-comments.xml?videoId=${video.uuid}`,
// TODO: translate
title: `${video.name} - Comments feed`
},
...getDefaultRSSFeeds(url, instanceName)
]
}

View file

@ -7,7 +7,7 @@ import { getWatchPlaylistBasePaths, getWatchVideoBasePaths, prepareClientTests }
config.truncateThreshold = 0
describe('Test Open Graph and Twitter cards HTML tags', function () {
describe('Test <head> HTML tags', function () {
let servers: PeerTubeServer[]
let account: Account
@ -286,6 +286,66 @@ describe('Test Open Graph and Twitter cards HTML tags', function () {
})
})
describe('RSS links', function () {
async function commonPageTest (path: string) {
const res = await makeGetRequest({ url: servers[0].url, path, accept: 'text/html', expectedStatus: HttpStatusCode.OK_200 })
const text = res.text
const feedUrl = `${servers[0].url}/feeds/videos.xml`
// eslint-disable-next-line max-len
expect(text).to.contain(`<link rel="alternate" type="application/rss+xml" title="super instance title - Videos feed" href="${feedUrl}" />`)
}
async function channelPageTest (path: string) {
await commonPageTest(path)
const res = await makeGetRequest({ url: servers[0].url, path, accept: 'text/html', expectedStatus: HttpStatusCode.OK_200 })
const text = res.text
const feedUrl = `${servers[0].url}/feeds/podcast/videos.xml?videoChannelId=${servers[0].store.channel.id}`
// eslint-disable-next-line max-len
expect(text).to.contain(`<link rel="alternate" type="application/rss+xml" title="${servers[0].store.channel.displayName} feed" href="${feedUrl}" />`)
}
async function watchVideoPageTest (path: string) {
await commonPageTest(path)
const res = await makeGetRequest({ url: servers[0].url, path, accept: 'text/html', expectedStatus: HttpStatusCode.OK_200 })
const text = res.text
const feedUrl = `${servers[0].url}/feeds/video-comments.xml?videoId=${servers[0].store.video.uuid}`
expect(text).to.contain(`<link rel="alternate" type="application/rss+xml" title="${videoName} - Comments feed" href="${feedUrl}" />`)
}
it('Should have valid RSS links on the watch video page', async function () {
for (const path of getWatchVideoBasePaths()) {
await watchVideoPageTest(path + videoIds[0])
}
})
it('Should have valid RSS links on the watch playlist page', async function () {
for (const path of getWatchPlaylistBasePaths()) {
for (const id of playlistIds) {
await commonPageTest(path + id)
}
}
})
it('Should have valid RSS links on the account page', async function () {
await commonPageTest('/accounts/' + account.name)
await commonPageTest('/a/' + account.name)
await commonPageTest('/@' + account.name)
})
it('Should have valid RSS links the channel page', async function () {
await channelPageTest('/video-channels/' + servers[0].store.channel.name)
await channelPageTest('/c/' + servers[0].store.channel.name)
await channelPageTest('/@' + servers[0].store.channel.name)
})
})
after(async function () {
await cleanupTests(servers)
})

View file

@ -1,4 +1,4 @@
export * from './embed-html.js'
export * from './index-html.js'
export * from './oembed.js'
export * from './og-twitter-tags.js'
export * from './head-tags.js'

View file

@ -1,5 +1,6 @@
import { escapeHTML, maxBy } from '@peertube/peertube-core-utils'
import { escapeHTML, getChannelRSSFeeds, getDefaultRSSFeeds, maxBy } from '@peertube/peertube-core-utils'
import { HttpStatusCode } from '@peertube/peertube-models'
import { WEBSERVER } from '@server/initializers/constants.js'
import { AccountModel } from '@server/models/account/account.js'
import { ActorImageModel } from '@server/models/actor/actor-image.js'
import { VideoChannelModel } from '@server/models/video/video-channel.js'
@ -7,20 +8,30 @@ import { MAccountHost, MChannelHost } from '@server/types/models/index.js'
import express from 'express'
import { CONFIG } from '../../../initializers/config.js'
import { PageHtml } from './page-html.js'
import { TagsHtml } from './tags-html.js'
import { TagsHtml, TagsOptions } from './tags-html.js'
export class ActorHtml {
static async getAccountHTMLPage (nameWithHost: string, req: express.Request, res: express.Response) {
const accountModelPromise = AccountModel.loadByNameWithHost(nameWithHost)
return this.getAccountOrChannelHTMLPage(() => accountModelPromise, req, res)
return this.getAccountOrChannelHTMLPage({
loader: () => accountModelPromise,
getRSSFeeds: () => getDefaultRSSFeeds(WEBSERVER.URL, CONFIG.INSTANCE.NAME),
req,
res
})
}
static async getVideoChannelHTMLPage (nameWithHost: string, req: express.Request, res: express.Response) {
const videoChannelModelPromise = VideoChannelModel.loadByNameWithHostAndPopulateAccount(nameWithHost)
const videoChannel = await VideoChannelModel.loadByNameWithHostAndPopulateAccount(nameWithHost)
return this.getAccountOrChannelHTMLPage(() => videoChannelModelPromise, req, res)
return this.getAccountOrChannelHTMLPage({
loader: () => Promise.resolve(videoChannel),
getRSSFeeds: () => getChannelRSSFeeds(WEBSERVER.URL, CONFIG.INSTANCE.NAME, videoChannel),
req,
res
})
}
static async getActorHTMLPage (nameWithHost: string, req: express.Request, res: express.Response) {
@ -29,16 +40,28 @@ export class ActorHtml {
VideoChannelModel.loadByNameWithHostAndPopulateAccount(nameWithHost)
])
return this.getAccountOrChannelHTMLPage(() => Promise.resolve(account || channel), req, res)
return this.getAccountOrChannelHTMLPage({
loader: () => Promise.resolve(account || channel),
getRSSFeeds: () => account
? getDefaultRSSFeeds(WEBSERVER.URL, CONFIG.INSTANCE.NAME)
: getChannelRSSFeeds(WEBSERVER.URL, CONFIG.INSTANCE.NAME, channel),
req,
res
})
}
// ---------------------------------------------------------------------------
private static async getAccountOrChannelHTMLPage (
loader: () => Promise<MAccountHost | MChannelHost>,
req: express.Request,
private static async getAccountOrChannelHTMLPage (options: {
loader: () => Promise<MAccountHost | MChannelHost>
getRSSFeeds: (entity: MAccountHost | MChannelHost) => TagsOptions['rssFeeds']
req: express.Request
res: express.Response
) {
}) {
const { loader, getRSSFeeds, req, res } = options
const [ html, entity ] = await Promise.all([
PageHtml.getIndexHTML(req, res),
loader()
@ -85,7 +108,9 @@ export class ActorHtml {
updatedAt: entity.updatedAt
},
forbidIndexation: !entity.Actor.isOwned()
forbidIndexation: !entity.Actor.isOwned(),
rssFeeds: getRSSFeeds(entity)
}, {})
return customHTML

View file

@ -1,19 +0,0 @@
import { MVideo } from '@server/types/models/video/video.js'
import { TagsHtml } from './tags-html.js'
import { MVideoPlaylist } from '@server/types/models/video/video-playlist.js'
export class CommonEmbedHtml {
static buildEmptyEmbedHTML (options: {
html: string
playlist?: MVideoPlaylist
video?: MVideo
}) {
const { html, playlist, video } = options
let htmlResult = TagsHtml.addTitleTag(html)
htmlResult = TagsHtml.addDescriptionTag(htmlResult)
return TagsHtml.addTags(htmlResult, { forbidIndexation: true }, { playlist, video })
}
}

View file

@ -0,0 +1,16 @@
import { MVideoPlaylist } from '@server/types/models/video/video-playlist.js'
import { MVideo } from '@server/types/models/video/video.js'
import { TagsHtml } from './tags-html.js'
export function buildEmptyEmbedHTML (options: {
html: string
playlist?: MVideoPlaylist
video?: MVideo
}) {
const { html, playlist, video } = options
let htmlResult = TagsHtml.addTitleTag(html)
htmlResult = TagsHtml.addDescriptionTag(htmlResult)
return TagsHtml.addTags(htmlResult, { forbidIndexation: true }, { playlist, video })
}

View file

@ -1,4 +1,11 @@
import { buildFileLocale, escapeHTML, getDefaultLocale, is18nLocale, POSSIBLE_LOCALES } from '@peertube/peertube-core-utils'
import {
buildFileLocale,
escapeHTML,
getDefaultLocale,
getDefaultRSSFeeds,
is18nLocale,
POSSIBLE_LOCALES
} from '@peertube/peertube-core-utils'
import { ActorImageType, HTMLServerConfig } from '@peertube/peertube-models'
import { isTestOrDevInstance, root, sha256 } from '@peertube/peertube-node-utils'
import { CONFIG } from '@server/initializers/config.js'
@ -52,7 +59,8 @@ export class PageHtml {
ogType: 'website',
twitterCard: 'summary_large_image',
forbidIndexation: false
forbidIndexation: false,
rssFeeds: getDefaultRSSFeeds(WEBSERVER.URL, CONFIG.INSTANCE.NAME)
}, {})
return customHTML

View file

@ -1,4 +1,4 @@
import { addQueryParams, escapeHTML } from '@peertube/peertube-core-utils'
import { addQueryParams, escapeHTML, getDefaultRSSFeeds } from '@peertube/peertube-core-utils'
import { HttpStatusCode, VideoPlaylistPrivacy } from '@peertube/peertube-models'
import { toCompleteUUID } from '@server/helpers/custom-validators/misc.js'
import { Memoize } from '@server/helpers/memoize.js'
@ -8,7 +8,7 @@ import express from 'express'
import validator from 'validator'
import { CONFIG } from '../../../initializers/config.js'
import { MEMOIZE_TTL, WEBSERVER } from '../../../initializers/constants.js'
import { CommonEmbedHtml } from './common-embed-html.js'
import { buildEmptyEmbedHTML } from './common.js'
import { PageHtml } from './page-html.js'
import { TagsHtml } from './tags-html.js'
@ -56,7 +56,7 @@ export class PlaylistHtml {
const [ html, playlist ] = await Promise.all([ PageHtml.getEmbedHTML(), playlistPromise ])
if (!playlist || playlist.privacy === VideoPlaylistPrivacy.PRIVATE) {
return CommonEmbedHtml.buildEmptyEmbedHTML({ html, playlist })
return buildEmptyEmbedHTML({ html, playlist })
}
return this.buildPlaylistHTML({
@ -126,7 +126,9 @@ export class PlaylistHtml {
twitterCard,
embed,
oembedUrl: this.getOEmbedUrl(playlist, currentQuery)
oembedUrl: this.getOEmbedUrl(playlist, currentQuery),
rssFeeds: getDefaultRSSFeeds(WEBSERVER.URL, CONFIG.INSTANCE.NAME)
}, { playlist })
}

View file

@ -7,7 +7,7 @@ import { CUSTOM_HTML_TAG_COMMENTS, EMBED_SIZE, WEBSERVER } from '../../../initia
import { MVideo, MVideoPlaylist } from '../../../types/models/index.js'
import { Hooks } from '../../plugins/hooks.js'
type Tags = {
export type TagsOptions = {
forbidIndexation: boolean
url?: string
@ -46,6 +46,11 @@ type Tags = {
}
oembedUrl?: string
rssFeeds?: {
title: string
url: string
}[]
}
type HookContext = {
@ -81,7 +86,7 @@ export class TagsHtml {
// ---------------------------------------------------------------------------
static async addTags (htmlStringPage: string, tagsValues: Tags, context: HookContext) {
static async addTags (htmlStringPage: string, tagsValues: TagsOptions, context: HookContext) {
const metaTags = {
...this.generateOpenGraphMetaTagsOptions(tagsValues),
...this.generateStandardMetaTagsOptions(tagsValues),
@ -89,7 +94,7 @@ export class TagsHtml {
}
const schemaTags = await this.generateSchemaTagsOptions(tagsValues, context)
const { url, escapedTitle, oembedUrl, forbidIndexation, relMe } = tagsValues
const { url, escapedTitle, oembedUrl, forbidIndexation, relMe, rssFeeds } = tagsValues
const oembedLinkTags: { type: string, href: string, escapedTitle: string }[] = []
@ -134,12 +139,16 @@ export class TagsHtml {
tagsStr += `<meta name="robots" content="noindex" />`
}
for (const rssLink of (rssFeeds || [])) {
tagsStr += `<link rel="alternate" type="application/rss+xml" title="${escapeAttribute(rssLink.title)}" href="${rssLink.url}" />`
}
return htmlStringPage.replace(CUSTOM_HTML_TAG_COMMENTS.META_TAGS, tagsStr)
}
// ---------------------------------------------------------------------------
static generateOpenGraphMetaTagsOptions (tags: Tags) {
static generateOpenGraphMetaTagsOptions (tags: TagsOptions) {
if (!tags.ogType) return {}
const metaTags = {
@ -171,7 +180,7 @@ export class TagsHtml {
return metaTags
}
static generateStandardMetaTagsOptions (tags: Tags) {
static generateStandardMetaTagsOptions (tags: TagsOptions) {
return {
name: tags.escapedTitle,
description: tags.escapedTruncatedDescription,
@ -179,7 +188,7 @@ export class TagsHtml {
}
}
static generateTwitterCardMetaTagsOptions (tags: Tags) {
static generateTwitterCardMetaTagsOptions (tags: TagsOptions) {
if (!tags.twitterCard) return {}
const metaTags = {
@ -207,7 +216,7 @@ export class TagsHtml {
return metaTags
}
static generateSchemaTagsOptions (tags: Tags, context: HookContext) {
static generateSchemaTagsOptions (tags: TagsOptions, context: HookContext) {
if (!tags.schemaType) return
if (tags.schemaType === 'ProfilePage') {

View file

@ -1,4 +1,4 @@
import { addQueryParams, escapeHTML } from '@peertube/peertube-core-utils'
import { addQueryParams, escapeHTML, getVideoWatchRSSFeeds } from '@peertube/peertube-core-utils'
import { HttpStatusCode, VideoPrivacy } from '@peertube/peertube-models'
import { toCompleteUUID } from '@server/helpers/custom-validators/misc.js'
import { Memoize } from '@server/helpers/memoize.js'
@ -10,7 +10,7 @@ import { VideoModel } from '../../../models/video/video.js'
import { MVideo, MVideoThumbnail, MVideoThumbnailBlacklist } from '../../../types/models/index.js'
import { getActivityStreamDuration } from '../../activitypub/activity.js'
import { isVideoInPrivateDirectory } from '../../video-privacy.js'
import { CommonEmbedHtml } from './common-embed-html.js'
import { buildEmptyEmbedHTML } from './common.js'
import { PageHtml } from './page-html.js'
import { TagsHtml } from './tags-html.js'
@ -57,7 +57,7 @@ export class VideoHtml {
const [ html, video ] = await Promise.all([ PageHtml.getEmbedHTML(), videoPromise ])
if (!video || isVideoInPrivateDirectory(video.privacy) || video.VideoBlacklist) {
return CommonEmbedHtml.buildEmptyEmbedHTML({ html, video })
return buildEmptyEmbedHTML({ html, video })
}
return this.buildVideoHTML({
@ -131,7 +131,9 @@ export class VideoHtml {
ogType,
twitterCard,
schemaType
schemaType,
rssFeeds: getVideoWatchRSSFeeds(WEBSERVER.URL, CONFIG.INSTANCE.NAME, video)
}, { video })
}