From 3e753302d8c911b59971c16a8018df0e1ab78465 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 23 Jul 2019 10:40:39 +0200 Subject: Refactor middleware helpers --- server/lib/client-html.ts | 5 ++++- server/lib/plugins/plugin-manager.ts | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'server/lib') diff --git a/server/lib/client-html.ts b/server/lib/client-html.ts index 1e7897220..44bd7abb5 100644 --- a/server/lib/client-html.ts +++ b/server/lib/client-html.ts @@ -12,12 +12,15 @@ import { AccountModel } from '../models/account/account' import { VideoChannelModel } from '../models/video/video-channel' import * as Bluebird from 'bluebird' import { CONFIG } from '../initializers/config' +import { logger } from '../helpers/logger' export class ClientHtml { private static htmlCache: { [ path: string ]: string } = {} static invalidCache () { + logger.info('Cleaning HTML cache.') + ClientHtml.htmlCache = {} } @@ -146,7 +149,7 @@ export class ClientHtml { private static async addAsyncPluginCSS (htmlStringPage: string) { const globalCSSContent = await readFile(PLUGIN_GLOBAL_CSS_PATH) - if (!globalCSSContent) return htmlStringPage + if (globalCSSContent.byteLength === 0) return htmlStringPage const fileHash = sha256(globalCSSContent) const linkTag = `` diff --git a/server/lib/plugins/plugin-manager.ts b/server/lib/plugins/plugin-manager.ts index c0b49c7c7..a87d02c56 100644 --- a/server/lib/plugins/plugin-manager.ts +++ b/server/lib/plugins/plugin-manager.ts @@ -317,6 +317,8 @@ export class PluginManager implements ServerHook { // ###################### CSS ###################### private resetCSSGlobalFile () { + ClientHtml.invalidCache() + return outputFile(PLUGIN_GLOBAL_CSS_PATH, '') } -- cgit v1.2.3