import * as Bluebird from 'bluebird'
import { CONFIG } from '../initializers/config'
import { logger } from '../helpers/logger'
+import { MAccountActor, MChannelActor, MVideo } from '../typings/models'
export class ClientHtml {
const [ html, video ] = await Promise.all([
ClientHtml.getIndexHTML(req, res),
- VideoModel.loadAndPopulateAccountAndServerAndTags(videoId)
+ VideoModel.loadWithBlacklist(videoId)
])
// Let Angular application handle errors
- if (!video || video.privacy === VideoPrivacy.PRIVATE) {
+ if (!video || video.privacy === VideoPrivacy.PRIVATE || video.privacy === VideoPrivacy.INTERNAL || video.VideoBlacklist) {
return ClientHtml.getIndexHTML(req, res)
}
}
private static async getAccountOrChannelHTMLPage (
- loader: () => Bluebird<AccountModel | VideoChannelModel>,
+ loader: () => Bluebird<MAccountActor | MChannelActor>,
req: express.Request,
res: express.Response
) {
return htmlStringPage.replace('</head>', linkTag + '</head>')
}
- private static addVideoOpenGraphAndOEmbedTags (htmlStringPage: string, video: VideoModel) {
+ private static addVideoOpenGraphAndOEmbedTags (htmlStringPage: string, video: MVideo) {
const previewUrl = WEBSERVER.URL + video.getPreviewStaticPath()
const videoUrl = WEBSERVER.URL + video.getWatchStaticPath()
return this.addOpenGraphAndOEmbedTags(htmlStringPage, tagsString)
}
- private static addAccountOrChannelMetaTags (htmlStringPage: string, entity: AccountModel | VideoChannelModel) {
+ private static addAccountOrChannelMetaTags (htmlStringPage: string, entity: MAccountActor | MChannelActor) {
// SEO, use origin account or channel URL
const metaTags = `<link rel="canonical" href="${entity.Actor.url}" />`