X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Fclient-html.ts;h=1e8d030230cd18e90a271a7c6b0e55aeb5873052;hb=6c1da7937cedbc1d4013cff0686d785247229c52;hp=0142b248b7c98fdc1ec7449371263b7c16ab2642;hpb=cc45cc9ac1d0afbe4844c34b13dd4a65dd523be1;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/client-html.ts b/server/lib/client-html.ts index 0142b248b..1e8d03023 100644 --- a/server/lib/client-html.ts +++ b/server/lib/client-html.ts @@ -12,7 +12,6 @@ import { HTMLServerConfig } from '@shared/models' import { buildFileLocale, getDefaultLocale, is18nLocale, POSSIBLE_LOCALES } from '../../shared/core-utils/i18n/i18n' import { HttpStatusCode } from '../../shared/models/http/http-error-codes' import { VideoPlaylistPrivacy, VideoPrivacy } from '../../shared/models/videos' -import { isTestInstance } from '../helpers/core-utils' import { logger } from '../helpers/logger' import { CONFIG } from '../initializers/config' import { @@ -24,13 +23,14 @@ import { WEBSERVER } from '../initializers/constants' import { AccountModel } from '../models/account/account' -import { getActivityStreamDuration } from '../models/video/formatter/video-format-utils' import { VideoModel } from '../models/video/video' import { VideoChannelModel } from '../models/video/video-channel' import { VideoPlaylistModel } from '../models/video/video-playlist' import { MAccountActor, MChannelActor } from '../types/models' +import { getActivityStreamDuration } from './activitypub/activity' import { getBiggestActorImage } from './actor-image' import { ServerConfigManager } from './server-config-manager' +import { isTestInstance } from '@server/helpers/core-utils' type Tags = { ogType: string @@ -135,6 +135,7 @@ class ClientHtml { escapedSiteName: escapeHTML(siteName), escapedTitle: escapeHTML(title), escapedDescription: escapeHTML(description), + disallowIndexation: video.privacy !== VideoPrivacy.PUBLIC, image, embed, ogType, @@ -198,6 +199,7 @@ class ClientHtml { escapedSiteName: escapeHTML(siteName), escapedTitle: escapeHTML(title), escapedDescription: escapeHTML(description), + disallowIndexation: videoPlaylist.privacy !== VideoPlaylistPrivacy.PUBLIC, embed, image, list, @@ -231,7 +233,10 @@ class ClientHtml { static async getEmbedHTML () { const path = ClientHtml.getEmbedPath() - if (!isTestInstance() && ClientHtml.htmlCache[path]) return ClientHtml.htmlCache[path] + // Disable HTML cache in dev mode because webpack can regenerate JS files + if (!isTestInstance() && ClientHtml.htmlCache[path]) { + return ClientHtml.htmlCache[path] + } const buffer = await readFile(path) const serverConfig = await ServerConfigManager.Instance.getHTMLServerConfig() @@ -303,7 +308,7 @@ class ClientHtml { private static async getIndexHTML (req: express.Request, res: express.Response, paramLang?: string) { const path = ClientHtml.getIndexPath(req, res, paramLang) - if (!isTestInstance() && ClientHtml.htmlCache[path]) return ClientHtml.htmlCache[path] + if (ClientHtml.htmlCache[path]) return ClientHtml.htmlCache[path] const buffer = await readFile(path) const serverConfig = await ServerConfigManager.Instance.getHTMLServerConfig()