aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-07-23 10:40:39 +0200
committerChocobozzz <chocobozzz@cpy.re>2019-07-24 10:58:16 +0200
commit3e753302d8c911b59971c16a8018df0e1ab78465 (patch)
treeefce7ece3273589228c5c948ea6757b2bdf65429 /server/lib
parenta8b666e9f1ed002230869606308749614390c82f (diff)
downloadPeerTube-3e753302d8c911b59971c16a8018df0e1ab78465.tar.gz
PeerTube-3e753302d8c911b59971c16a8018df0e1ab78465.tar.zst
PeerTube-3e753302d8c911b59971c16a8018df0e1ab78465.zip
Refactor middleware helpers
Diffstat (limited to 'server/lib')
-rw-r--r--server/lib/client-html.ts5
-rw-r--r--server/lib/plugins/plugin-manager.ts2
2 files changed, 6 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'
12import { VideoChannelModel } from '../models/video/video-channel' 12import { VideoChannelModel } from '../models/video/video-channel'
13import * as Bluebird from 'bluebird' 13import * as Bluebird from 'bluebird'
14import { CONFIG } from '../initializers/config' 14import { CONFIG } from '../initializers/config'
15import { logger } from '../helpers/logger'
15 16
16export class ClientHtml { 17export 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}" />`
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 {
317 // ###################### CSS ###################### 317 // ###################### CSS ######################
318 318
319 private resetCSSGlobalFile () { 319 private resetCSSGlobalFile () {
320 ClientHtml.invalidCache()
321
320 return outputFile(PLUGIN_GLOBAL_CSS_PATH, '') 322 return outputFile(PLUGIN_GLOBAL_CSS_PATH, '')
321 } 323 }
322 324