diff --git a/package.json b/package.json index decb31e0..78eace9a 100755 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "frankerfacez", "author": "Dan Salvato LLC", - "version": "4.32.2", + "version": "4.32.3", "description": "FrankerFaceZ is a Twitch enhancement suite.", "private": true, "license": "Apache-2.0", diff --git a/src/entry.js b/src/entry.js index a2ffbb43..ca7b8c21 100644 --- a/src/entry.js +++ b/src/entry.js @@ -7,14 +7,16 @@ const DEBUG = localStorage.ffzDebugMode == 'true' && document.body.classList.contains('ffz-dev'), HOST = location.hostname, - FLAVOR = + SERVER = DEBUG ? '//localhost:8000' : '//cdn.frankerfacez.com', + script = document.createElement('script'); + + let FLAVOR = HOST.includes('player') ? 'player' : HOST.includes('clips') ? 'clips' : - (location.pathname === '/p/ffz_bridge/' ? 'bridge' : 'avalon'), - SERVER = DEBUG ? '//localhost:8000' : '//cdn.frankerfacez.com', - //CLIPS = /clips\.twitch\.tv/.test(location.hostname) ? 'clips/' : '', + (location.pathname === '/p/ffz_bridge/' ? 'bridge' : 'avalon'); - script = document.createElement('script'); + if (FLAVOR === 'clips' && location.pathname === '/embed') + FLAVOR = 'player'; script.id = 'ffz-script'; script.async = true; diff --git a/src/experiments.js b/src/experiments.js index fcd3b5c3..9086db47 100644 --- a/src/experiments.js +++ b/src/experiments.js @@ -301,7 +301,12 @@ export default class ExperimentManager extends Module { setTwitchOverride(key, value = null) { const overrides = Cookie.getJSON(OVERRIDE_COOKIE) || {}; - overrides[key] = value; + const experiments = overrides.experiments = overrides.experiments || {}; + const disabled = overrides.disabled = overrides.disabled || []; + experiments[key] = value; + const idx = disabled.indexOf(key); + if (idx != -1) + disabled.remove(idx); Cookie.set(OVERRIDE_COOKIE, overrides, COOKIE_OPTIONS); const core = this.resolve('site')?.getCore?.(); @@ -312,12 +317,13 @@ export default class ExperimentManager extends Module { } deleteTwitchOverride(key) { - const overrides = Cookie.getJSON(OVERRIDE_COOKIE); - if ( ! overrides || ! has(overrides, key) ) + const overrides = Cookie.getJSON(OVERRIDE_COOKIE), + experiments = overrides?.experiments; + if ( ! experiments || ! has(experiments, key) ) return; - const old_val = overrides[key]; - delete overrides[key]; + const old_val = experiments[key]; + delete experiments[key]; Cookie.set(OVERRIDE_COOKIE, overrides, COOKIE_OPTIONS); const core = this.resolve('site')?.getCore?.(); @@ -328,8 +334,9 @@ export default class ExperimentManager extends Module { } hasTwitchOverride(key) { // eslint-disable-line class-methods-use-this - const overrides = Cookie.getJSON(OVERRIDE_COOKIE); - return overrides && has(overrides, key); + const overrides = Cookie.getJSON(OVERRIDE_COOKIE), + experiments = overrides?.experiments; + return experiments && has(experiments, key); } getTwitchAssignment(key, channel = null) { diff --git a/src/modules/main_menu/legal.md b/src/modules/main_menu/legal.md index e5d628f0..c0faa9af 100644 --- a/src/modules/main_menu/legal.md +++ b/src/modules/main_menu/legal.md @@ -37,7 +37,7 @@ We use the APIs of the following services for scraping link information: * Twitch ([Terms of Service](https://www.twitch.tv/p/legal/terms-of-service/), [Developer Agreement](https://www.twitch.tv/p/legal/developer-agreement/)) * Twitter ([Terms of Service](https://twitter.com/en/tos), [Developer Terms](https://developer.twitter.com/en/more/developer-terms.html)) * xkcd -* YouTube ([Terms of Service](https://www.youtube.com/t/terms), [Developer Terms of Service](https://developers.google.com/youtube/terms/developer-policies)) +* YouTube ([Terms of Service](https://www.youtube.com/t/terms), [Developer Terms of Service](https://developers.google.com/youtube/terms/developer-policies), [Privacy Policy](https://policies.google.com/privacy)) In addition to scraping via APIs, our link information reads standard metadata tags from HTML responses to support a wide array of other websites. diff --git a/src/sites/twitch-twilight/modules/channel.jsx b/src/sites/twitch-twilight/modules/channel.jsx index 57a5434a..6c3594da 100644 --- a/src/sites/twitch-twilight/modules/channel.jsx +++ b/src/sites/twitch-twilight/modules/channel.jsx @@ -389,6 +389,30 @@ export default class Channel extends Module { el._ffz_links.innerHTML = ''; } + // This is awful, but it works. + let channel = null; + this.fine.searchNode(react, node => { + let state = node?.memoizedState, i = 0; + while(state != null && channel == null && i < 50 ) { + state = state?.next; + channel = state?.memoizedState?.current?.previous?.result?.data?.user; + if (!channel?.lastBroadcast?.game) + channel = null; + i++; + } + return channel != null; + }); + + const game = channel?.lastBroadcast?.game, + title = channel?.lastBroadcast?.title; + + if (game?.id !== el._ffz_game_cache || title !== el._ffz_title_cache) + this.settings.updateContext({ + category: game?.displayName, + categoryID: game?.id, + title + }); + // TODO: See if we can read this data directly from Apollo's cache. // Also, test how it works with videos and clips. /*const raw_game = el.querySelector('a[data-a-target="stream-game-link"]')?.textContent; @@ -405,7 +429,7 @@ export default class Channel extends Module { }).catch(() => { el._ffz_game_cache_updating = false; }); - }*/ + } const other_props = react.child.child?.child?.child?.child?.child?.child?.child?.child?.child?.memoizedProps, title = other_props?.title; @@ -415,7 +439,7 @@ export default class Channel extends Module { this.settings.updateContext({ title }); - } + }*/ if ( ! this.settings.get('channel.hosting.enable') && props.hostLogin ) this.setHost(props.channelID, props.channelLogin, null, null); diff --git a/src/sites/twitch-twilight/modules/css_tweaks/styles/big-emoji.scss b/src/sites/twitch-twilight/modules/css_tweaks/styles/big-emoji.scss new file mode 100644 index 00000000..5dc18a0e --- /dev/null +++ b/src/sites/twitch-twilight/modules/css_tweaks/styles/big-emoji.scss @@ -0,0 +1,6 @@ +.ffz-emoji { + width: 3.6rem !important; + height: 3.6rem !important; + width: calc(var(--ffz-chat-font-size) * 3) !important; + height: calc(var(--ffz-chat-font-size) * 3) !important; +} diff --git a/src/sites/twitch-twilight/modules/css_tweaks/styles/big-emote-jail.scss b/src/sites/twitch-twilight/modules/css_tweaks/styles/big-emote-jail.scss new file mode 100644 index 00000000..d339f88e --- /dev/null +++ b/src/sites/twitch-twilight/modules/css_tweaks/styles/big-emote-jail.scss @@ -0,0 +1,4 @@ +.twitch-emote { + max-height: 32px; + max-width: 64px; +} \ No newline at end of file diff --git a/src/sites/twitch-twilight/modules/css_tweaks/styles/bigger-emote-jail.scss b/src/sites/twitch-twilight/modules/css_tweaks/styles/bigger-emote-jail.scss new file mode 100644 index 00000000..6cfe11ee --- /dev/null +++ b/src/sites/twitch-twilight/modules/css_tweaks/styles/bigger-emote-jail.scss @@ -0,0 +1,4 @@ +.twitch-emote { + max-height: 64px; + max-width: 128px; +} \ No newline at end of file diff --git a/src/sites/twitch-twilight/modules/css_tweaks/styles/chat-fix.scss b/src/sites/twitch-twilight/modules/css_tweaks/styles/chat-fix.scss index fd96aa3a..810fbd2f 100644 --- a/src/sites/twitch-twilight/modules/css_tweaks/styles/chat-fix.scss +++ b/src/sites/twitch-twilight/modules/css_tweaks/styles/chat-fix.scss @@ -1,13 +1,13 @@ body .video-watch-page__right-column, body .clips-watch-page__right-column, body .channel-page__right-column, -body .right-column:not(.right-column--collapsed), +body .right-column:not(.right-column--collapsed):not(.right-column--below), body .channel-videos__right-column, body .channel-clips__sidebar, body .channel-events__sidebar, body .channel-follow-listing__right-column, -body .channel-follow-listing__right-column, -body .channel-root__right-column { +body .channel-follow-listing__right-column/*, +body .channel-root__right-column*/ { width: 34rem; } diff --git a/src/sites/twitch-twilight/modules/css_tweaks/styles/chat-width.scss b/src/sites/twitch-twilight/modules/css_tweaks/styles/chat-width.scss index c9400152..b523c119 100644 --- a/src/sites/twitch-twilight/modules/css_tweaks/styles/chat-width.scss +++ b/src/sites/twitch-twilight/modules/css_tweaks/styles/chat-width.scss @@ -22,13 +22,13 @@ body .channel-page__video-player--theatre-mode { body .video-watch-page__right-column, body .clips-watch-page__right-column, body .channel-page__right-column, -body .right-column:not(.right-column--collapsed), +body .right-column:not(.right-column--collapsed):not(.right-column--below), body .channel-videos__right-column, body .channel-clips__sidebar, body .channel-events__sidebar, body .channel-follow-listing__right-column, -body .channel-follow-listing__right-column, -body .channel-root__right-column { +body .channel-follow-listing__right-column +/*body .channel-root__right-column*/ { width: var(--ffz-chat-width) !important; } diff --git a/src/sites/twitch-twilight/modules/css_tweaks/styles/hide-chat-identity.scss b/src/sites/twitch-twilight/modules/css_tweaks/styles/hide-chat-identity.scss index d48a5e64..7ec8822e 100644 --- a/src/sites/twitch-twilight/modules/css_tweaks/styles/hide-chat-identity.scss +++ b/src/sites/twitch-twilight/modules/css_tweaks/styles/hide-chat-identity.scss @@ -10,6 +10,7 @@ .chat-input__textarea { .chat-wysiwyg-input__editor, + .chat-wysiwyg-input__placeholder, .tw-textarea { padding-left: 1rem !important; } diff --git a/src/sites/twitch-twilight/modules/css_tweaks/styles/swap-sidebars.scss b/src/sites/twitch-twilight/modules/css_tweaks/styles/swap-sidebars.scss index 8d22f6eb..5797d34f 100644 --- a/src/sites/twitch-twilight/modules/css_tweaks/styles/swap-sidebars.scss +++ b/src/sites/twitch-twilight/modules/css_tweaks/styles/swap-sidebars.scss @@ -5,7 +5,7 @@ order: 1; z-index: 2; - #root &:not(.right-column--collapsed) { + #root &:not(.right-column--collapsed):not(.right-column--below) { width: var(--ffz-chat-width); } } diff --git a/src/sites/twitch-twilight/modules/menu_button.jsx b/src/sites/twitch-twilight/modules/menu_button.jsx index ee135ae2..5725a2d6 100644 --- a/src/sites/twitch-twilight/modules/menu_button.jsx +++ b/src/sites/twitch-twilight/modules/menu_button.jsx @@ -56,7 +56,7 @@ export default class MenuButton extends SiteModule { );*/ this.SunlightNav = this.elemental.define( - 'sunlight-nav', '.sunlight-top-nav > div > div > div:nth-last-child(2) > div', + 'sunlight-nav', '.sunlight-top-nav > div > div > div:last-child > div', Twilight.SUNLIGHT_ROUTES, {attributes: true}, 1 ); diff --git a/src/sites/twitch-twilight/modules/mod-view.jsx b/src/sites/twitch-twilight/modules/mod-view.jsx index b47611af..bf38edb4 100644 --- a/src/sites/twitch-twilight/modules/mod-view.jsx +++ b/src/sites/twitch-twilight/modules/mod-view.jsx @@ -216,7 +216,7 @@ export default class ModView extends Module { let channel = null, state = root?.return?.memoizedState, i = 0; while(state != null && channel == null && i < 50 ) { state = state?.next; - channel = state?.memoizedState?.current?.previousData?.result?.data?.channel; + channel = state?.memoizedState?.current?.previous?.result?.data?.channel; i++; } diff --git a/src/sites/twitch-twilight/styles/color_normalizer.scss b/src/sites/twitch-twilight/styles/color_normalizer.scss index 79dc8fed..709ca73f 100644 --- a/src/sites/twitch-twilight/styles/color_normalizer.scss +++ b/src/sites/twitch-twilight/styles/color_normalizer.scss @@ -19,6 +19,7 @@ .chat-room, .video-chat, .qa-vod-chat, + .extensions-popover-view-layout, .video-card { background-color: var(--color-background-base) !important; }