1
0
Fork 0

Don't render opengraph tags of private videos

This commit is contained in:
Chocobozzz 2018-05-24 15:34:16 +02:00
parent d14a9532a1
commit a00a8f09f9
No known key found for this signature in database
GPG key ID: 583A612D890159BE

View file

@ -6,6 +6,7 @@ import { escapeHTML, readFileBufferPromise, root } from '../helpers/core-utils'
import { CONFIG, EMBED_SIZE, OPENGRAPH_AND_OEMBED_COMMENT, STATIC_MAX_AGE, STATIC_PATHS } from '../initializers' import { CONFIG, EMBED_SIZE, OPENGRAPH_AND_OEMBED_COMMENT, STATIC_MAX_AGE, STATIC_PATHS } from '../initializers'
import { asyncMiddleware } from '../middlewares' import { asyncMiddleware } from '../middlewares'
import { VideoModel } from '../models/video/video' import { VideoModel } from '../models/video/video'
import { VideoPrivacy } from '../../shared/models/videos'
const clientsRouter = express.Router() const clientsRouter = express.Router()
@ -152,7 +153,7 @@ async function generateWatchHtmlPage (req: express.Request, res: express.Respons
const html = file.toString() const html = file.toString()
// Let Angular application handle errors // Let Angular application handle errors
if (!video) return res.sendFile(indexPath) if (!video || video.privacy === VideoPrivacy.PRIVATE) return res.sendFile(indexPath)
const htmlStringPageWithTags = addOpenGraphAndOEmbedTags(html, video) const htmlStringPageWithTags = addOpenGraphAndOEmbedTags(html, video)
res.set('Content-Type', 'text/html; charset=UTF-8').send(htmlStringPageWithTags) res.set('Content-Type', 'text/html; charset=UTF-8').send(htmlStringPageWithTags)