+ 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<AccountModel | VideoChannelModel>,
+ req: express.Request,
+ res: express.Response
+ ) {
+ const [ html, entity ] = await Promise.all([
+ ClientHtml.getIndexHTML(req, res),
+ loader()
+ ])
+
+ // Let Angular application handle errors
+ if (!entity) {
+ return ClientHtml.getIndexHTML(req, res)
+ }
+
+ let customHtml = ClientHtml.addTitleTag(html, escapeHTML(entity.getDisplayName()))
+ customHtml = ClientHtml.addDescriptionTag(customHtml, escapeHTML(entity.description))
+ customHtml = ClientHtml.addAccountOrChannelMetaTags(customHtml, entity)