From 64f7a513a8281635f9e144119891b643f849d56f Mon Sep 17 00:00:00 2001 From: SirStendec Date: Tue, 29 Sep 2020 14:15:43 -0400 Subject: [PATCH] 4.20.39 * Fixed: Playback statistics not appearing when experiencing a specific player experiment. * Fixed: Layout issues when viewing a Watch Party with certain features enabled. Note that currently we aren't properly supporting Watch Parties due to the oddly extensive changes they make to the layout. Instead, we just disable certain features when a Watch Party is detected. This may change in the future. Closes #906. Closes #898. * Fixed: Issue with incorrect profile priorities being followed when highlighting badges. Closes #908. * Fixed: Issue with sending whisper messages sometimes breaking whisper UI. Closes #904 * Fixed: Chat font size overrides not working in a specific situation. * Fixed: Incorrect tool-tips for emotes with modifiers. --- package.json | 2 +- src/modules/chat/index.js | 3 +- src/modules/metadata.jsx | 7 +- src/sites/twitch-twilight/modules/channel.jsx | 5 ++ .../twitch-twilight/modules/chat/index.js | 6 +- .../twitch-twilight/modules/chat/line.js | 64 +++++++++++-------- .../modules/css_tweaks/index.js | 9 ++- .../modules/css_tweaks/styles/chat-font.scss | 2 + src/sites/twitch-twilight/modules/layout.js | 5 +- styles/chat.scss | 1 + 10 files changed, 68 insertions(+), 36 deletions(-) diff --git a/package.json b/package.json index 1f7af396..1f9ee24d 100755 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "frankerfacez", "author": "Dan Salvato LLC", - "version": "4.20.38", + "version": "4.20.39", "description": "FrankerFaceZ is a Twitch enhancement suite.", "license": "Apache-2.0", "scripts": { diff --git a/src/modules/chat/index.js b/src/modules/chat/index.js index b60849a6..00940c5c 100644 --- a/src/modules/chat/index.js +++ b/src/modules/chat/index.js @@ -486,7 +486,8 @@ export default class Chat extends Module { const c = item.c || null, v = item.v; - colors.set(v, c); + if ( ! colors.has(v) ) + colors.set(v, c); } return colors; diff --git a/src/modules/metadata.jsx b/src/modules/metadata.jsx index c1989a0a..5f929ebc 100644 --- a/src/modules/metadata.jsx +++ b/src/modules/metadata.jsx @@ -321,7 +321,7 @@ export default class Metadata extends Module { skippedFrames: temp.dropped_frames, videoResolution: `${temp.vid_width}x${temp.vid_height}` } - } else if ( player.stats || player.core?.stats ) { + } else { const videoHeight = maybe_call(player.getVideoHeight, player) || 0, videoWidth = maybe_call(player.getVideoWidth, player) || 0, displayHeight = maybe_call(player.getDisplayHeight, player) || 0, @@ -338,8 +338,9 @@ export default class Metadata extends Module { displayWidth, rate: maybe_call(player.getPlaybackRate, player), fps: Math.floor(maybe_call(player.getVideoFrameRate, player) || 0), - hlsLatencyBroadcaster: player.stats?.broadcasterLatency || player.core?.stats?.broadcasterLatency, - hlsLatencyEncoder: player.stats?.transcoderLatency || player.core?.stats?.transcoderLatency, + hlsLatencyBroadcaster: maybe_call(player.getLiveLatency, player) || 0, + //hlsLatencyBroadcaster: player.stats?.broadcasterLatency || player.core?.stats?.broadcasterLatency, + //hlsLatencyEncoder: player.stats?.transcoderLatency || player.core?.stats?.transcoderLatency, playbackRate: Math.floor((maybe_call(player.getVideoBitRate, player) || 0) / 1000), skippedFrames: maybe_call(player.getDroppedFrames, player), } diff --git a/src/sites/twitch-twilight/modules/channel.jsx b/src/sites/twitch-twilight/modules/channel.jsx index 98de2b22..a315638e 100644 --- a/src/sites/twitch-twilight/modules/channel.jsx +++ b/src/sites/twitch-twilight/modules/channel.jsx @@ -332,6 +332,11 @@ export default class Channel extends Module { if ( ! props?.channelLogin ) props = props?.children?.props; + const watching = props?.watchPartyProps?.isShowingWatchPartyInMain; + this.settings.updateContext({ + isWatchParty: watching + }); + if ( el._ffz_links && props.channelLogin !== el._ffz_link_login ) { const login = el._ffz_link_login = props.channelLogin; if ( login ) { diff --git a/src/sites/twitch-twilight/modules/chat/index.js b/src/sites/twitch-twilight/modules/chat/index.js index 896521ed..a2848666 100644 --- a/src/sites/twitch-twilight/modules/chat/index.js +++ b/src/sites/twitch-twilight/modules/chat/index.js @@ -425,9 +425,9 @@ export default class ChatHook extends Module { }); this.settings.add('chat.use-width', { - requires: ['chat.width', 'context.ui.rightColumnExpanded'], + requires: ['chat.width', 'context.ui.rightColumnExpanded', 'context.isWatchParty'], process(ctx) { - if ( ! ctx.get('context.ui.rightColumnExpanded') ) + if ( ! ctx.get('context.ui.rightColumnExpanded') || ctx.get('context.isWatchParty') ) return false; return ctx.get('chat.width') != 340; @@ -631,7 +631,7 @@ export default class ChatHook extends Module { this.css_tweaks.setVariable('chat-width', `${width/10}rem`); this.css_tweaks.setVariable('negative-chat-width', `${-width/10}rem`); - this.css_tweaks.toggle('chat-font', size !== 12 || font); + this.css_tweaks.toggle('chat-font', size !== 12 || font !== 'inherit'); this.css_tweaks.toggle('chat-width', this.settings.get('chat.use-width')); this.css_tweaks.toggle('emote-alignment-padded', emote_alignment === 1); diff --git a/src/sites/twitch-twilight/modules/chat/line.js b/src/sites/twitch-twilight/modules/chat/line.js index 863b0a48..c8d160ac 100644 --- a/src/sites/twitch-twilight/modules/chat/line.js +++ b/src/sites/twitch-twilight/modules/chat/line.js @@ -178,38 +178,50 @@ export default class ChatLine extends Module { cls.prototype.render = function() { this._ffz_no_scan = true; - if ( ! this.props.message || ! this.props.message.content ) + if ( ! this.props.message || ! this.props.message.content || ! this.props.message.from ) return old_render.call(this); - const msg = t.chat.standardizeWhisper(this.props.message), + try { + const msg = t.chat.standardizeWhisper(this.props.message), - is_action = msg.is_action, - user = msg.user, - raw_color = t.overrides.getColor(user.id) || user.color, - color = t.parent.colors.process(raw_color), + is_action = msg.is_action, + user = msg.user, + raw_color = t.overrides.getColor(user.id) || user.color, + color = t.parent.colors.process(raw_color), - tokens = msg.ffz_tokens = msg.ffz_tokens || t.chat.tokenizeMessage(msg, null, null), - contents = t.chat.renderTokens(tokens, e), + tokens = msg.ffz_tokens = msg.ffz_tokens || t.chat.tokenizeMessage(msg, null, null), + contents = t.chat.renderTokens(tokens, e), - override_name = t.overrides.getName(user.id); + override_name = t.overrides.getName(user.id); - return e('div', {className: 'thread-message__message'}, - e('div', {className: 'tw-pd-x-1 tw-pd-y-05'}, [ - e('span', { - className: `thread-message__message--user-name notranslate${override_name ? ' ffz--name-override' : ''}`, - style: { - color - } - }, override_name || user.displayName), - e('span', null, is_action ? ' ' : ': '), - e('span', { - className: 'message', - style: { - color: is_action && color - } - }, contents) - ]) - ); + return e('div', {className: 'thread-message__message'}, + e('div', {className: 'tw-pd-x-1 tw-pd-y-05'}, [ + e('span', { + className: `thread-message__message--user-name notranslate${override_name ? ' ffz--name-override' : ''}`, + style: { + color + } + }, override_name || user.displayName), + e('span', null, is_action ? ' ' : ': '), + e('span', { + className: 'message', + style: { + color: is_action && color + } + }, contents) + ]) + ); + + } catch(err) { + t.log.error(err); + t.log.capture(err, { + extra: { + props: this.props + } + }); + + return old_render.call(this); + } } // Do this after a short delay to hopefully reduce the chance of React diff --git a/src/sites/twitch-twilight/modules/css_tweaks/index.js b/src/sites/twitch-twilight/modules/css_tweaks/index.js index 808648eb..31f7c9cd 100644 --- a/src/sites/twitch-twilight/modules/css_tweaks/index.js +++ b/src/sites/twitch-twilight/modules/css_tweaks/index.js @@ -92,8 +92,11 @@ export default class CSSTweaks extends Module { }); this.settings.add('layout.use-chat-fix', { - requires: ['context.force_chat_fix', 'layout.swap-sidebars', 'layout.use-portrait', 'chat.use-width'], + requires: ['context.force_chat_fix', 'layout.swap-sidebars', 'layout.use-portrait', 'chat.use-width', 'context.isWatchParty'], process(ctx) { + if ( ctx.get('context.isWatchParty') ) + return false; + return ctx.get('context.force_chat_fix') || ctx.get('layout.swap-sidebars') || ctx.get('layout.use-portrait') || ctx.get('chat.use-width') }, changed: val => { @@ -223,6 +226,10 @@ export default class CSSTweaks extends Module { this.settings.add('layout.swap-sidebars', { default: false, + requires: ['context.isWatchParty'], + process(ctx, val) { + return ctx.get('context.isWatchParty') ? false : val; + }, ui: { path: 'Appearance > Layout >> Side Navigation', title: 'Swap Sidebars', diff --git a/src/sites/twitch-twilight/modules/css_tweaks/styles/chat-font.scss b/src/sites/twitch-twilight/modules/css_tweaks/styles/chat-font.scss index 70faa74d..b8fccc0a 100644 --- a/src/sites/twitch-twilight/modules/css_tweaks/styles/chat-font.scss +++ b/src/sites/twitch-twilight/modules/css_tweaks/styles/chat-font.scss @@ -1,5 +1,7 @@ .video-chat__message-list-wrapper, .whispers-thread__content, +.chat-list--other, +.chat-list--default, .chat-list { font-size: var(--ffz-chat-font-size); line-height: var(--ffz-chat-line-height); diff --git a/src/sites/twitch-twilight/modules/layout.js b/src/sites/twitch-twilight/modules/layout.js index 36cd26d7..1b273160 100644 --- a/src/sites/twitch-twilight/modules/layout.js +++ b/src/sites/twitch-twilight/modules/layout.js @@ -73,8 +73,11 @@ export default class Layout extends Module { }) this.settings.add('layout.use-portrait', { - requires: ['layout.portrait', 'layout.portrait-threshold', 'context.route.name', 'context.size'], + requires: ['layout.portrait', 'layout.portrait-threshold', 'context.route.name', 'context.size', 'context.isWatchParty'], process(ctx) { + if ( ctx.get('context.isWatchParty') ) + return false; + const size = ctx.get('context.size'); if ( ! size || ! ctx.get('layout.portrait') || ! PORTRAIT_ROUTES.includes(ctx.get('context.route.name')) ) return false; diff --git a/styles/chat.scss b/styles/chat.scss index a4238f87..d538e3ba 100644 --- a/styles/chat.scss +++ b/styles/chat.scss @@ -401,6 +401,7 @@ img { position: absolute; + pointer-events: none !important; top: 50%; left: 50%; transform: translate(-50%, -50%);