]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/client-html.ts
Update data in DB when regenerate thumbnails
[github/Chocobozzz/PeerTube.git] / server / lib / client-html.ts
index 32f5d29abbaa968bc40fa9b32f0a94c6db998f0a..6ddaa82c83725486da80f39ca58cb121707ee0de 100644 (file)
@@ -1,29 +1,29 @@
 import * as express from 'express'
-import * as Bluebird from 'bluebird'
+import { readFile } from 'fs-extra'
+import { join } from 'path'
+import validator from 'validator'
 import { buildFileLocale, getDefaultLocale, is18nLocale, POSSIBLE_LOCALES } from '../../shared/core-utils/i18n/i18n'
+import { HttpStatusCode } from '../../shared/core-utils/miscs/http-error-codes'
+import { VideoPlaylistPrivacy, VideoPrivacy } from '../../shared/models/videos'
+import { isTestInstance, sha256 } from '../helpers/core-utils'
+import { escapeHTML } from '@shared/core-utils/renderer'
+import { logger } from '../helpers/logger'
+import { CONFIG } from '../initializers/config'
 import {
-  AVATARS_SIZE,
+  ACCEPT_HEADERS,
+  ACTOR_IMAGES_SIZE,
   CUSTOM_HTML_TAG_COMMENTS,
   EMBED_SIZE,
-  PLUGIN_GLOBAL_CSS_PATH,
-  WEBSERVER,
   FILES_CONTENT_HASH,
-  ACCEPT_HEADERS
+  PLUGIN_GLOBAL_CSS_PATH,
+  WEBSERVER
 } from '../initializers/constants'
-import { join } from 'path'
-import { escapeHTML, isTestInstance, sha256 } from '../helpers/core-utils'
-import { VideoModel } from '../models/video/video'
-import { VideoPlaylistModel } from '../models/video/video-playlist'
-import validator from 'validator'
-import { VideoPrivacy, VideoPlaylistPrivacy } from '../../shared/models/videos'
-import { readFile } from 'fs-extra'
-import { getActivityStreamDuration } from '../models/video/video-format-utils'
 import { AccountModel } from '../models/account/account'
+import { VideoModel } from '../models/video/video'
 import { VideoChannelModel } from '../models/video/video-channel'
-import { CONFIG } from '../initializers/config'
-import { logger } from '../helpers/logger'
+import { getActivityStreamDuration } from '../models/video/video-format-utils'
+import { VideoPlaylistModel } from '../models/video/video-playlist'
 import { MAccountActor, MChannelActor } from '../types/models'
-import { HttpStatusCode } from '../../shared/core-utils/miscs/http-error-codes'
 
 type Tags = {
   ogType: string
@@ -211,6 +211,8 @@ class ClientHtml {
 
     let html = buffer.toString()
     html = await ClientHtml.addAsyncPluginCSS(html)
+    html = ClientHtml.addCustomCSS(html)
+    html = ClientHtml.addTitleTag(html)
 
     ClientHtml.htmlCache[path] = html
 
@@ -218,7 +220,7 @@ class ClientHtml {
   }
 
   private static async getAccountOrChannelHTMLPage (
-    loader: () => Bluebird<MAccountActor | MChannelActor>,
+    loader: () => Promise<MAccountActor | MChannelActor>,
     req: express.Request,
     res: express.Response
   ) {
@@ -244,8 +246,8 @@ class ClientHtml {
 
     const image = {
       url: entity.Actor.getAvatarUrl(),
-      width: AVATARS_SIZE.width,
-      height: AVATARS_SIZE.height
+      width: ACTOR_IMAGES_SIZE.AVATARS.width,
+      height: ACTOR_IMAGES_SIZE.AVATARS.height
     }
 
     const ogType = 'website'