From 91ea442ce6daadbc0267bf999532967ce3eef2d4 Mon Sep 17 00:00:00 2001 From: John Livingston Date: Tue, 1 Nov 2022 15:17:21 +0100 Subject: [PATCH] =?UTF-8?q?Fix=20=C2=ABautocolor=C2=BB=20mecanism=20when?= =?UTF-8?q?=20no=20color=20provided=20(raised=20an=20error)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 4 +++ server/lib/routers/webchat.ts | 46 +++++++++++++++++++---------------- 2 files changed, 29 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a3f7380..d8f5e1a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,10 @@ If you don't want the chat server to be active, just uninstall the plugin * ConverseJS v10.0.0 (instead of v9.0.0). * Prosody server: enabling mod_disco. +### Minor changes and fixes + +* Fix «autocolor» mecanism when no color provided (raised an error) + ## 5.7.1 * Adding an easy way to customize background transparency in OBS and co. diff --git a/server/lib/routers/webchat.ts b/server/lib/routers/webchat.ts index dbdfdea5..d7e47e30 100644 --- a/server/lib/routers/webchat.ts +++ b/server/lib/routers/webchat.ts @@ -163,28 +163,32 @@ async function initWebchatRouter (options: RegisterServerOptionsV5): Promise - :root { - --peertube-main-foreground: ${autocolors.mainForeground}; - --peertube-main-background: ${autocolors.mainBackground}; - --peertube-grey-foreground: ${autocolors.greyForeground}; - --peertube-grey-background: ${autocolors.greyBackground}; - --peertube-menu-foreground: ${autocolors.menuForeground}; - --peertube-menu-background: ${autocolors.menuBackground}; - --peertube-input-foreground: ${autocolors.inputForeground}; - --peertube-input-background: ${autocolors.inputBackground}; - --peertube-button-foreground: ${autocolors.buttonForeground}; - --peertube-button-background: ${autocolors.buttonBackground}; - --peertube-link: ${autocolors.link}; - --peertube-link-hover: ${autocolors.linkHover}; - } - - ` + if (!Object.values(autocolors).find(c => c !== '')) { + peertubeHelpers.logger.debug('All AutoColors are empty.') } else { - peertubeHelpers.logger.error('Provided AutoColors are invalid.', autoColorsTest) + const autoColorsTest = areAutoColorsValid(autocolors) + if (autoColorsTest === true) { + autocolorsStyles = ` + + ` + } else { + peertubeHelpers.logger.error('Provided AutoColors are invalid.', autoColorsTest) + } } } else { peertubeHelpers.logger.debug('No AutoColors.')