import * as express from 'express'
import { buildFileLocale, getDefaultLocale, is18nLocale, POSSIBLE_LOCALES } from '../../shared/models/i18n/i18n'
-import { CUSTOM_HTML_TAG_COMMENTS, EMBED_SIZE, PLUGIN_GLOBAL_CSS_PATH, WEBSERVER } from '../initializers/constants'
+import { CUSTOM_HTML_TAG_COMMENTS, EMBED_SIZE, PLUGIN_GLOBAL_CSS_PATH, WEBSERVER, FILES_CONTENT_HASH } from '../initializers/constants'
import { join } from 'path'
import { escapeHTML, sha256 } from '../helpers/core-utils'
import { VideoModel } from '../models/video/video'
import * as Bluebird from 'bluebird'
import { CONFIG } from '../initializers/config'
import { logger } from '../helpers/logger'
-import { MAccountActor, MChannelActor, MVideo } from '../typings/models'
+import { MAccountActor, MChannelActor, MVideo } from '../types/models'
export class ClientHtml {
let html = buffer.toString()
if (paramLang) html = ClientHtml.addHtmlLang(html, paramLang)
+ html = ClientHtml.addManifestContentHash(html)
+ html = ClientHtml.addFaviconContentHash(html)
+ html = ClientHtml.addLogoContentHash(html)
html = ClientHtml.addCustomCSS(html)
html = await ClientHtml.addAsyncPluginCSS(html)
// Save locale in cookies
res.cookie('clientLanguage', lang, {
secure: WEBSERVER.SCHEME === 'https',
- sameSite: true,
+ sameSite: 'none',
maxAge: 1000 * 3600 * 24 * 90 // 3 months
})
return htmlStringPage.replace('<html>', `<html lang="${paramLang}">`)
}
+ private static addManifestContentHash (htmlStringPage: string) {
+ return htmlStringPage.replace('[manifestContentHash]', FILES_CONTENT_HASH.MANIFEST)
+ }
+
+ private static addFaviconContentHash (htmlStringPage: string) {
+ return htmlStringPage.replace('[faviconContentHash]', FILES_CONTENT_HASH.FAVICON)
+ }
+
+ private static addLogoContentHash (htmlStringPage: string) {
+ return htmlStringPage.replace('[logoContentHash]', FILES_CONTENT_HASH.LOGO)
+ }
+
private static addTitleTag (htmlStringPage: string, title?: string) {
let text = title || CONFIG.INSTANCE.NAME
if (title) text += ` - ${CONFIG.INSTANCE.NAME}`