aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorJohn Livingston <38844060+JohnXLivingston@users.noreply.github.com>2023-05-10 09:54:44 +0200
committerGitHub <noreply@github.com>2023-05-10 09:54:44 +0200
commitf9eee54f2a601b8db7ebb7c11d149b39170e6d68 (patch)
tree7cfe712d0fc11b0a49423e2990d7ed24ddb42f7b /server
parent674f8ddd415ff4faf100ff35cf2511f84f60fea9 (diff)
downloadPeerTube-f9eee54f2a601b8db7ebb7c11d149b39170e6d68.tar.gz
PeerTube-f9eee54f2a601b8db7ebb7c11d149b39170e6d68.tar.zst
PeerTube-f9eee54f2a601b8db7ebb7c11d149b39170e6d68.zip
Fix #5744: Missing plugins-global.css + missing async (#5746)
* Fix #5744: Missing plugins-global.css + missing async * Modifications required by Chocobozzz. * Styling --------- Co-authored-by: Chocobozzz <me@florianbigard.com>
Diffstat (limited to 'server')
-rw-r--r--server/lib/client-html.ts17
1 files changed, 15 insertions, 2 deletions
diff --git a/server/lib/client-html.ts b/server/lib/client-html.ts
index 8530cbcc2..058f29f03 100644
--- a/server/lib/client-html.ts
+++ b/server/lib/client-html.ts
@@ -1,5 +1,5 @@
1import express from 'express' 1import express from 'express'
2import { readFile } from 'fs-extra' 2import { pathExists, readFile } from 'fs-extra'
3import { join } from 'path' 3import { join } from 'path'
4import validator from 'validator' 4import validator from 'validator'
5import { isTestOrDevInstance } from '@server/helpers/core-utils' 5import { isTestOrDevInstance } from '@server/helpers/core-utils'
@@ -408,7 +408,20 @@ class ClientHtml {
408 } 408 }
409 409
410 private static async addAsyncPluginCSS (htmlStringPage: string) { 410 private static async addAsyncPluginCSS (htmlStringPage: string) {
411 const globalCSSContent = await readFile(PLUGIN_GLOBAL_CSS_PATH) 411 if (!pathExists(PLUGIN_GLOBAL_CSS_PATH)) {
412 logger.info('Plugin Global CSS file is not available (generation may still be in progress), ignoring it.')
413 return htmlStringPage
414 }
415
416 let globalCSSContent: Buffer
417
418 try {
419 globalCSSContent = await readFile(PLUGIN_GLOBAL_CSS_PATH)
420 } catch (err) {
421 logger.error('Error retrieving the Plugin Global CSS file, ignoring it.', { err })
422 return htmlStringPage
423 }
424
412 if (globalCSSContent.byteLength === 0) return htmlStringPage 425 if (globalCSSContent.byteLength === 0) return htmlStringPage
413 426
414 const fileHash = sha256(globalCSSContent) 427 const fileHash = sha256(globalCSSContent)