diff options
author | Chocobozzz <me@florianbigard.com> | 2019-07-23 10:40:39 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2019-07-24 10:58:16 +0200 |
commit | 3e753302d8c911b59971c16a8018df0e1ab78465 (patch) | |
tree | efce7ece3273589228c5c948ea6757b2bdf65429 /server/lib/client-html.ts | |
parent | a8b666e9f1ed002230869606308749614390c82f (diff) | |
download | PeerTube-3e753302d8c911b59971c16a8018df0e1ab78465.tar.gz PeerTube-3e753302d8c911b59971c16a8018df0e1ab78465.tar.zst PeerTube-3e753302d8c911b59971c16a8018df0e1ab78465.zip |
Refactor middleware helpers
Diffstat (limited to 'server/lib/client-html.ts')
-rw-r--r-- | server/lib/client-html.ts | 5 |
1 files changed, 4 insertions, 1 deletions
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' | |||
12 | import { VideoChannelModel } from '../models/video/video-channel' | 12 | import { VideoChannelModel } from '../models/video/video-channel' |
13 | import * as Bluebird from 'bluebird' | 13 | import * as Bluebird from 'bluebird' |
14 | import { CONFIG } from '../initializers/config' | 14 | import { CONFIG } from '../initializers/config' |
15 | import { logger } from '../helpers/logger' | ||
15 | 16 | ||
16 | export class ClientHtml { | 17 | export class ClientHtml { |
17 | 18 | ||
18 | private static htmlCache: { [ path: string ]: string } = {} | 19 | private static htmlCache: { [ path: string ]: string } = {} |
19 | 20 | ||
20 | static invalidCache () { | 21 | static invalidCache () { |
22 | logger.info('Cleaning HTML cache.') | ||
23 | |||
21 | ClientHtml.htmlCache = {} | 24 | ClientHtml.htmlCache = {} |
22 | } | 25 | } |
23 | 26 | ||
@@ -146,7 +149,7 @@ export class ClientHtml { | |||
146 | 149 | ||
147 | private static async addAsyncPluginCSS (htmlStringPage: string) { | 150 | private static async addAsyncPluginCSS (htmlStringPage: string) { |
148 | const globalCSSContent = await readFile(PLUGIN_GLOBAL_CSS_PATH) | 151 | const globalCSSContent = await readFile(PLUGIN_GLOBAL_CSS_PATH) |
149 | if (!globalCSSContent) return htmlStringPage | 152 | if (globalCSSContent.byteLength === 0) return htmlStringPage |
150 | 153 | ||
151 | const fileHash = sha256(globalCSSContent) | 154 | const fileHash = sha256(globalCSSContent) |
152 | const linkTag = `<link rel="stylesheet" href="/plugins/global.css?hash=${fileHash}" />` | 155 | const linkTag = `<link rel="stylesheet" href="/plugins/global.css?hash=${fileHash}" />` |