+ if (!video || video.privacy === VideoPrivacy.PRIVATE || video.privacy === VideoPrivacy.INTERNAL || video.VideoBlacklist) {
+ res.status(404)
+ return html
+ }
+
+ let customHtml = ClientHtml.addTitleTag(html, escapeHTML(video.name))
+ customHtml = ClientHtml.addDescriptionTag(customHtml, escapeHTML(video.description))
+ customHtml = ClientHtml.addVideoOpenGraphAndOEmbedTags(customHtml, video)
+
+ return customHtml
+ }
+
+ static async getAccountHTMLPage (nameWithHost: string, req: express.Request, res: express.Response) {
+ return this.getAccountOrChannelHTMLPage(() => AccountModel.loadByNameWithHost(nameWithHost), req, res)
+ }
+
+ static async getVideoChannelHTMLPage (nameWithHost: string, req: express.Request, res: express.Response) {
+ return this.getAccountOrChannelHTMLPage(() => VideoChannelModel.loadByNameWithHostAndPopulateAccount(nameWithHost), req, res)
+ }
+
+ private static async getAccountOrChannelHTMLPage (
+ loader: () => Bluebird<MAccountActor | MChannelActor>,
+ req: express.Request,
+ res: express.Response
+ ) {
+ const [ html, entity ] = await Promise.all([
+ ClientHtml.getIndexHTML(req, res),
+ loader()
+ ])
+
+ // Let Angular application handle errors
+ if (!entity) {
+ res.status(404)