From de09ec502d566fae674f3d9d8fa7f21c4ad68c6d Mon Sep 17 00:00:00 2001 From: SirStendec Date: Thu, 14 Dec 2023 18:33:08 -0500 Subject: [PATCH] 4.62.0 * Added: New settings for hiding content from the directory based on tag, content flag, or title. * Fixed: Certain page elements not being hidden correctly. --- package.json | 2 +- src/sites/twitch-twilight/index.js | 4 ++-- .../modules/directory/index.jsx | 23 +++++++++++++++---- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 57f18d20..54dc3975 100755 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "frankerfacez", "author": "Dan Salvato LLC", - "version": "4.61.0", + "version": "4.62.0", "description": "FrankerFaceZ is a Twitch enhancement suite.", "private": true, "license": "Apache-2.0", diff --git a/src/sites/twitch-twilight/index.js b/src/sites/twitch-twilight/index.js index 20833af5..378b7adb 100644 --- a/src/sites/twitch-twilight/index.js +++ b/src/sites/twitch-twilight/index.js @@ -43,7 +43,7 @@ export default class Twilight extends BaseSite { } async populateModules() { - const ctx = await require.context('site/modules', true, /(?:^(?:\.\/)?[^/]+|index)\.jsx?$/); + const ctx = await require.context('site/modules', true, /(?:^(?:\.\/)?[^/]+|index)\.[jt]sx?$/); const modules = await this.loadFromContext(ctx, this.log); this.log.info(`Loaded descriptions of ${Object.keys(modules).length} modules.`); } @@ -439,4 +439,4 @@ Twilight.ROUTES = { Twilight.DIALOG_EXCLUSIVE = '.moderation-root,.sunlight-root,.twilight-main,.twilight-minimal-root>div,#root>div>.tw-full-height,.clips-root,#root'; Twilight.DIALOG_MAXIMIZED = '.moderation-view-page > div[data-highlight-selector="main-grid"],.sunlight-page,.twilight-main,.twilight-minimal-root,#root .dashboard-side-nav+.tw-full-height,.clips-root>.tw-full-height .scrollable-area,.teams-page-body__outer-container .scrollable-area'; -Twilight.DIALOG_SELECTOR = '.moderation-root,.sunlight-root,#root,.twilight-minimal-root>.tw-full-height,.clips-root>.tw-full-height .scrollable-area'; \ No newline at end of file +Twilight.DIALOG_SELECTOR = '.moderation-root,.sunlight-root,#root,.twilight-minimal-root>.tw-full-height,.clips-root>.tw-full-height .scrollable-area'; diff --git a/src/sites/twitch-twilight/modules/directory/index.jsx b/src/sites/twitch-twilight/modules/directory/index.jsx index 5c6f6166..ec44bb07 100644 --- a/src/sites/twitch-twilight/modules/directory/index.jsx +++ b/src/sites/twitch-twilight/modules/directory/index.jsx @@ -326,6 +326,17 @@ export default class Directory extends Module { changed: () => this.updateCards() }); + this.settings.add('directory.wait-flags', { + default: true, + ui: { + path: 'Directory > Channels >> Appearance', + title: 'Hide Thumbnails for all channels until Content Flags have been loaded.', + description: 'We need to load content flags with a separate query, so they aren\'t immediately available to determine if a given stream should be hidden, or have its thumbnail blurred. This setting will blur ALL thumbnails until after we\'ve finished loading the necessary content flag information, ensuring you don\'t see a flash of anything you would rather not.', + component: 'setting-check-box' + }, + changed: () => this.updateCards() + }); + this.settings.add('directory.block-flags', { default: [], type: 'array_merge', @@ -576,13 +587,15 @@ export default class Directory extends Module { const game = props.gameTitle || props.trackingProps?.categoryName || props.trackingProps?.category || props.contextualCardActionProps?.props?.categoryName, tags = props.tagListProps?.freeformTags; - const blur_flags = this.settings.get('directory.blur-flags', []), - block_flags = this.settings.get('directory.block-flags', []); + const need_flags = this.settings.get('directory.wait-flags'), + blur_flags = this.settings.get('directory.blur-flags', []), + block_flags = this.settings.get('directory.block-flags', []), + has_flags = blur_flags.size > 0 || block_flags.size > 0; - if ( el._ffz_flags === undefined && (blur_flags.size || block_flags.size) ) { + if ( el._ffz_flags === undefined && has_flags ) { el._ffz_flags = null; this.twitch_data.getStreamFlags(null, props.channelLogin).then(data => { - el._ffz_flags = data; + el._ffz_flags = data ?? []; this.updateCard(el); }); } @@ -610,6 +623,8 @@ export default class Directory extends Module { } let should_blur = blur_tag; + if ( need_flags && has_flags && el._ffz_flags == null ) + should_blur = true; if ( ! should_blur ) should_blur = this.settings.provider.get('directory.game.hidden-thumbnails', []).includes(game); if ( ! should_blur && blur_flags.size && el._ffz_flags ) {